Skip to content

Commit 95aadbb

Browse files
committed
Add support for stm32f038
1 parent 7e0b205 commit 95aadbb

File tree

8 files changed

+34
-11
lines changed

8 files changed

+34
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ stm32f030x6 = ["stm32f030"]
5555
stm32f030x8 = ["stm32f030"]
5656
stm32f030xc = ["stm32f030"]
5757
stm32f031 = ["stm32f0/stm32f0x1", "device-selected"]
58+
stm32f038 = ["stm32f0/stm32f0x8", "device-selected"]
5859
stm32f042 = ["stm32f0/stm32f0x2", "device-selected"]
5960
stm32f051 = ["stm32f0/stm32f0x1", "device-selected"]
6061
stm32f070 = ["stm32f0/stm32f0x0", "device-selected"]

src/adc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ impl VRef {
354354

355355
#[cfg(any(
356356
feature = "stm32f031",
357+
feature = "stm32f038",
357358
feature = "stm32f042",
358359
feature = "stm32f051",
359360
feature = "stm32f071",
@@ -366,6 +367,7 @@ pub struct VBat;
366367

367368
#[cfg(any(
368369
feature = "stm32f031",
370+
feature = "stm32f038",
369371
feature = "stm32f042",
370372
feature = "stm32f051",
371373
feature = "stm32f071",
@@ -378,6 +380,7 @@ adc_pins!(
378380

379381
#[cfg(any(
380382
feature = "stm32f031",
383+
feature = "stm32f038",
381384
feature = "stm32f042",
382385
feature = "stm32f051",
383386
feature = "stm32f071",

src/gpio.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ gpio!(GPIOB, gpiob, iopben, PB, [
561561
PB15: (pb15, 15, Input<Floating>),
562562
]);
563563

564-
#[cfg(feature = "stm32f042")]
564+
#[cfg(any(feature = "stm32f038", feature = "stm32f042"))]
565565
gpio!(GPIOC, gpioc, iopcen, PC, [
566566
PC13: (pc13, 13, Input<Floating>),
567567
PC14: (pc14, 14, Input<Floating>),
@@ -643,13 +643,6 @@ gpio!(GPIOD, gpiod, iopden, PD, [
643643
// PE15: (pe15, 15, Input<Floating>),
644644
// ]);
645645

646-
#[cfg(feature = "stm32f042")]
647-
gpio!(GPIOF, gpiof, iopfen, PF, [
648-
PF0: (pf0, 0, Input<Floating>),
649-
PF1: (pf1, 1, Input<Floating>),
650-
PF11: (pf11, 11, Input<Floating>),
651-
]);
652-
653646
#[cfg(any(feature = "stm32f030", feature = "stm32f051"))]
654647
gpio!(GPIOF, gpiof, iopfen, PF, [
655648
PF0: (pf0, 0, Input<Floating>),
@@ -666,6 +659,21 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
666659
PF7: (pf7, 7, Input<Floating>),
667660
]);
668661

662+
#[cfg(feature = "stm32f038")]
663+
gpio!(GPIOF, gpiof, iopfen, PF, [
664+
PF0: (pf0, 0, Input<Floating>),
665+
PF1: (pf1, 1, Input<Floating>),
666+
PF6: (pf6, 6, Input<Floating>),
667+
PF7: (pf7, 7, Input<Floating>),
668+
]);
669+
670+
#[cfg(feature = "stm32f042")]
671+
gpio!(GPIOF, gpiof, iopfen, PF, [
672+
PF0: (pf0, 0, Input<Floating>),
673+
PF1: (pf1, 1, Input<Floating>),
674+
PF11: (pf11, 11, Input<Floating>),
675+
]);
676+
669677
#[cfg(feature = "stm32f070")]
670678
gpio!(GPIOF, gpiof, iopfen, PF, [
671679
PF0: (pf0, 0, Input<Floating>),

src/i2c.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ macro_rules! i2c_pins {
3636
#[cfg(any(
3737
feature = "stm32f030",
3838
feature = "stm32f031",
39+
feature = "stm32f038",
3940
feature = "stm32f042",
4041
feature = "stm32f051",
4142
feature = "stm32f070",
@@ -69,7 +70,12 @@ i2c_pins! {
6970
sda => [gpioa::PA12<Alternate<AF5>>],
7071
}
7172
}
72-
#[cfg(any(feature = "stm32f031", feature = "stm32f042", feature = "stm32f030x6"))]
73+
#[cfg(any(
74+
feature = "stm32f031",
75+
feature = "stm32f038",
76+
feature = "stm32f042",
77+
feature = "stm32f030x6",
78+
))]
7379
i2c_pins! {
7480
I2C1 => {
7581
scl => [gpiob::PB10<Alternate<AF1>>],

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ pub use stm32f0::stm32f0x1 as stm32;
1717
#[cfg(any(feature = "stm32f042", feature = "stm32f072"))]
1818
pub use stm32f0::stm32f0x2 as stm32;
1919

20+
#[cfg(feature = "stm32f038")]
21+
pub use stm32f0::stm32f0x8 as stm32;
22+
2023
#[cfg(feature = "device-selected")]
2124
pub mod adc;
2225
#[cfg(feature = "device-selected")]

src/serial.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ usart_pins! {
126126
rx => [gpioa::PA10<Alternate<AF1>>, gpiob::PB6<Alternate<AF0>>],
127127
}
128128
}
129-
#[cfg(any(feature = "stm32f031", feature = "stm32f030x6"))]
129+
#[cfg(any(feature = "stm32f030x6", feature = "stm32f031", feature = "stm32f038"))]
130130
usart_pins! {
131131
USART1 => {
132132
tx => [gpioa::PA2<Alternate<AF1>>, gpioa::PA14<Alternate<AF1>>],
@@ -135,6 +135,7 @@ usart_pins! {
135135
}
136136
#[cfg(any(
137137
feature = "stm32f031",
138+
feature = "stm32f038",
138139
feature = "stm32f070",
139140
feature = "stm32f072",
140141
feature = "stm32f091",

src/spi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ spi_pins! {
112112
mosi => [gpioa::PA7<Alternate<AF0>>, gpiob::PB5<Alternate<AF0>>],
113113
}
114114
}
115-
#[cfg(feature = "stm32f030x6")]
115+
#[cfg(any(feature = "stm32f030x6", feature = "stm32f038"))]
116116
spi_pins! {
117117
SPI1 => {
118118
sck => [gpiob::PB13<Alternate<AF0>>],

src/timers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ timers! {
224224

225225
#[cfg(any(
226226
feature = "stm32f031",
227+
feature = "stm32f038",
227228
feature = "stm32f042",
228229
feature = "stm32f051",
229230
feature = "stm32f071",

0 commit comments

Comments
 (0)