Skip to content

Commit b016ffd

Browse files
committed
Add support for stm32f051
1 parent e6db427 commit b016ffd

File tree

8 files changed

+20
-7
lines changed

8 files changed

+20
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ stm32f030x8 = ["stm32f030"]
5353
stm32f030xc = ["stm32f030"]
5454
stm32f031 = ["stm32f0/stm32f0x1", "device-selected"]
5555
stm32f042 = ["stm32f0/stm32f0x2", "device-selected"]
56+
stm32f051 = ["stm32f0/stm32f0x1", "device-selected"]
5657
stm32f070 = ["stm32f0/stm32f0x0", "device-selected"]
5758
stm32f070x6 = ["stm32f070"]
5859
stm32f070xb = ["stm32f070"]

src/adc.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ adc_pins!(
206206

207207
#[cfg(any(
208208
feature = "stm32f030",
209+
feature = "stm32f051",
209210
feature = "stm32f070",
210211
feature = "stm32f072",
211212
feature = "stm32f091"
@@ -353,6 +354,7 @@ impl VRef {
353354
#[cfg(any(
354355
feature = "stm32f031",
355356
feature = "stm32f042",
357+
feature = "stm32f051",
356358
feature = "stm32f072",
357359
feature = "stm32f091",
358360
))]
@@ -363,6 +365,7 @@ pub struct VBat;
363365
#[cfg(any(
364366
feature = "stm32f031",
365367
feature = "stm32f042",
368+
feature = "stm32f051",
366369
feature = "stm32f072",
367370
feature = "stm32f091",
368371
))]
@@ -373,6 +376,7 @@ adc_pins!(
373376
#[cfg(any(
374377
feature = "stm32f031",
375378
feature = "stm32f042",
379+
feature = "stm32f051",
376380
feature = "stm32f072",
377381
feature = "stm32f091",
378382
))]

src/gpio.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
570570

571571
#[cfg(any(
572572
feature = "stm32f030",
573+
feature = "stm32f051",
573574
feature = "stm32f070",
574575
feature = "stm32f072",
575576
feature = "stm32f091",
@@ -593,7 +594,7 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
593594
PC15: (pc15, 15, Input<Floating>),
594595
]);
595596

596-
#[cfg(any(feature = "stm32f030", feature = "stm32f070"))]
597+
#[cfg(any(feature = "stm32f030", feature = "stm32f051", feature = "stm32f070"))]
597598
gpio!(GPIOD, gpiod, iopden, PD, [
598599
PD2: (pd2, 2, Input<Floating>),
599600
]);
@@ -648,7 +649,7 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
648649
PF11: (pf11, 11, Input<Floating>),
649650
]);
650651

651-
#[cfg(feature = "stm32f030")]
652+
#[cfg(any(feature = "stm32f030", feature = "stm32f051"))]
652653
gpio!(GPIOF, gpiof, iopfen, PF, [
653654
PF0: (pf0, 0, Input<Floating>),
654655
PF1: (pf1, 1, Input<Floating>),

src/i2c.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ i2c_pins! {
6969
}
7070
#[cfg(any(
7171
feature = "stm32f031",
72+
feature = "stm32f051",
7273
feature = "stm32f070",
7374
feature = "stm32f072",
7475
feature = "stm32f091",
@@ -94,7 +95,7 @@ i2c_pins! {
9495
}
9596
}
9697

97-
#[cfg(any(feature = "stm32f030x8"))]
98+
#[cfg(any(feature = "stm32f030x8", feature = "stm32f051"))]
9899
i2c_pins! {
99100
I2C2 => {
100101
scl => [gpiob::PB10<Alternate<AF1>>],
@@ -156,8 +157,7 @@ i2c! {
156157

157158
#[cfg(any(
158159
feature = "stm32f030xc",
159-
// XXX: This can't be right
160-
feature = "stm32f030xc",
160+
feature = "stm32f051",
161161
feature = "stm32f070xb",
162162
feature = "stm32f072",
163163
feature = "stm32f091",

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use stm32f0;
66
#[cfg(any(feature = "stm32f030", feature = "stm32f070"))]
77
pub use stm32f0::stm32f0x0 as stm32;
88

9-
#[cfg(any(feature = "stm32f031", feature = "stm32f091"))]
9+
#[cfg(any(feature = "stm32f031", feature = "stm32f051", feature = "stm32f091"))]
1010
pub use stm32f0::stm32f0x1 as stm32;
1111

1212
#[cfg(any(feature = "stm32f042", feature = "stm32f072"))]

src/serial.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ macro_rules! usart_pins {
8585
}
8686
}
8787

88-
#[cfg(any(feature = "stm32f030", feature = "stm32f042"))]
88+
#[cfg(any(feature = "stm32f030", feature = "stm32f042", feature = "stm32f051"))]
8989
usart_pins! {
9090
USART1 => {
9191
tx => [gpioa::PA9<Alternate<AF1>>, gpiob::PB6<Alternate<AF0>>],
@@ -111,10 +111,12 @@ usart_pins! {
111111
rx => [gpioa::PA10<Alternate<AF1>>, gpiob::PB7<Alternate<AF0>>],
112112
}
113113
}
114+
114115
#[cfg(any(
115116
feature = "stm32f030x8",
116117
feature = "stm32f030xc",
117118
feature = "stm32f042",
119+
feature = "stm32f051",
118120
feature = "stm32f070",
119121
feature = "stm32f072",
120122
feature = "stm32f091",
@@ -283,6 +285,7 @@ usart! {
283285
feature = "stm32f030x8",
284286
feature = "stm32f030xc",
285287
feature = "stm32f042",
288+
feature = "stm32f051",
286289
feature = "stm32f070",
287290
feature = "stm32f072",
288291
feature = "stm32f091",

src/spi.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ spi_pins! {
133133
#[cfg(any(
134134
feature = "stm32f030x8",
135135
feature = "stm32f030xc",
136+
feature = "stm32f051",
136137
feature = "stm32f070xb",
137138
feature = "stm32f072",
138139
feature = "stm32f091",
@@ -204,6 +205,7 @@ spi! {
204205
#[cfg(any(
205206
feature = "stm32f030x8",
206207
feature = "stm32f030xc",
208+
feature = "stm32f051",
207209
feature = "stm32f070xb",
208210
feature = "stm32f091",
209211
))]

src/timers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ timers! {
225225
#[cfg(any(
226226
feature = "stm32f030x8",
227227
feature = "stm32f030xc",
228+
feature = "stm32f051",
228229
feature = "stm32f070xb",
229230
feature = "stm32f072",
230231
feature = "stm32f091",
@@ -247,6 +248,7 @@ timers! {
247248
#[cfg(any(
248249
feature = "stm32f031",
249250
feature = "stm32f042",
251+
feature = "stm32f051",
250252
feature = "stm32f072",
251253
feature = "stm32f091",
252254
))]

0 commit comments

Comments
 (0)