mirror of
				https://github.com/PSenfft/mb85rc.git
				synced 2025-11-04 07:44:10 +00:00 
			
		
		
		
	added example embedded_io impl
This commit is contained in:
		
							parent
							
								
									44f24c5ace
								
							
						
					
					
						commit
						07d2dbfd43
					
				
							
								
								
									
										17
									
								
								src/lib.rs
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/lib.rs
									
									
									
									
									
								
							@ -1,11 +1,14 @@
 | 
			
		||||
use embedded_hal::i2c::I2c;
 | 
			
		||||
use std::convert::Infallible;
 | 
			
		||||
 | 
			
		||||
use embedded_hal::i2c::{I2c, SevenBitAddress};
 | 
			
		||||
use embedded_io::{ErrorType, Read};
 | 
			
		||||
 | 
			
		||||
const DEVICE_ADDRESS: u8 = 0b10100000;
 | 
			
		||||
const DEVICE_ADDRESS_CODE: u8 = 0b00000000;
 | 
			
		||||
const DEVICE_W: u8 = 0b00000000;
 | 
			
		||||
const DEVICE_R: u8 = 0b00000001;
 | 
			
		||||
 | 
			
		||||
struct MB85RC<T: I2c> {
 | 
			
		||||
struct MB85RC<T: I2c<SevenBitAddress>> {
 | 
			
		||||
    i2c: T,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -14,3 +17,13 @@ impl<T: I2c> MB85RC<T> {
 | 
			
		||||
        MB85RC { i2c }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<T: I2c> ErrorType for MB85RC<T> {
 | 
			
		||||
    type Error = Infallible;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<T: I2c> Read for MB85RC<T> {
 | 
			
		||||
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
 | 
			
		||||
        todo!()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user