stm32: misc. cleanup

This commit is contained in:
xoviat 2023-09-17 18:47:22 -05:00
parent a6ef314be1
commit feaeee1e83
5 changed files with 14 additions and 17 deletions

View file

@ -1,4 +1,3 @@
use core::marker::PhantomData;
use core::ptr; use core::ptr;
use embassy_stm32::ipcc::Ipcc; use embassy_stm32::ipcc::Ipcc;
@ -13,7 +12,7 @@ use crate::unsafe_linked_list::LinkedListNode;
use crate::{channels, evt}; use crate::{channels, evt};
pub struct Ble { pub struct Ble {
phantom: PhantomData<Ble>, _private: (),
} }
impl Ble { impl Ble {
@ -29,7 +28,7 @@ impl Ble {
}); });
} }
Self { phantom: PhantomData } Self { _private: () }
} }
/// `HW_IPCC_BLE_EvtNot` /// `HW_IPCC_BLE_EvtNot`
pub async fn tl_read(&self) -> EvtBox<Self> { pub async fn tl_read(&self) -> EvtBox<Self> {

View file

@ -1,5 +1,4 @@
use core::future::poll_fn; use core::future::poll_fn;
use core::marker::PhantomData;
use core::ptr; use core::ptr;
use core::sync::atomic::{AtomicBool, Ordering}; use core::sync::atomic::{AtomicBool, Ordering};
use core::task::Poll; use core::task::Poll;
@ -21,12 +20,12 @@ static MAC_WAKER: AtomicWaker = AtomicWaker::new();
static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false); static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false);
pub struct Mac { pub struct Mac {
phantom: PhantomData<Mac>, _private: (),
} }
impl Mac { impl Mac {
pub(crate) fn new() -> Self { pub(crate) fn new() -> Self {
Self { phantom: PhantomData } Self { _private: () }
} }
/// `HW_IPCC_MAC_802_15_4_EvtNot` /// `HW_IPCC_MAC_802_15_4_EvtNot`

View file

@ -1,6 +1,5 @@
//! Memory manager routines //! Memory manager routines
use core::future::poll_fn; use core::future::poll_fn;
use core::marker::PhantomData;
use core::mem::MaybeUninit; use core::mem::MaybeUninit;
use core::task::Poll; use core::task::Poll;
@ -21,7 +20,7 @@ static MM_WAKER: AtomicWaker = AtomicWaker::new();
static mut LOCAL_FREE_BUF_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit()); static mut LOCAL_FREE_BUF_QUEUE: Aligned<A4, MaybeUninit<LinkedListNode>> = Aligned(MaybeUninit::uninit());
pub struct MemoryManager { pub struct MemoryManager {
phantom: PhantomData<MemoryManager>, _private: (),
} }
impl MemoryManager { impl MemoryManager {
@ -44,7 +43,7 @@ impl MemoryManager {
}); });
} }
Self { phantom: PhantomData } Self { _private: () }
} }
pub async fn run_queue(&self) { pub async fn run_queue(&self) {

View file

@ -1,4 +1,3 @@
use core::marker::PhantomData;
use core::ptr; use core::ptr;
use crate::cmd::CmdPacket; use crate::cmd::CmdPacket;
@ -12,7 +11,7 @@ use crate::unsafe_linked_list::LinkedListNode;
use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE}; use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE};
pub struct Sys { pub struct Sys {
phantom: PhantomData<Sys>, _private: (),
} }
impl Sys { impl Sys {
@ -27,7 +26,7 @@ impl Sys {
}); });
} }
Self { phantom: PhantomData } Self { _private: () }
} }
/// Returns CPU2 wireless firmware information (if present). /// Returns CPU2 wireless firmware information (if present).

View file

@ -82,8 +82,9 @@ impl core::ops::Sub for RtcInstant {
} }
} }
#[non_exhaustive] pub struct RtcTimeProvider {
pub struct RtcTimeProvider; _private: (),
}
impl RtcTimeProvider { impl RtcTimeProvider {
/// Return the current datetime. /// Return the current datetime.
@ -186,8 +187,8 @@ impl Rtc {
} }
/// Acquire a [`RtcTimeProvider`] instance. /// Acquire a [`RtcTimeProvider`] instance.
pub fn time_provider(&self) -> RtcTimeProvider { pub const fn time_provider(&self) -> RtcTimeProvider {
RtcTimeProvider RtcTimeProvider { _private: () }
} }
/// Set the datetime to a new value. /// Set the datetime to a new value.
@ -222,7 +223,7 @@ impl Rtc {
/// ///
/// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`]. /// Will return an `RtcError::InvalidDateTime` if the stored value in the system is not a valid [`DayOfWeek`].
pub fn now(&self) -> Result<DateTime, RtcError> { pub fn now(&self) -> Result<DateTime, RtcError> {
RtcTimeProvider.now() self.time_provider().now()
} }
/// Check if daylight savings time is active. /// Check if daylight savings time is active.