Skip to content

Commit 69331ab

Browse files
Piroro-hsSh3Rm4n
authored andcommitted
Clean up #[cfg] statements in i2c.rs
1 parent 8f05e23 commit 69331ab

File tree

1 file changed

+8
-60
lines changed

1 file changed

+8
-60
lines changed

src/i2c.rs

Lines changed: 8 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,10 @@ use crate::{
1010
time::Hertz,
1111
};
1212

13-
#[cfg(not(any(
14-
feature = "stm32f303x6",
15-
feature = "stm32f303x8",
16-
feature = "stm32f334",
17-
feature = "stm32f328",
18-
)))]
13+
#[cfg(not(feature = "gpio-f333"))]
1914
use crate::{gpio::gpiof, pac::I2C2};
20-
#[cfg(any(
21-
feature = "stm32f301",
22-
feature = "stm32f302x6",
23-
feature = "stm32f302x8",
24-
feature = "stm32f302xd",
25-
feature = "stm32f302xe",
26-
feature = "stm32f303xd",
27-
feature = "stm32f303xe",
28-
feature = "stm32f318",
29-
feature = "stm32f398",
30-
))]
15+
16+
#[cfg(any(feature = "gpio-f302", feature = "gpio-f303e"))]
3117
use crate::{
3218
gpio::{gpioc, AF3, AF8},
3319
pac::I2C3,
@@ -68,12 +54,7 @@ unsafe impl SdaPin<I2C1> for gpiob::PB7<AF4> {}
6854
unsafe impl SdaPin<I2C1> for gpiob::PB9<AF4> {}
6955

7056
cfg_if! {
71-
if #[cfg(not(any(
72-
feature = "stm32f303x6",
73-
feature = "stm32f303x8",
74-
feature = "stm32f334",
75-
feature = "stm32f328",
76-
)))] {
57+
if #[cfg(not(feature = "gpio-f333"))] {
7758
unsafe impl SclPin<I2C2> for gpioa::PA9<AF4> {}
7859
unsafe impl SclPin<I2C2> for gpiof::PF1<AF4> {}
7960
#[cfg(any(feature = "gpio-f303", feature = "gpio-f303e", feature = "gpio-f373"))]
@@ -86,17 +67,7 @@ cfg_if! {
8667
}
8768

8869
cfg_if! {
89-
if #[cfg(any(
90-
feature = "stm32f301",
91-
feature = "stm32f302x6",
92-
feature = "stm32f302x8",
93-
feature = "stm32f302xd",
94-
feature = "stm32f302xe",
95-
feature = "stm32f303xd",
96-
feature = "stm32f303xe",
97-
feature = "stm32f318",
98-
feature = "stm32f398",
99-
))] {
70+
if #[cfg(any(feature = "gpio-f302", feature = "gpio-f303e"))] {
10071
unsafe impl SclPin<I2C3> for gpioa::PA8<AF3> {}
10172
unsafe impl SdaPin<I2C3> for gpiob::PB5<AF8> {}
10273
unsafe impl SdaPin<I2C3> for gpioc::PC9<AF3> {}
@@ -479,34 +450,11 @@ macro_rules! i2c {
479450
};
480451
}
481452

482-
#[cfg(any(
483-
feature = "stm32f303x6",
484-
feature = "stm32f303x8",
485-
feature = "stm32f334",
486-
feature = "stm32f328",
487-
))]
453+
#[cfg(feature = "gpio-f333")]
488454
i2c!([1]);
489455

490-
#[cfg(any(
491-
feature = "stm32f302xb",
492-
feature = "stm32f302xc",
493-
feature = "stm32f303xb",
494-
feature = "stm32f303xc",
495-
feature = "stm32f358",
496-
feature = "stm32f373",
497-
feature = "stm32f378",
498-
))]
456+
#[cfg(any(feature = "gpio-f303", feature = "gpio-f373"))]
499457
i2c!([1, 2]);
500458

501-
#[cfg(any(
502-
feature = "stm32f301",
503-
feature = "stm32f302x6",
504-
feature = "stm32f302x8",
505-
feature = "stm32f302xd",
506-
feature = "stm32f302xe",
507-
feature = "stm32f303xd",
508-
feature = "stm32f303xe",
509-
feature = "stm32f318",
510-
feature = "stm32f398",
511-
))]
459+
#[cfg(any(feature = "gpio-f302", feature = "gpio-f303e"))]
512460
i2c!([1, 2, 3]);

0 commit comments

Comments
 (0)