Struct nrf5340_app_hal::Rtc
source · [−]pub struct Rtc<T> { /* private fields */ }
Expand description
An opaque high level interface to an RTC peripheral.
Implementations
sourceimpl<T> Rtc<T> where
T: Instance,
impl<T> Rtc<T> where
T: Instance,
sourcepub fn new(rtc: T, prescaler: u32) -> Result<Rtc<T>, Error>
pub fn new(rtc: T, prescaler: u32) -> Result<Rtc<T>, Error>
Creates a new RTC peripheral instance with a 12 bits prescaler.
fRTC = 32_768 / (prescaler
+ 1 )
sourcepub fn enable_counter(&self)
pub fn enable_counter(&self)
Enable/start the Real Time Counter.
sourcepub fn disable_counter(&self)
pub fn disable_counter(&self)
Disable/stop the Real Time Counter.
sourcepub fn enable_interrupt(&mut self, int: RtcInterrupt, nvic: Option<&mut NVIC>)
pub fn enable_interrupt(&mut self, int: RtcInterrupt, nvic: Option<&mut NVIC>)
Enable the generation of a hardware interrupt from a given stimulus.
If access to the NVIC is not provided, the interrupt must ALSO be enabled
there outside of this function (e.g. manually call nvic.enable
, or through
the use of RTIC).
sourcepub fn disable_interrupt(&mut self, int: RtcInterrupt, nvic: Option<&mut NVIC>)
pub fn disable_interrupt(&mut self, int: RtcInterrupt, nvic: Option<&mut NVIC>)
Disable the generation of a hardware interrupt from a given stimulus.
If access to the NVIC is not provided, the interrupt must ALSO be disabled
there outside of this function (e.g. manually call nvic.disable
, or through
the use of RTIC).
sourcepub fn enable_event(&mut self, evt: RtcInterrupt)
pub fn enable_event(&mut self, evt: RtcInterrupt)
Enable the generation of a hardware event from a given stimulus.
sourcepub fn disable_event(&mut self, evt: RtcInterrupt)
pub fn disable_event(&mut self, evt: RtcInterrupt)
Disables the generation of a hardware event from a given stimulus.
sourcepub fn is_event_triggered(&self, evt: RtcInterrupt) -> bool
pub fn is_event_triggered(&self, evt: RtcInterrupt) -> bool
Checks if the given event has been triggered.
sourcepub fn reset_event(&self, evt: RtcInterrupt)
pub fn reset_event(&self, evt: RtcInterrupt)
Resets the given event.
sourcepub fn set_compare(&mut self, reg: RtcCompareReg, val: u32) -> Result<(), Error>
pub fn set_compare(&mut self, reg: RtcCompareReg, val: u32) -> Result<(), Error>
Set the compare value of a given register. The compare registers have a width of 24 bits.
sourcepub fn get_counter(&self) -> u32
pub fn get_counter(&self) -> u32
Obtain the current value of the Real Time Counter, 24 bits of range.
sourcepub fn clear_counter(&self)
pub fn clear_counter(&self)
Clear the Real Time Counter.
sourcepub fn trigger_overflow(&self)
pub fn trigger_overflow(&self)
Sets the Real Time Counter value to 0xFFFFF0, to allow tests of the overflow condition. The overflow event occurs when the Real Time Counter overflows from 0xFFFFFF to 0.
Auto Trait Implementations
impl<T> RefUnwindSafe for Rtc<T> where
T: RefUnwindSafe,
impl<T> Send for Rtc<T> where
T: Send,
impl<T> Sync for Rtc<T> where
T: Sync,
impl<T> Unpin for Rtc<T> where
T: Unpin,
impl<T> UnwindSafe for Rtc<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more