Skip to content

Commit 982b503

Browse files
committed
Re-implement Serial for STM32F070 devices following merge
1 parent 8c48095 commit 982b503

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/serial.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,26 @@ usart_pins! {
9494
rx => [gpioa::PA3<Alternate<AF1>>, gpioa::PA15<Alternate<AF1>>],
9595
}
9696
}
97+
#[cfg(feature = "stm32f070")]
98+
usart_pins! {
99+
USART1 => {
100+
tx => [gpioa::PA9<Alternate<AF1>>, gpiob::PB6<Alternate<AF0>>],
101+
rx => [gpioa::PA10<Alternate<AF1>>, gpiob::PB7<Alternate<AF0>>],
102+
}
103+
}
97104
#[cfg(any(
98105
feature = "stm32f042",
99106
feature = "stm32f030x8",
100107
feature = "stm32f030xc",
108+
feature = "stm32f070",
101109
))]
102110
usart_pins! {
103111
USART2 => {
104112
tx => [gpioa::PA2<Alternate<AF1>>, gpioa::PA14<Alternate<AF1>>],
105113
rx => [gpioa::PA3<Alternate<AF1>>, gpioa::PA15<Alternate<AF1>>],
106114
}
107115
}
108-
#[cfg(feature = "stm32f030xc")]
116+
#[cfg(any(feature = "stm32f030xc", feature = "stm32f070xb"))]
109117
usart_pins! {
110118
USART3 => {
111119
// According to the datasheet PB10 is both tx and rx, but in stm32cubemx it's only tx
@@ -116,6 +124,9 @@ usart_pins! {
116124
tx => [gpioa::PA0<Alternate<AF4>>, gpioc::PC10<Alternate<AF0>>],
117125
rx => [gpioa::PA1<Alternate<AF4>>, gpioc::PC11<Alternate<AF0>>],
118126
}
127+
}
128+
#[cfg(feature = "stm32f030xc")]
129+
usart_pins! {
119130
USART5 => {
120131
tx => [gpiob::PB3<Alternate<AF4>>, gpioc::PC12<Alternate<AF2>>],
121132
rx => [gpiob::PB4<Alternate<AF4>>, gpiod::PD2<Alternate<AF2>>],
@@ -179,22 +190,26 @@ macro_rules! usart {
179190
}
180191
}
181192

182-
#[cfg(any(feature = "stm32f042", feature = "stm32f030"))]
193+
#[cfg(any(feature = "stm32f042", feature = "stm32f030", feature = "stm32f070"))]
183194
usart! {
184195
USART1: (usart1, usart1en, apb2enr),
185196
}
186197
#[cfg(any(
187198
feature = "stm32f042",
188199
feature = "stm32f030x8",
189-
feature = "stm32f030xc"
200+
feature = "stm32f030xc",
201+
feature = "stm32f070",
190202
))]
191203
usart! {
192204
USART2: (usart2, usart2en, apb1enr),
193205
}
194-
#[cfg(any(feature = "stm32f030xc"))]
206+
#[cfg(any(feature = "stm32f030xc", feature = "stm32f070xb"))]
195207
usart! {
196208
USART3: (usart3, usart3en, apb1enr),
197209
USART4: (usart4, usart4en, apb1enr),
210+
}
211+
#[cfg(feature = "stm32f030xc")]
212+
usart! {
198213
USART5: (usart5, usart5en, apb1enr),
199214
USART6: (usart6, usart6en, apb2enr),
200215
}

0 commit comments

Comments
 (0)