diff options
| author | Felipe Balbi <[email protected]> | 2025-11-07 10:06:55 -0800 |
|---|---|---|
| committer | Felipe Balbi <[email protected]> | 2025-11-07 10:06:55 -0800 |
| commit | cb2ac2790f4b037056f9571abeb4d62360199426 (patch) | |
| tree | f9f163e4340d11ddc54c24ab8cf7624e83f1fd18 /src/uart.rs | |
| parent | a71eff2e1cea55b393e793c023b8e51e5cc369a1 (diff) | |
Reduce number of features
We don't need features for drivers that always exist.
Signed-off-by: Felipe Balbi <[email protected]>
Diffstat (limited to 'src/uart.rs')
| -rw-r--r-- | src/uart.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/uart.rs b/src/uart.rs index 45b6b2be3..65dd91492 100644 --- a/src/uart.rs +++ b/src/uart.rs | |||
| @@ -15,9 +15,7 @@ pub trait Instance { | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | /// Token for LPUART2 provided by embassy-hal-internal peripherals macro. | 17 | /// Token for LPUART2 provided by embassy-hal-internal peripherals macro. |
| 18 | #[cfg(feature = "lpuart2")] | ||
| 19 | pub type Lpuart2 = crate::peripherals::LPUART2; | 18 | pub type Lpuart2 = crate::peripherals::LPUART2; |
| 20 | #[cfg(feature = "lpuart2")] | ||
| 21 | impl Instance for crate::peripherals::LPUART2 { | 19 | impl Instance for crate::peripherals::LPUART2 { |
| 22 | #[inline(always)] | 20 | #[inline(always)] |
| 23 | fn ptr() -> *const Regs { | 21 | fn ptr() -> *const Regs { |
| @@ -26,7 +24,6 @@ impl Instance for crate::peripherals::LPUART2 { | |||
| 26 | } | 24 | } |
| 27 | 25 | ||
| 28 | // Also implement Instance for the Peri wrapper type | 26 | // Also implement Instance for the Peri wrapper type |
| 29 | #[cfg(feature = "lpuart2")] | ||
| 30 | impl Instance for embassy_hal_internal::Peri<'_, crate::peripherals::LPUART2> { | 27 | impl Instance for embassy_hal_internal::Peri<'_, crate::peripherals::LPUART2> { |
| 31 | #[inline(always)] | 28 | #[inline(always)] |
| 32 | fn ptr() -> *const Regs { | 29 | fn ptr() -> *const Regs { |
| @@ -111,7 +108,7 @@ impl<I: Instance> Uart<I> { | |||
| 111 | cortex_m::asm::delay(3); // Short delay for reset to take effect | 108 | cortex_m::asm::delay(3); // Short delay for reset to take effect |
| 112 | l.global().write(|w| w.rst().no_effect()); | 109 | l.global().write(|w| w.rst().no_effect()); |
| 113 | cortex_m::asm::delay(10); // Allow peripheral to stabilize after reset | 110 | cortex_m::asm::delay(10); // Allow peripheral to stabilize after reset |
| 114 | // 2) BAUD | 111 | // 2) BAUD |
| 115 | let (osr, sbr) = compute_osr_sbr(cfg.src_hz, cfg.baud); | 112 | let (osr, sbr) = compute_osr_sbr(cfg.src_hz, cfg.baud); |
| 116 | l.baud().modify(|_, w| { | 113 | l.baud().modify(|_, w| { |
| 117 | let w = match cfg.stop_bits { | 114 | let w = match cfg.stop_bits { |
| @@ -145,7 +142,9 @@ impl<I: Instance> Uart<I> { | |||
| 145 | }); | 142 | }); |
| 146 | l.water() | 143 | l.water() |
| 147 | .modify(|_, w| unsafe { w.txwater().bits(0).rxwater().bits(0) }); | 144 | .modify(|_, w| unsafe { w.txwater().bits(0).rxwater().bits(0) }); |
| 148 | Self { _inst: core::marker::PhantomData } | 145 | Self { |
| 146 | _inst: core::marker::PhantomData, | ||
| 147 | } | ||
| 149 | } | 148 | } |
| 150 | 149 | ||
| 151 | /// Enable RX interrupts. The caller must ensure an appropriate IRQ handler is installed. | 150 | /// Enable RX interrupts. The caller must ensure an appropriate IRQ handler is installed. |
