diff options
| author | James Munns <[email protected]> | 2025-11-13 18:02:24 +0100 |
|---|---|---|
| committer | James Munns <[email protected]> | 2025-11-13 18:03:11 +0100 |
| commit | 306e55819656eeb41c69f2d5625c46419f0534c4 (patch) | |
| tree | b393b5104ae092ba5832543c028b190112397d03 /src | |
| parent | 357a538e8d5f69c8c0aeacfd416f1ad99b0907d3 (diff) | |
Manually fix clippy lints
Diffstat (limited to 'src')
| -rw-r--r-- | src/interrupt.rs | 4 | ||||
| -rw-r--r-- | src/lib.rs | 3 | ||||
| -rw-r--r-- | src/lpuart/buffered.rs | 1 | ||||
| -rw-r--r-- | src/lpuart/mod.rs | 5 | ||||
| -rw-r--r-- | src/rtc.rs | 25 | ||||
| -rw-r--r-- | src/uart.rs | 4 |
6 files changed, 33 insertions, 9 deletions
diff --git a/src/interrupt.rs b/src/interrupt.rs index 09d7acbef..134ff03fd 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs | |||
| @@ -2,6 +2,10 @@ | |||
| 2 | //! Type-level interrupt traits and bindings are provided by the | 2 | //! Type-level interrupt traits and bindings are provided by the |
| 3 | //! `embassy_hal_internal::interrupt_mod!` macro via the generated module below. | 3 | //! `embassy_hal_internal::interrupt_mod!` macro via the generated module below. |
| 4 | 4 | ||
| 5 | // TODO(AJM): As of 2025-11-13, we need to do a pass to ensure safety docs | ||
| 6 | // are complete prior to release. | ||
| 7 | #![allow(clippy::missing_safety_doc)] | ||
| 8 | |||
| 5 | mod generated { | 9 | mod generated { |
| 6 | embassy_hal_internal::interrupt_mod!(OS_EVENT, LPUART2, RTC, ADC1); | 10 | embassy_hal_internal::interrupt_mod!(OS_EVENT, LPUART2, RTC, ADC1); |
| 7 | } | 11 | } |
diff --git a/src/lib.rs b/src/lib.rs index fe27aadba..9899564d8 100644 --- a/src/lib.rs +++ b/src/lib.rs | |||
| @@ -1,4 +1,7 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | // TODO(AJM): As of 2025-11-13, we need to do a pass to ensure safety docs | ||
| 3 | // are complete prior to release. | ||
| 4 | #![allow(clippy::missing_safety_doc)] | ||
| 2 | 5 | ||
| 3 | pub mod clocks; // still provide clock helpers | 6 | pub mod clocks; // still provide clock helpers |
| 4 | pub mod gpio; | 7 | pub mod gpio; |
diff --git a/src/lpuart/buffered.rs b/src/lpuart/buffered.rs index 21b86ada9..a617c10a5 100644 --- a/src/lpuart/buffered.rs +++ b/src/lpuart/buffered.rs | |||
| @@ -110,6 +110,7 @@ impl<'a> BufferedLpuart<'a> { | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | /// Create a new buffered LPUART with flexible pin configuration | 112 | /// Create a new buffered LPUART with flexible pin configuration |
| 113 | #[allow(clippy::too_many_arguments)] | ||
| 113 | pub fn new_with_pins<T: Instance>( | 114 | pub fn new_with_pins<T: Instance>( |
| 114 | _inner: Peri<'a, T>, | 115 | _inner: Peri<'a, T>, |
| 115 | tx_pin: Option<Peri<'a, impl TxPin<T>>>, | 116 | tx_pin: Option<Peri<'a, impl TxPin<T>>>, |
diff --git a/src/lpuart/mod.rs b/src/lpuart/mod.rs index 854136144..35b531421 100644 --- a/src/lpuart/mod.rs +++ b/src/lpuart/mod.rs | |||
| @@ -106,7 +106,8 @@ mod gpio { | |||
| 106 | impl GpioPin for super::lib::peripherals::$pin {} | 106 | impl GpioPin for super::lib::peripherals::$pin {} |
| 107 | 107 | ||
| 108 | impl From<super::lib::peripherals::$pin> for AnyPin { | 108 | impl From<super::lib::peripherals::$pin> for AnyPin { |
| 109 | fn from(val: super::lib::peripherals::$pin) -> Self { | 109 | // TODO: AJM: any reason we aren't using $pin? |
| 110 | fn from(_val: super::lib::peripherals::$pin) -> Self { | ||
| 110 | AnyPin | 111 | AnyPin |
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| @@ -242,7 +243,7 @@ pub fn configure_baudrate(regs: Regs, baudrate_bps: u32, clock: Clock) -> Result | |||
| 242 | // Configure BAUD register | 243 | // Configure BAUD register |
| 243 | regs.baud().modify(|_, w| unsafe { | 244 | regs.baud().modify(|_, w| unsafe { |
| 244 | // Clear and set OSR | 245 | // Clear and set OSR |
| 245 | w.osr().bits((osr - 1)); | 246 | w.osr().bits(osr - 1); |
| 246 | // Clear and set SBR | 247 | // Clear and set SBR |
| 247 | w.sbr().bits(sbr); | 248 | w.sbr().bits(sbr); |
| 248 | // Set BOTHEDGE if OSR is between 4 and 7 | 249 | // Set BOTHEDGE if OSR is between 4 and 7 |
diff --git a/src/rtc.rs b/src/rtc.rs index afd46610e..facb9cf8c 100644 --- a/src/rtc.rs +++ b/src/rtc.rs | |||
| @@ -109,18 +109,29 @@ pub fn convert_seconds_to_datetime(seconds: u32) -> RtcDateTime { | |||
| 109 | }; | 109 | }; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | let mut days_per_month = [0u8, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | 112 | let days_per_month = [ |
| 113 | if year.is_multiple_of(4) { | 113 | 31, |
| 114 | days_per_month[2] = 29; | 114 | if year.is_multiple_of(4) { 29 } else { 28 }, |
| 115 | } | 115 | 31, |
| 116 | 30, | ||
| 117 | 31, | ||
| 118 | 30, | ||
| 119 | 31, | ||
| 120 | 31, | ||
| 121 | 30, | ||
| 122 | 31, | ||
| 123 | 30, | ||
| 124 | 31, | ||
| 125 | ]; | ||
| 116 | 126 | ||
| 117 | let mut month = 1; | 127 | let mut month = 1; |
| 118 | for m in 1..=12 { | 128 | for (m, month_days) in days_per_month.iter().enumerate() { |
| 119 | if days <= days_per_month[m] as u32 { | 129 | let m = m + 1; |
| 130 | if days <= *month_days as u32 { | ||
| 120 | month = m; | 131 | month = m; |
| 121 | break; | 132 | break; |
| 122 | } else { | 133 | } else { |
| 123 | days -= days_per_month[m] as u32; | 134 | days -= *month_days as u32; |
| 124 | } | 135 | } |
| 125 | } | 136 | } |
| 126 | 137 | ||
diff --git a/src/uart.rs b/src/uart.rs index cd504a6c6..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; |
