pub struct HardwareSemaphore<T: Instance> { /* private fields */ }Expand description
HSEM driver
Implementations§
Source§impl<T: Instance> HardwareSemaphore<T>
impl<T: Instance> HardwareSemaphore<T>
Sourcepub fn new<'d>(
_peripheral: Peri<'d, T>,
_irq: impl Binding<T::Interrupt, HardwareSemaphoreInterruptHandler<T>> + 'd,
) -> Self
pub fn new<'d>( _peripheral: Peri<'d, T>, _irq: impl Binding<T::Interrupt, HardwareSemaphoreInterruptHandler<T>> + 'd, ) -> Self
Creates a new HardwareSemaphore instance.
Sourcepub const fn channel_for<'a>(
&'a mut self,
number: u8,
) -> HardwareSemaphoreChannel<'a, T>
pub const fn channel_for<'a>( &'a mut self, number: u8, ) -> HardwareSemaphoreChannel<'a, T>
Get a single channel, and keep the global struct
Sourcepub const fn split<'a>(self) -> [HardwareSemaphoreChannel<'a, T>; 6]
pub const fn split<'a>(self) -> [HardwareSemaphoreChannel<'a, T>; 6]
Split the global struct into channels
If using low-power mode, channels 3 and 4 will not be returned
Sourcepub fn unlock_all(&mut self, key: u16, core_id: u8)
pub fn unlock_all(&mut self, key: u16, core_id: u8)
Unlocks all semaphores. All semaphores locked by a COREID can be unlocked at once by using the HSEM_CR register. Write COREID and correct KEY value in HSEM_CR. All locked semaphores with a matching COREID are unlocked, and may generate an interrupt when enabled.
Sourcepub fn set_clear_key(&mut self, key: u16)
pub fn set_clear_key(&mut self, key: u16)
Sets the clear (unlock) key
Sourcepub fn get_clear_key(&mut self) -> u16
pub fn get_clear_key(&mut self) -> u16
Gets the clear (unlock) key
Auto Trait Implementations§
impl<T> Freeze for HardwareSemaphore<T>
impl<T> RefUnwindSafe for HardwareSemaphore<T>where
T: RefUnwindSafe,
impl<T> Send for HardwareSemaphore<T>
impl<T> Sync for HardwareSemaphore<T>where
T: Sync,
impl<T> Unpin for HardwareSemaphore<T>where
T: Unpin,
impl<T> UnwindSafe for HardwareSemaphore<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more