Skip to content

Commit e37de5a

Browse files
vadzimdambrouskimvertescher
authored andcommitted
Add uart 4 and 7.
1 parent 40434b5 commit e37de5a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/serial.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ use crate::time::U32Ext;
1515
use nb::block;
1616

1717
#[cfg(any(feature = "stm32f745", feature = "stm32f746",))]
18-
use crate::device::{RCC, USART1, USART2, USART3, USART6};
18+
use crate::device::{RCC, USART1, USART2, UART4, USART3, USART6, UART7};
1919

2020
#[cfg(any(feature = "stm32f745", feature = "stm32f746",))]
2121
use crate::gpio::{
22-
gpioa::{PA10, PA2, PA3, PA9},
22+
gpioa::{PA0, PA1, PA10, PA2, PA3, PA9},
2323
gpiob::{PB10, PB11, PB6, PB7},
2424
gpioc::{PC10, PC11, PC6, PC7},
2525
gpiod::{PD5, PD6, PD8, PD9},
2626
gpiog::{PG14, PG9},
27+
gpioe::{PE7, PE8},
28+
gpiof::{PF6, PF7},
2729
Alternate, AF7, AF8,
2830
};
2931

@@ -64,8 +66,12 @@ impl PinTx<USART2> for PD5<Alternate<AF7>> {}
6466
impl PinTx<USART3> for PB10<Alternate<AF7>> {}
6567
impl PinTx<USART3> for PC10<Alternate<AF7>> {}
6668
impl PinTx<USART3> for PD8<Alternate<AF7>> {}
69+
impl PinTx<UART4> for PA0<Alternate<AF8>> {}
70+
impl PinTx<UART4> for PC10<Alternate<AF8>> {}
6771
impl PinTx<USART6> for PC6<Alternate<AF8>> {}
6872
impl PinTx<USART6> for PG14<Alternate<AF8>> {}
73+
impl PinTx<UART7> for PE8<Alternate<AF8>> {}
74+
impl PinTx<UART7> for PF7<Alternate<AF8>> {}
6975

7076
#[cfg(any(feature = "stm32f745", feature = "stm32f746",))]
7177
impl PinRx<USART1> for PA10<Alternate<AF7>> {}
@@ -75,8 +81,12 @@ impl PinRx<USART2> for PD6<Alternate<AF7>> {}
7581
impl PinRx<USART3> for PB11<Alternate<AF7>> {}
7682
impl PinRx<USART3> for PC11<Alternate<AF7>> {}
7783
impl PinRx<USART3> for PD9<Alternate<AF7>> {}
84+
impl PinRx<UART4> for PA1<Alternate<AF8>> {}
85+
impl PinRx<UART4> for PC11<Alternate<AF8>> {}
7886
impl PinRx<USART6> for PC7<Alternate<AF8>> {}
7987
impl PinRx<USART6> for PG9<Alternate<AF8>> {}
88+
impl PinRx<UART7> for PE7<Alternate<AF8>> {}
89+
impl PinRx<UART7> for PF6<Alternate<AF8>> {}
8090

8191
/// Serial abstraction
8292
pub struct Serial<USART, PINS> {
@@ -425,7 +435,9 @@ impl_instance! {
425435
USART1: (apb2enr, usart1sel, usart1en),
426436
USART2: (apb1enr, usart2sel, usart2en),
427437
USART3: (apb1enr, usart3sel, usart3en),
438+
UART4: (apb1enr, uart4sel, uart4en),
428439
USART6: (apb2enr, usart6sel, usart6en),
440+
UART7: (apb1enr, uart7sel, uart7en),
429441
}
430442

431443
impl<USART> fmt::Write for Tx<USART>

0 commit comments

Comments
 (0)