stm32: usart pin inversion

This commit is contained in:
lights0123 2023-12-10 18:39:45 -05:00
parent 343be37f39
commit dfba51d3f2
No known key found for this signature in database
GPG Key ID: 28F315322E37972F

View File

@ -132,6 +132,14 @@ pub struct Config {
/// Set this to true to swap the RX and TX pins.
#[cfg(any(usart_v3, usart_v4))]
pub swap_rx_tx: bool,
/// Set this to true to invert TX pin signal values (V<sub>DD</sub> =0/mark, Gnd = 1/idle).
#[cfg(any(usart_v3, usart_v4))]
pub invert_tx: bool,
/// Set this to true to invert RX pin signal values (V<sub>DD</sub> =0/mark, Gnd = 1/idle).
#[cfg(any(usart_v3, usart_v4))]
pub invert_rx: bool,
}
impl Default for Config {
@ -147,6 +155,10 @@ impl Default for Config {
assume_noise_free: false,
#[cfg(any(usart_v3, usart_v4))]
swap_rx_tx: false,
#[cfg(any(usart_v3, usart_v4))]
invert_tx: false,
#[cfg(any(usart_v3, usart_v4))]
invert_rx: false,
}
}
}
@ -972,7 +984,11 @@ fn configure(
});
#[cfg(any(usart_v3, usart_v4))]
w.set_swap(config.swap_rx_tx);
{
w.set_txinv(config.invert_tx);
w.set_rxinv(config.invert_rx);
w.set_swap(config.swap_rx_tx);
}
});
#[cfg(not(usart_v1))]