diff options
Diffstat (limited to 'src/uart.rs')
| -rw-r--r-- | src/uart.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/uart.rs b/src/uart.rs index 3209a318d..3705959d3 100644 --- a/src/uart.rs +++ b/src/uart.rs | |||
| @@ -1,6 +1,10 @@ | |||
| 1 | //! Minimal polling UART2 bring-up replicating MCUXpresso hello_world ordering. | 1 | //! Minimal polling UART2 bring-up replicating MCUXpresso hello_world ordering. |
| 2 | //! WARNING: This is a narrow implementation only for debug console (115200 8N1). | 2 | //! WARNING: This is a narrow implementation only for debug console (115200 8N1). |
| 3 | 3 | ||
| 4 | // TODO(AJM): As of 2025-11-13, we need to do a pass to ensure safety docs | ||
| 5 | // are complete prior to release. | ||
| 6 | #![allow(clippy::missing_safety_doc)] | ||
| 7 | |||
| 4 | use core::cell::RefCell; | 8 | use core::cell::RefCell; |
| 5 | 9 | ||
| 6 | use cortex_m::interrupt::Mutex; | 10 | use cortex_m::interrupt::Mutex; |
| @@ -118,7 +122,7 @@ impl<I: Instance> Uart<I> { | |||
| 118 | StopBits::Two => w.sbns().two(), | 122 | StopBits::Two => w.sbns().two(), |
| 119 | }; | 123 | }; |
| 120 | // OSR field encodes (osr-1); use raw bits to avoid a long match on all variants | 124 | // OSR field encodes (osr-1); use raw bits to avoid a long match on all variants |
| 121 | let raw_osr = osr.saturating_sub(1) as u8; | 125 | let raw_osr = osr.saturating_sub(1); |
| 122 | unsafe { w.osr().bits(raw_osr).sbr().bits(sbr) } | 126 | unsafe { w.osr().bits(raw_osr).sbr().bits(sbr) } |
| 123 | }); | 127 | }); |
| 124 | // 3) CTRL baseline and parity | 128 | // 3) CTRL baseline and parity |
| @@ -195,6 +199,12 @@ pub struct RingBuffer { | |||
| 195 | count: usize, | 199 | count: usize, |
| 196 | } | 200 | } |
| 197 | 201 | ||
| 202 | impl Default for RingBuffer { | ||
| 203 | fn default() -> Self { | ||
| 204 | Self::new() | ||
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 198 | impl RingBuffer { | 208 | impl RingBuffer { |
| 199 | pub const fn new() -> Self { | 209 | pub const fn new() -> Self { |
| 200 | Self { | 210 | Self { |
