Skip to content

Commit fca4716

Browse files
committed
Add support for stm32f078
1 parent c79c69c commit fca4716

File tree

8 files changed

+70
-9
lines changed

8 files changed

+70
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ stm32f070x6 = ["stm32f070"]
6565
stm32f070xb = ["stm32f070"]
6666
stm32f071 = ["stm32f0/stm32f0x1", "device-selected"]
6767
stm32f072 = ["stm32f0/stm32f0x2", "device-selected"]
68+
stm32f078 = ["stm32f0/stm32f0x8", "device-selected"]
6869
stm32f091 = ["stm32f0/stm32f0x1", "device-selected"]
6970

7071
[profile.dev]

src/adc.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ adc_pins!(
211211
feature = "stm32f070",
212212
feature = "stm32f071",
213213
feature = "stm32f072",
214-
feature = "stm32f091"
214+
feature = "stm32f078",
215+
feature = "stm32f091",
215216
))]
216217
adc_pins!(
217218
gpioc::PC0<Analog> => 10_u8,
@@ -362,6 +363,7 @@ impl VRef {
362363
feature = "stm32f058",
363364
feature = "stm32f071",
364365
feature = "stm32f072",
366+
feature = "stm32f078",
365367
feature = "stm32f091",
366368
))]
367369
#[derive(Debug, Default)]
@@ -377,6 +379,7 @@ pub struct VBat;
377379
feature = "stm32f058",
378380
feature = "stm32f071",
379381
feature = "stm32f072",
382+
feature = "stm32f078",
380383
feature = "stm32f091",
381384
))]
382385
adc_pins!(
@@ -392,6 +395,7 @@ adc_pins!(
392395
feature = "stm32f058",
393396
feature = "stm32f071",
394397
feature = "stm32f072",
398+
feature = "stm32f078",
395399
feature = "stm32f091",
396400
))]
397401
impl VBat {

src/gpio.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
574574
feature = "stm32f070",
575575
feature = "stm32f071",
576576
feature = "stm32f072",
577+
feature = "stm32f078",
577578
feature = "stm32f091",
578579
))]
579580
gpio!(GPIOC, gpioc, iopcen, PC, [
@@ -604,7 +605,12 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
604605
gpio!(GPIOD, gpiod, iopden, PD, [
605606
PD2: (pd2, 2, Input<Floating>),
606607
]);
607-
#[cfg(any(feature = "stm32f071", feature = "stm32f072", feature = "stm32f091"))]
608+
#[cfg(any(
609+
feature = "stm32f071",
610+
feature = "stm32f072",
611+
feature = "stm32f078",
612+
feature = "stm32f091"
613+
))]
608614
gpio!(GPIOD, gpiod, iopden, PD, [
609615
PD0: (pd0, 0, Input<Floating>),
610616
PD1: (pd1, 1, Input<Floating>),
@@ -627,7 +633,12 @@ gpio!(GPIOD, gpiod, iopden, PD, [
627633
// TODO: The ST SVD files are missing the entire PE enable register.
628634
// Re-enable as soon as this gets fixed.
629635

630-
// #[cfg(any(feature = "stm32f071", feature = "stm32f072", feature = "stm32f091"))]
636+
// #[cfg(any(
637+
// feature = "stm32f071",
638+
// feature = "stm32f072",
639+
// feature = "stm32f078",
640+
// feature = "stm32f091",
641+
// ))]
631642
// gpio!(GPIOE, gpioe, iopeen, PE, [
632643
// PE0: (pe0, 0, Input<Floating>),
633644
// PE1: (pe1, 1, Input<Floating>),
@@ -684,7 +695,12 @@ gpio!(GPIOF, gpiof, iopfen, PF, [
684695
PF1: (pf1, 1, Input<Floating>),
685696
]);
686697

687-
#[cfg(any(feature = "stm32f071", feature = "stm32f072", feature = "stm32f091"))]
698+
#[cfg(any(
699+
feature = "stm32f071",
700+
feature = "stm32f072",
701+
feature = "stm32f078",
702+
feature = "stm32f091",
703+
))]
688704
gpio!(GPIOF, gpiof, iopfen, PF, [
689705
PF0: (pf0, 0, Input<Floating>),
690706
PF1: (pf1, 1, Input<Floating>),

src/i2c.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ macro_rules! i2c_pins {
4444
feature = "stm32f070",
4545
feature = "stm32f071",
4646
feature = "stm32f072",
47+
feature = "stm32f078",
4748
feature = "stm32f091",
4849
))]
4950
i2c_pins! {
@@ -127,6 +128,7 @@ i2c_pins! {
127128
feature = "stm32f070xb",
128129
feature = "stm32f071",
129130
feature = "stm32f072",
131+
feature = "stm32f078",
130132
feature = "stm32f091",
131133
))]
132134
i2c_pins! {
@@ -183,6 +185,7 @@ i2c! {
183185
feature = "stm32f070xb",
184186
feature = "stm32f071",
185187
feature = "stm32f072",
188+
feature = "stm32f078",
186189
feature = "stm32f091",
187190
))]
188191
i2c! {

src/lib.rs

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

20-
#[cfg(any(feature = "stm32f038", feature = "stm32f048", feature = "stm32f058"))]
20+
#[cfg(any(
21+
feature = "stm32f038",
22+
feature = "stm32f048",
23+
feature = "stm32f058",
24+
feature = "stm32f078"
25+
))]
2126
pub use stm32f0::stm32f0x8 as stm32;
2227

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

