@@ -4,20 +4,20 @@ impl<I2C: super::Instance> embedded_hal::i2c::ErrorType for super::I2c<I2C> {
44
55mod blocking {
66 use super :: super :: { I2c , Instance } ;
7- use embedded_hal:: i2c:: Operation ;
7+ use embedded_hal:: i2c:: { Operation , SevenBitAddress , TenBitAddress } ;
88
99 impl < I2C : Instance > embedded_hal:: i2c:: I2c for I2c < I2C > {
10- fn read ( & mut self , addr : u8 , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
10+ fn read ( & mut self , addr : SevenBitAddress , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
1111 self . read ( addr, buffer)
1212 }
1313
14- fn write ( & mut self , addr : u8 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
14+ fn write ( & mut self , addr : SevenBitAddress , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
1515 self . write ( addr, bytes)
1616 }
1717
1818 fn write_read (
1919 & mut self ,
20- addr : u8 ,
20+ addr : SevenBitAddress ,
2121 bytes : & [ u8 ] ,
2222 buffer : & mut [ u8 ] ,
2323 ) -> Result < ( ) , Self :: Error > {
@@ -26,7 +26,34 @@ mod blocking {
2626
2727 fn transaction (
2828 & mut self ,
29- addr : u8 ,
29+ addr : SevenBitAddress ,
30+ operations : & mut [ Operation < ' _ > ] ,
31+ ) -> Result < ( ) , Self :: Error > {
32+ self . transaction_slice ( addr, operations)
33+ }
34+ }
35+
36+ impl < I2C : Instance > embedded_hal:: i2c:: I2c < TenBitAddress > for I2c < I2C > {
37+ fn read ( & mut self , addr : TenBitAddress , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
38+ self . read ( addr, buffer)
39+ }
40+
41+ fn write ( & mut self , addr : TenBitAddress , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
42+ self . write ( addr, bytes)
43+ }
44+
45+ fn write_read (
46+ & mut self ,
47+ addr : TenBitAddress ,
48+ bytes : & [ u8 ] ,
49+ buffer : & mut [ u8 ] ,
50+ ) -> Result < ( ) , Self :: Error > {
51+ self . write_read ( addr, bytes, buffer)
52+ }
53+
54+ fn transaction (
55+ & mut self ,
56+ addr : TenBitAddress ,
3057 operations : & mut [ Operation < ' _ > ] ,
3158 ) -> Result < ( ) , Self :: Error > {
3259 self . transaction_slice ( addr, operations)
0 commit comments