Skip to content

Commit 253ecd3

Browse files
IGBCTheZoq2
authored andcommitted
Fixed Serial Remapping (#149)
1 parent b0b696c commit 253ecd3

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/serial.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ use crate::afio::MAPR;
4949
use crate::dma::{dma1, CircBuffer, Static, Transfer, R, W, RxDma, TxDma};
5050
use crate::gpio::gpioa::{PA10, PA2, PA3, PA9};
5151
use crate::gpio::gpiob::{PB10, PB11, PB6, PB7};
52+
use crate::gpio::gpioc::{PC10, PC11};
53+
use crate::gpio::gpiod::{PD5, PD6, PD8, PD9};
5254
use crate::gpio::{Alternate, Floating, Input, PushPull};
5355
use crate::rcc::{RccBus, Clocks, Enable, Reset};
5456
use crate::time::{U32Ext, Bps};
@@ -76,6 +78,9 @@ pub enum Error {
7678
_Extensible,
7779
}
7880

81+
82+
// USART REMAPPING, see: https://www.st.com/content/ccc/resource/technical/document/reference_manual/59/b9/ba/7f/11/af/43/d5/CD00171190.pdf/files/CD00171190.pdf/jcr:content/translations/en.CD00171190.pdf
83+
// Section 9.3.8
7984
pub trait Pins<USART> {
8085
const REMAP: u8;
8186
}
@@ -92,21 +97,21 @@ impl Pins<USART2> for (PA2<Alternate<PushPull>>, PA3<Input<Floating>>) {
9297
const REMAP: u8 = 0;
9398
}
9499

95-
// impl Pins<USART2> for (PD5<Alternate<PushPull>>, PD6<Input<Floating>>) {
96-
// const REMAP: u8 = 0;
97-
// }
100+
impl Pins<USART2> for (PD5<Alternate<PushPull>>, PD6<Input<Floating>>) {
101+
const REMAP: u8 = 0;
102+
}
98103

99104
impl Pins<USART3> for (PB10<Alternate<PushPull>>, PB11<Input<Floating>>) {
100105
const REMAP: u8 = 0;
101106
}
102107

103-
// impl Pins<USART3> for (PC10<Alternate<PushPull>>, PC11<Input<Floating>>) {
104-
// const REMAP: u8 = 1;
105-
// }
108+
impl Pins<USART3> for (PC10<Alternate<PushPull>>, PC11<Input<Floating>>) {
109+
const REMAP: u8 = 1;
110+
}
106111

107-
// impl Pins<USART3> for (PD8<Alternate<PushPull>>, PD9<Input<Floating>>) {
108-
// const REMAP: u8 = 0b11;
109-
// }
112+
impl Pins<USART3> for (PD8<Alternate<PushPull>>, PD9<Input<Floating>>) {
113+
const REMAP: u8 = 0b11;
114+
}
110115

111116
pub enum Parity {
112117
ParityNone,

0 commit comments

Comments
 (0)