src/serial.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ macro_rules! usart_pins {
121121
feature = "stm32f051",
122122
feature = "stm32f058",
123123
feature = "stm32f071",
124+
feature = "stm32f078",
124125
))]
125126
usart_pins! {
126127
USART1 => {
@@ -159,6 +160,7 @@ usart_pins! {
159160
feature = "stm32f070",
160161
feature = "stm32f071",
161162
feature = "stm32f072",
163+
feature = "stm32f078",
162164
feature = "stm32f091",
163165
))]
164166
usart_pins! {
@@ -167,7 +169,12 @@ usart_pins! {
167169
rx => [gpioa::PA3<Alternate<AF1>>, gpioa::PA15<Alternate<AF1>>],
168170
}
169171
}
170-
#[cfg(any(feature = "stm32f072", feature = "stm32f071", feature = "stm32f091"))]
172+
#[cfg(any(
173+
feature = "stm32f072",
174+
feature = "stm32f071",
175+
feature = "stm32f078",
176+
feature = "stm32f091"
177+
))]
171178
usart_pins! {
172179
USART2 => {
173180
tx => [gpiod::PD5<Alternate<AF0>>],
@@ -180,6 +187,7 @@ usart_pins! {
180187
feature = "stm32f070xb",
181188
feature = "stm32f071",
182189
feature = "stm32f072",
190+
feature = "stm32f078",
183191
feature = "stm32f091",
184192
))]
185193
usart_pins! {
@@ -193,7 +201,12 @@ usart_pins! {
193201
rx => [gpioa::PA1<Alternate<AF4>>, gpioc::PC11<Alternate<AF0>>],
194202
}
195203
}
196-
#[cfg(any(feature = "stm32f071", feature = "stm32f072", feature = "stm32f091"))]
204+
#[cfg(any(
205+
feature = "stm32f071",
206+
feature = "stm32f072",
207+
feature = "stm32f078",
208+
feature = "stm32f091",
209+
))]
197210
usart_pins! {
198211
USART3 => {
199212
tx => [gpiod::PD8<Alternate<AF0>>],
@@ -376,6 +389,7 @@ usart! {
376389
feature = "stm32f070",
377390
feature = "stm32f071",
378391
feature = "stm32f072",
392+
feature = "stm32f078",
379393
feature = "stm32f091",
380394
))]
381395
usart! {
@@ -386,6 +400,7 @@ usart! {
386400
feature = "stm32f070xb",
387401
feature = "stm32f071",
388402
feature = "stm32f072",
403+
feature = "stm32f078",
389404
feature = "stm32f091",
390405
))]
391406
usart! {

src/spi.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ use crate::stm32::SPI1;
5454
feature = "stm32f058",
5555
feature = "stm32f070xb",
5656
feature = "stm32f071",
57+
feature = "stm32f078",
5758
feature = "stm32f091",
5859
))]
5960
use crate::stm32::SPI2;
@@ -125,7 +126,12 @@ spi_pins! {
125126
// TODO: The ST SVD files are missing the entire PE enable register.
126127
// So those pins do not exist in the register definitions.
127128
// Re-enable as soon as this gets fixed.
128-
// #[cfg(any(feature = "stm32f071", feature = "stm32f072", feature = "stm32f091"))]
129+
// #[cfg(any(
130+
// feature = "stm32f071",
131+
// feature = "stm32f072",
132+
// feature = "stm32f078",
133+
// feature = "stm32f091"
134+
// ))]
129135
// spi_pins! {
130136
// SPI1 => {
131137
// sck => [gpioe::PE13<Alternate<AF1>>],
@@ -143,6 +149,7 @@ spi_pins! {
143149
feature = "stm32f070xb",
144150
feature = "stm32f071",
145151
feature = "stm32f072",
152+
feature = "stm32f078",
146153
feature = "stm32f091",
147154
))]
148155
spi_pins! {
@@ -157,6 +164,7 @@ spi_pins! {
157164
feature = "stm32f070xb",
158165
feature = "stm32f071",
159166
feature = "stm32f072",
167+
feature = "stm32f078",
160168
feature = "stm32f091",
161169
))]
162170
spi_pins! {
@@ -166,7 +174,12 @@ spi_pins! {
166174
mosi => [gpioc::PC3<Alternate<AF1>>],
167175
}
168176
}
169-
#[cfg(any(feature = "stm32f071", feature = "stm32f072", feature = "stm32f091"))]
177+
#[cfg(any(
178+
feature = "stm32f071",
179+
feature = "stm32f072",
180+
feature = "stm32f078",
181+
feature = "stm32f091",
182+
))]
170183
spi_pins! {
171184
SPI2 => {
172185
sck => [gpiod::PD1<Alternate<AF1>>],
@@ -218,6 +231,7 @@ spi! {
218231
feature = "stm32f058",
219232
feature = "stm32f070xb",
220233
feature = "stm32f071",
234+
feature = "stm32f078",
221235
feature = "stm32f091",
222236
))]
223237
spi! {

src/timers.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ timers! {
231231
feature = "stm32f058",
232232
feature = "stm32f071",
233233
feature = "stm32f072",
234+
feature = "stm32f078",
234235
feature = "stm32f091",
235236
))]
236237
timers! {
@@ -245,6 +246,7 @@ timers! {
245246
feature = "stm32f070xb",
246247
feature = "stm32f071",
247248
feature = "stm32f072",
249+
feature = "stm32f078",
248250
feature = "stm32f091",
249251
))]
250252
timers! {
@@ -256,6 +258,7 @@ timers! {
256258
feature = "stm32f030xc",
257259
feature = "stm32f070xb",
258260
feature = "stm32f072",
261+
feature = "stm32f078",
259262
feature = "stm32f091",
260263
))]
261264
timers! {

0 commit comments

Comments
 (0)