File tree Expand file tree Collapse file tree 5 files changed +38
-7
lines changed Expand file tree Collapse file tree 5 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ stm32l082 = ["stm32l0x2"]
65
65
66
66
# Features based on the GPIO peripheral version.
67
67
# This determines the pin function mapping of the MCU.
68
+ # Note: The easiest way to pick the proper io-* feature is to apply
69
+ # the matching mcu-* feature for your MCU!
68
70
io-STM32L021 = []
69
71
io-STM32L031 = []
70
72
io-STM32L051 = []
@@ -302,9 +304,13 @@ required-features = ["rt"]
302
304
name = " flash"
303
305
required-features = [" rt" ," stm32l082" ]
304
306
307
+ [[example ]]
308
+ name = " i2c"
309
+ required-features = [" rt" ," stm32l0x2" ," io-STM32L071" ]
310
+
305
311
[[example ]]
306
312
name = " i2c_dma"
307
- required-features = [" rt" ," stm32l0x2" ]
313
+ required-features = [" rt" ," stm32l0x2" , " io-STM32L071 " ]
308
314
309
315
[[example ]]
310
316
name = " rng"
Original file line number Diff line number Diff line change @@ -28,20 +28,24 @@ use as_slice::AsSlice;
28
28
29
29
use crate :: {
30
30
adc,
31
- i2c,
32
31
pac:: {
33
32
self ,
34
33
dma1:: ch:: cr,
35
- I2C1 ,
36
- I2C2 ,
37
- I2C3 ,
38
34
USART1 ,
39
35
USART2 ,
40
36
} ,
41
37
rcc:: Rcc ,
42
38
serial,
43
39
} ;
44
40
41
+ #[ cfg( any(
42
+ feature = "io-STM32L021" ,
43
+ feature = "io-STM32L031" ,
44
+ feature = "io-STM32L051" ,
45
+ feature = "io-STM32L071" ,
46
+ ) ) ]
47
+ use crate :: { i2c, pac:: { I2C1 , I2C2 , I2C3 } } ;
48
+
45
49
#[ cfg( feature = "stm32l082" ) ]
46
50
use crate :: aes;
47
51
@@ -536,6 +540,12 @@ impl_target!(
536
540
) ;
537
541
538
542
#[ cfg( feature = "stm32l0x2" ) ]
543
+ #[ cfg( any(
544
+ feature = "io-STM32L021" ,
545
+ feature = "io-STM32L031" ,
546
+ feature = "io-STM32L051" ,
547
+ feature = "io-STM32L071" ,
548
+ ) ) ]
539
549
impl_target ! (
540
550
// I2C1
541
551
i2c:: Tx <I2C1 >, Channel2 , 6 ;
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ use as_slice::{
15
15
AsMutSlice ,
16
16
} ;
17
17
18
- use crate :: hal:: blocking:: i2c:: { Read , Write , WriteRead } ;
19
18
20
19
#[ cfg( feature = "stm32l0x2" ) ]
21
20
use crate :: dma:: {
@@ -32,6 +31,9 @@ use crate::rcc::Rcc;
32
31
use crate :: time:: Hertz ;
33
32
use cast:: u8;
34
33
34
+ // I²C traits
35
+ use crate :: hal:: blocking:: i2c:: { Read , Write , WriteRead } ;
36
+
35
37
// I/O Imports
36
38
use crate :: gpio:: { AltMode , OpenDrain , Output } ;
37
39
#[ cfg( feature = "io-STM32L021" ) ]
Original file line number Diff line number Diff line change @@ -23,6 +23,12 @@ pub mod exti;
23
23
#[ cfg( feature = "stm32l0x2" ) ]
24
24
pub mod flash;
25
25
pub mod gpio;
26
+ #[ cfg( any(
27
+ feature = "io-STM32L021" ,
28
+ feature = "io-STM32L031" ,
29
+ feature = "io-STM32L051" ,
30
+ feature = "io-STM32L071" ,
31
+ ) ) ]
26
32
pub mod i2c;
27
33
pub mod lptim;
28
34
pub mod prelude;
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ pub use crate::{
13
13
adc:: AdcExt as _,
14
14
delay:: DelayExt as _,
15
15
gpio:: GpioExt as _,
16
- i2c:: I2cExt as _,
17
16
pwr:: PowerMode as _,
18
17
rcc:: RccExt as _,
19
18
serial:: {
@@ -28,3 +27,11 @@ pub use crate::{
28
27
WindowWatchdogExt as _,
29
28
} ,
30
29
} ;
30
+
31
+ #[ cfg( any(
32
+ feature = "io-STM32L021" ,
33
+ feature = "io-STM32L031" ,
34
+ feature = "io-STM32L051" ,
35
+ feature = "io-STM32L071" ,
36
+ ) ) ]
37
+ pub use crate :: i2c:: I2cExt as _;
You can’t perform that action at this time.
0 commit comments