@@ -6,7 +6,7 @@ use crate::gpio::{Alternate, OpenDrain, Output, AF4};
6
6
use crate :: hal:: blocking:: i2c:: { Read , Write , WriteRead } ;
7
7
use crate :: pac:: { i2c1, I2C1 , I2C2 } ;
8
8
use crate :: rcc:: { Clocks , APB1R1 } ;
9
- #[ cfg( feature = "stm32l4x5" ) ]
9
+ #[ cfg( any ( feature = "stm32l4x5" , feature = "stm32l4x6" ) ) ]
10
10
use crate :: stm32:: I2C3 ;
11
11
use crate :: time:: Hertz ;
12
12
use cast:: { u16, u8} ;
@@ -147,6 +147,21 @@ impl<SCL, SDA> I2c<I2C2, (SCL, SDA)> {
147
147
}
148
148
}
149
149
150
+ #[ cfg( any( feature = "stm32l4x5" , feature = "stm32l4x6" ) ) ]
151
+ impl < SCL , SDA > I2c < I2C3 , ( SCL , SDA ) > {
152
+ pub fn i2c3 < F > ( i2c : I2C3 , pins : ( SCL , SDA ) , freq : F , clocks : Clocks , apb1 : & mut APB1R1 ) -> Self
153
+ where
154
+ F : Into < Hertz > ,
155
+ SCL : SclPin < I2C3 > ,
156
+ SDA : SdaPin < I2C3 > ,
157
+ {
158
+ apb1. enr ( ) . modify ( |_, w| w. i2c3en ( ) . set_bit ( ) ) ;
159
+ apb1. rstr ( ) . modify ( |_, w| w. i2c3rst ( ) . set_bit ( ) ) ;
160
+ apb1. rstr ( ) . modify ( |_, w| w. i2c3rst ( ) . clear_bit ( ) ) ;
161
+ Self :: new ( i2c, pins, freq, clocks)
162
+ }
163
+ }
164
+
150
165
impl < SCL , SDA , I2C > I2c < I2C , ( SCL , SDA ) >
151
166
where
152
167
I2C : Deref < Target = i2c1:: RegisterBlock > ,
@@ -460,7 +475,7 @@ where
460
475
use crate :: gpio:: gpioa:: { PA10 , PA9 } ;
461
476
use crate :: gpio:: gpiob:: { PB10 , PB11 , PB6 , PB7 } ;
462
477
463
- #[ cfg( any( feature = "stm32l4x3" , feature = "stm32l4x5" ) ) ]
478
+ #[ cfg( any( feature = "stm32l4x3" , feature = "stm32l4x5" , feature = "stm32l4x6" ) ) ]
464
479
use crate :: gpio:: gpioc:: { PC0 , PC1 } ;
465
480
466
481
#[ cfg( any( feature = "stm32l4x1" , feature = "stm32l4x3" , feature = "stm32l4x6" ) ) ]
@@ -481,7 +496,7 @@ pins!(I2C1, AF4, SCL: [PB8], SDA: [PB9]);
481
496
#[ cfg( any( feature = "stm32l4x1" , feature = "stm32l4x6" ) ) ]
482
497
pins ! ( I2C2 , AF4 , SCL : [ PB13 ] , SDA : [ PB14 ] ) ;
483
498
484
- #[ cfg( feature = "stm32l4x5" ) ]
499
+ #[ cfg( any ( feature = "stm32l4x5" , feature = "stm32l4x6" ) ) ]
485
500
pins ! ( I2C3 , AF4 , SCL : [ PC0 ] , SDA : [ PC1 ] ) ;
486
501
487
502
#[ cfg( feature = "stm32l4x3" ) ]
0 commit comments