Skip to content

Commit e225bc0

Browse files
committed
Add support for stm32f048
1 parent 95aadbb commit e225bc0

File tree

8 files changed

+27
-6
lines changed

8 files changed

+27
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ stm32f030xc = ["stm32f030"]
5757
stm32f031 = ["stm32f0/stm32f0x1", "device-selected"]
5858
stm32f038 = ["stm32f0/stm32f0x8", "device-selected"]
5959
stm32f042 = ["stm32f0/stm32f0x2", "device-selected"]
60+
stm32f048 = ["stm32f0/stm32f0x8", "device-selected"]
6061
stm32f051 = ["stm32f0/stm32f0x1", "device-selected"]
6162
stm32f070 = ["stm32f0/stm32f0x0", "device-selected"]
6263
stm32f070x6 = ["stm32f070"]

src/adc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl VRef {
356356
feature = "stm32f031",
357357
feature = "stm32f038",
358358
feature = "stm32f042",
359+
feature = "stm32f048",
359360
feature = "stm32f051",
360361
feature = "stm32f071",
361362
feature = "stm32f072",
@@ -369,6 +370,7 @@ pub struct VBat;
369370
feature = "stm32f031",
370371
feature = "stm32f038",
371372
feature = "stm32f042",
373+
feature = "stm32f048",
372374
feature = "stm32f051",
373375
feature = "stm32f071",
374376
feature = "stm32f072",
@@ -382,6 +384,7 @@ adc_pins!(
382384
feature = "stm32f031",
383385
feature = "stm32f038",
384386
feature = "stm32f042",
387+
feature = "stm32f048",
385388
feature = "stm32f051",
386389
feature = "stm32f071",
387390
feature = "stm32f072",

src/gpio.rs

Lines changed: 2 additions & 2 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(any(feature = "stm32f038", feature = "stm32f042"))]
564+
#[cfg(any(feature = "stm32f038", feature = "stm32f042", feature = "stm32f048"))]
565565
gpio!(GPIOC, gpioc, iopcen, PC, [
566566
PC13: (pc13, 13, Input<Floating>),
567567
PC14: (pc14, 14, Input<Floating>),
@@ -667,7 +667,7 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
667667
PF7: (pf7, 7, Input<Floating>),
668668
]);
669669

670-
#[cfg(feature = "stm32f042")]
670+
#[cfg(any(feature = "stm32f042", feature = "stm32f048"))]
671671
gpio!(GPIOF, gpiof, iopfen, PF, [
672672
PF0: (pf0, 0, Input<Floating>),
673673
PF1: (pf1, 1, Input<Floating>),

src/i2c.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ macro_rules! i2c_pins {
3838
feature = "stm32f031",
3939
feature = "stm32f038",
4040
feature = "stm32f042",
41+
feature = "stm32f048",
4142
feature = "stm32f051",
4243
feature = "stm32f070",
4344
feature = "stm32f071",
@@ -55,6 +56,7 @@ i2c_pins! {
5556
feature = "stm32f030xc",
5657
feature = "stm32f031",
5758
feature = "stm32f042",
59+
feature = "stm32f048",
5860
feature = "stm32f091",
5961
))]
6062
i2c_pins! {
@@ -63,7 +65,7 @@ i2c_pins! {
6365
sda => [gpioa::PA10<Alternate<AF4>>],
6466
}
6567
}
66-
#[cfg(any(feature = "stm32f030", feature = "stm32f042"))]
68+
#[cfg(any(feature = "stm32f030", feature = "stm32f042", feature = "stm32f048"))]
6769
i2c_pins! {
6870
I2C1 => {
6971
scl => [gpioa::PA11<Alternate<AF5>>],
@@ -74,6 +76,7 @@ i2c_pins! {
7476
feature = "stm32f031",
7577
feature = "stm32f038",
7678
feature = "stm32f042",
79+
feature = "stm32f048",
7780
feature = "stm32f030x6",
7881
))]
7982
i2c_pins! {
@@ -82,11 +85,18 @@ i2c_pins! {
8285
sda => [gpiob::PB11<Alternate<AF1>>],
8386
}
8487
}
88+
#[cfg(any(feature = "stm32f030xc", feature = "stm32f042", feature = "stm32f048"))]
89+
i2c_pins! {
90+
I2C1 => {
91+
scl => [gpiob::PB13<Alternate<AF5>>],
92+
sda => [gpiob::PB14<Alternate<AF5>>],
93+
}
94+
}
8595
#[cfg(any(feature = "stm32f042", feature = "stm32f030xc"))]
8696
i2c_pins! {
8797
I2C1 => {
88-
scl => [gpiob::PB13<Alternate<AF5>>, gpiof::PF1<Alternate<AF1>>],
89-
sda => [gpiob::PB14<Alternate<AF5>>, gpiof::PF0<Alternate<AF1>>],
98+
scl => [gpiof::PF1<Alternate<AF1>>],
99+
sda => [gpiof::PF0<Alternate<AF1>>],
90100
}
91101
}
92102
#[cfg(feature = "stm32f070x6")]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ 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")]
20+
#[cfg(any(feature = "stm32f038", feature = "stm32f048"))]
2121
pub use stm32f0::stm32f0x8 as stm32;
2222

2323
#[cfg(feature = "device-selected")]

src/serial.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ macro_rules! usart_pins {
117117
#[cfg(any(
118118
feature = "stm32f030",
119119
feature = "stm32f042",
120+
feature = "stm32f048",
120121
feature = "stm32f051",
121122
feature = "stm32f071",
122123
))]
@@ -151,6 +152,7 @@ usart_pins! {
151152
feature = "stm32f030x8",
152153
feature = "stm32f030xc",
153154
feature = "stm32f042",
155+
feature = "stm32f048",
154156
feature = "stm32f051",
155157
feature = "stm32f070",
156158
feature = "stm32f071",
@@ -366,6 +368,7 @@ usart! {
366368
feature = "stm32f030x8",
367369
feature = "stm32f030xc",
368370
feature = "stm32f042",
371+
feature = "stm32f048",
369372
feature = "stm32f051",
370373
feature = "stm32f070",
371374
feature = "stm32f071",

src/spi.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use crate::stm32::SPI1;
4949
#[cfg(any(
5050
feature = "stm32f030x8",
5151
feature = "stm32f030xc",
52+
feature = "stm32f048",
5253
feature = "stm32f051",
5354
feature = "stm32f070xb",
5455
feature = "stm32f071",
@@ -135,6 +136,7 @@ spi_pins! {
135136
#[cfg(any(
136137
feature = "stm32f030x8",
137138
feature = "stm32f030xc",
139+
feature = "stm32f048",
138140
feature = "stm32f051",
139141
feature = "stm32f070xb",
140142
feature = "stm32f071",
@@ -209,6 +211,7 @@ spi! {
209211
#[cfg(any(
210212
feature = "stm32f030x8",
211213
feature = "stm32f030xc",
214+
feature = "stm32f048",
212215
feature = "stm32f051",
213216
feature = "stm32f070xb",
214217
feature = "stm32f071",

src/timers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ timers! {
226226
feature = "stm32f031",
227227
feature = "stm32f038",
228228
feature = "stm32f042",
229+
feature = "stm32f048",
229230
feature = "stm32f051",
230231
feature = "stm32f071",
231232
feature = "stm32f072",

0 commit comments

Comments
 (0)