diff options
| author | xoviat <[email protected]> | 2023-09-17 18:47:22 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-09-17 18:47:22 -0500 |
| commit | feaeee1e835bf3e2a6b36fc8d2d45d4cbc5c27a3 (patch) | |
| tree | afff4cc7efde8203e78715a902898cbaf6bf061a | |
| parent | a6ef314be150fd2e8adbfefe5f2b38126f97551a (diff) | |
stm32: misc. cleanup
| -rw-r--r-- | embassy-stm32-wpan/src/sub/ble.rs | 5 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/sub/mac.rs | 5 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/sub/mm.rs | 5 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/sub/sys.rs | 5 | ||||
| -rw-r--r-- | embassy-stm32/src/rtc/mod.rs | 11 |
5 files changed, 14 insertions, 17 deletions
diff --git a/embassy-stm32-wpan/src/sub/ble.rs b/embassy-stm32-wpan/src/sub/ble.rs index cd32692e1..c5f2334f4 100644 --- a/embassy-stm32-wpan/src/sub/ble.rs +++ b/embassy-stm32-wpan/src/sub/ble.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::marker::PhantomData; | ||
| 2 | use core::ptr; | 1 | use core::ptr; |
| 3 | 2 | ||
| 4 | use embassy_stm32::ipcc::Ipcc; | 3 | use embassy_stm32::ipcc::Ipcc; |
| @@ -13,7 +12,7 @@ use crate::unsafe_linked_list::LinkedListNode; | |||
| 13 | use crate::{channels, evt}; | 12 | use crate::{channels, evt}; |
| 14 | 13 | ||
| 15 | pub struct Ble { | 14 | pub struct Ble { |
| 16 | phantom: PhantomData<Ble>, | 15 | _private: (), |
| 17 | } | 16 | } |
| 18 | 17 | ||
| 19 | impl Ble { | 18 | impl Ble { |
| @@ -29,7 +28,7 @@ impl Ble { | |||
| 29 | }); | 28 | }); |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | Self { phantom: PhantomData } | 31 | Self { _private: () } |
| 33 | } | 32 | } |
| 34 | /// `HW_IPCC_BLE_EvtNot` | 33 | /// `HW_IPCC_BLE_EvtNot` |
| 35 | pub async fn tl_read(&self) -> EvtBox<Self> { | 34 | pub async fn tl_read(&self) -> EvtBox<Self> { |
diff --git a/embassy-stm32-wpan/src/sub/mac.rs b/embassy-stm32-wpan/src/sub/mac.rs index b0cf0248a..baf4da979 100644 --- a/embassy-stm32-wpan/src/sub/mac.rs +++ b/embassy-stm32-wpan/src/sub/mac.rs | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | use core::future::poll_fn; | 1 | use core::future::poll_fn; |
| 2 | use core::marker::PhantomData; | ||
| 3 | use core::ptr; | 2 | use core::ptr; |
| 4 | use core::sync::atomic::{AtomicBool, Ordering}; | 3 | use core::sync::atomic::{AtomicBool, Ordering}; |
| 5 | use core::task::Poll; | 4 | use core::task::Poll; |
| @@ -21,12 +20,12 @@ static MAC_WAKER: AtomicWaker = AtomicWaker::new(); | |||
| 21 | static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false); | 20 | static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false); |
| 22 | 21 | ||
| 23 | pub struct Mac { | 22 | pub struct Mac { |
| 24 | phantom: PhantomData<Mac>, | 23 | _private: (), |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | impl Mac { | 26 | impl Mac { |
| 28 | pub(crate) fn new() -> Self { | 27 | pub(crate) fn new() -> Self { |
| 29 | Self { phantom: PhantomData } | 28 | Self { _private: () } |
| 30 | } | 29 | } |
| 31 | 30 | ||
| 32 | /// `HW_IPCC_MAC_802_15_4_EvtNot` | 31 | /// `HW_IPCC_MAC_802_15_4_EvtNot` |
diff --git a/embassy-stm32-wpan/src/sub/mm.rs b/embassy-stm32-wpan/src/sub/mm.rs index da05ad1dd..4e4d2f854 100644 --- a/embassy-stm32-wpan/src/sub/mm.rs +++ b/embassy-stm32-wpan/src/sub/mm.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | //! Memory manager routines | 1 | //! Memory manager routines |
| 2 | use core::future::poll_fn; | 2 | use core::future::poll_fn; |
| 3 | use core::marker::PhantomData; | ||
| 4 | use core::mem::MaybeUninit; | 3 | use core::mem::MaybeUninit; |
| 5 | use core::task::Poll; | 4 | use core::task::Poll; |
| 6 | 5 | ||
| @@ -21,7 +20,7 @@ static MM_WAKER: AtomicWaker = AtomicWaker::new(); | |||
| 21 | static mut LOCAL_FREE_BUF_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); | 20 | static mut LOCAL_FREE_BUF_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); |
| 22 | 21 | ||
| 23 | pub struct MemoryManager { | 22 | pub struct MemoryManager { |
| 24 | phantom: PhantomData<MemoryManager>, | 23 | _private: (), |
| 25 | } | 24 | } |
| 26 | 25 | ||
| 27 | impl MemoryManager { | 26 | impl MemoryManager { |
| @@ -44,7 +43,7 @@ impl MemoryManager { | |||
| 44 | }); | 43 | }); |
| 45 | } | 44 | } |
| 46 | 45 | ||
| 47 | Self { phantom: PhantomData } | 46 | Self { _private: () } |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | pub async fn run_queue(&self) { | 49 | pub async fn run_queue(&self) { |
diff --git a/embassy-stm32-wpan/src/sub/sys.rs b/embassy-stm32-wpan/src/sub/sys.rs index c17fd531d..bd2ea3f74 100644 --- a/embassy-stm32-wpan/src/sub/sys.rs +++ b/embassy-stm32-wpan/src/sub/sys.rs | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | use core::marker::PhantomData; | ||
| 2 | use core::ptr; | 1 | use core::ptr; |
| 3 | 2 | ||
| 4 | use crate::cmd::CmdPacket; | 3 | use crate::cmd::CmdPacket; |
| @@ -12,7 +11,7 @@ use crate::unsafe_linked_list::LinkedListNode; | |||
| 12 | use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE}; | 11 | use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE}; |
| 13 | 12 | ||
| 14 | pub struct Sys { | 13 | pub struct Sys { |
| 15 | phantom: PhantomData<Sys>, | 14 | _private: (), |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 18 | impl Sys { | 17 | impl Sys { |
| @@ -27,7 +26,7 @@ impl Sys { | |||
| 27 | }); | 26 | }); |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | Self { phantom: PhantomData } | 29 | Self { _private: () } |
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | /// Returns CPU2 wireless firmware information (if present). | 32 | /// Returns CPU2 wireless firmware information (if present). |
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs index a588c8b18..07b4fe1f0 100644 --- a/embassy-stm32/src/rtc/mod.rs +++ b/embassy-stm32/src/rtc/mod.rs | |||
| @@ -82,8 +82,9 @@ impl core::ops::Sub for RtcInstant { | |||
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | #[non_exhaustive] | 85 | pub struct RtcTimeProvider { |
| 86 | pub struct RtcTimeProvider; | 86 | _private: (), |
| 87 | } | ||
| 87 | 88 | ||
| 88 | impl RtcTimeProvider { | 89 | impl RtcTimeProvider { |
| 89 | /// Return the current datetime. | 90 | /// Return the current datetime. |
| @@ -186,8 +187,8 @@ impl Rtc { | |||
| 186 | } | 187 | } |
| 187 | 188 | ||
| 188 | /// Acquire a [`RtcTimeProvider`] instance. | 189 | /// Acquire a [`RtcTimeProvider`] instance. |
| 189 | pub fn time_provider(&self) -> RtcTimeProvider { | 190 | pub const fn time_provider(&self) -> RtcTimeProvider { |
| 190 | RtcTimeProvider | 191 | RtcTimeProvider { _private: () } |
| 191 | } | 192 | } |
| 192 | 193 | ||
| 193 | /// Set the datetime to a new value. | 194 | /// Set the datetime to a new value. |
| @@ -222,7 +223,7 @@ impl Rtc { | |||
| 222 | /// | 223 | /// |
| 223 | /// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`]. | 224 | /// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`]. |
| 224 | pub fn now(&self) -> Result<DateTime, RtcError> { | 225 | pub fn now(&self) -> Result<DateTime, RtcError> { |
| 225 | RtcTimeProvider.now() | 226 | self.time_provider().now() |
| 226 | } | 227 | } |
| 227 | 228 | ||
| 228 | /// Check if daylight savings time is active. | 229 | /// Check if daylight savings time is active. |
