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

View file

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

View file

@ -1,6 +1,5 @@
//! Memory manager routines
use core::future::poll_fn;
use core::marker::PhantomData;
use core::mem::MaybeUninit;
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());
pub struct MemoryManager {
phantom: PhantomData<MemoryManager>,
_private: (),
}
impl MemoryManager {
@ -44,7 +43,7 @@ impl MemoryManager {
});
}
Self { phantom: PhantomData }
Self { _private: () }
}
pub async fn run_queue(&self) {

View file

@ -1,4 +1,3 @@
use core::marker::PhantomData;
use core::ptr;
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};
pub struct Sys {
phantom: PhantomData<Sys>,
_private: (),
}
impl Sys {
@ -27,7 +26,7 @@ impl Sys {
});
}
Self { phantom: PhantomData }
Self { _private: () }
}
/// 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 {
/// Return the current datetime.
@ -186,8 +187,8 @@ impl Rtc {
}
/// Acquire a [`RtcTimeProvider`] instance.
pub fn time_provider(&self) -> RtcTimeProvider {
RtcTimeProvider
pub const fn time_provider(&self) -> RtcTimeProvider {
RtcTimeProvider { _private: () }
}
/// 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`].
pub fn now(&self) -> Result<DateTime, RtcError> {
RtcTimeProvider.now()
self.time_provider().now()
}
/// Check if daylight savings time is active.