mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Add trace logging for USART
This commit is contained in:
parent
4d4cbc0dd3
commit
02bb85a791
@ -1270,8 +1270,14 @@ fn configure(
|
|||||||
|
|
||||||
let (mul, brr_min, brr_max) = match kind {
|
let (mul, brr_min, brr_max) = match kind {
|
||||||
#[cfg(any(usart_v3, usart_v4))]
|
#[cfg(any(usart_v3, usart_v4))]
|
||||||
Kind::Lpuart => (256, 0x300, 0x10_0000),
|
Kind::Lpuart => {
|
||||||
Kind::Uart => (1, 0x10, 0x1_0000),
|
trace!("USART: Kind::Lpuart");
|
||||||
|
(256, 0x300, 0x10_0000)
|
||||||
|
}
|
||||||
|
Kind::Uart => {
|
||||||
|
trace!("USART: Kind::Uart");
|
||||||
|
(1, 0x10, 0x1_0000)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
fn calculate_brr(baud: u32, pclk: u32, presc: u32, mul: u32) -> u32 {
|
fn calculate_brr(baud: u32, pclk: u32, presc: u32, mul: u32) -> u32 {
|
||||||
@ -1374,21 +1380,35 @@ fn configure(
|
|||||||
// configure word size
|
// configure word size
|
||||||
// if using odd or even parity it must be configured to 9bits
|
// if using odd or even parity it must be configured to 9bits
|
||||||
w.set_m0(if config.parity != Parity::ParityNone {
|
w.set_m0(if config.parity != Parity::ParityNone {
|
||||||
|
trace!("USART: m0: vals::M0::BIT9");
|
||||||
vals::M0::BIT9
|
vals::M0::BIT9
|
||||||
} else {
|
} else {
|
||||||
|
trace!("USART: m0: vals::M0::BIT8");
|
||||||
vals::M0::BIT8
|
vals::M0::BIT8
|
||||||
});
|
});
|
||||||
// configure parity
|
// configure parity
|
||||||
w.set_pce(config.parity != Parity::ParityNone);
|
w.set_pce(config.parity != Parity::ParityNone);
|
||||||
w.set_ps(match config.parity {
|
w.set_ps(match config.parity {
|
||||||
Parity::ParityOdd => vals::Ps::ODD,
|
Parity::ParityOdd => {
|
||||||
Parity::ParityEven => vals::Ps::EVEN,
|
trace!("USART: set_ps: vals::Ps::ODD");
|
||||||
_ => vals::Ps::EVEN,
|
vals::Ps::ODD
|
||||||
|
}
|
||||||
|
Parity::ParityEven => {
|
||||||
|
trace!("USART: set_ps: vals::Ps::EVEN");
|
||||||
|
vals::Ps::EVEN
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
|
trace!("USART: set_ps: vals::Ps::EVEN");
|
||||||
|
vals::Ps::EVEN
|
||||||
|
}
|
||||||
});
|
});
|
||||||
#[cfg(not(usart_v1))]
|
#[cfg(not(usart_v1))]
|
||||||
w.set_over8(vals::Over8::from_bits(over8 as _));
|
w.set_over8(vals::Over8::from_bits(over8 as _));
|
||||||
#[cfg(usart_v4)]
|
#[cfg(usart_v4)]
|
||||||
|
{
|
||||||
|
trace!("USART: set_fifoen: true (usart_v4)");
|
||||||
w.set_fifoen(true);
|
w.set_fifoen(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user