pub struct Rtc<'d> { /* private fields */ }
Expand description
nRF RTC driver.
Implementations§
Source§impl<'d> Rtc<'d>
impl<'d> Rtc<'d>
Sourcepub fn new<T: Instance>(
_rtc: Peri<'d, T>,
prescaler: u32,
) -> Result<Self, PrescalerOutOfRangeError>
pub fn new<T: Instance>( _rtc: Peri<'d, T>, prescaler: u32, ) -> Result<Self, PrescalerOutOfRangeError>
Create a new Rtc
driver.
fRTC [Hz] = 32_768 / (prescaler
+ 1 )
Sourcepub fn new_for_freq<T: Instance>(
rtc: Peri<'d, T>,
freq_hz: u32,
) -> Result<Self, PrescalerOutOfRangeError>
pub fn new_for_freq<T: Instance>( rtc: Peri<'d, T>, freq_hz: u32, ) -> Result<Self, PrescalerOutOfRangeError>
Create a new Rtc
driver, configuring it to run at the given frequency.
Sourcepub unsafe fn steal<T: Instance>() -> Self
pub unsafe fn steal<T: Instance>() -> Self
Steal the RTC peripheral, without checking if it’s already taken.
§Safety
Potentially allows to create multiple instances of the driver for the same peripheral which can lead to undefined behavior.
Sourcepub fn enable_interrupt(&mut self, int: Interrupt, enable_in_nvic: bool)
pub fn enable_interrupt(&mut self, int: Interrupt, enable_in_nvic: bool)
Enables interrupts for the given Interrupt source.
Optionally also enables the interrupt in the NVIC.
Sourcepub fn disable_interrupt(&mut self, int: Interrupt, disable_in_nvic: bool)
pub fn disable_interrupt(&mut self, int: Interrupt, disable_in_nvic: bool)
Disables interrupts for the given Interrupt source.
Optionally also disables the interrupt in the NVIC.
Sourcepub fn enable_event(&mut self, evt: Interrupt)
pub fn enable_event(&mut self, evt: Interrupt)
Enable the generation of a hardware event from a given stimulus.
Sourcepub fn disable_event(&mut self, evt: Interrupt)
pub fn disable_event(&mut self, evt: Interrupt)
Disable the generation of a hardware event from a given stimulus.
Sourcepub fn reset_event(&mut self, evt: Interrupt)
pub fn reset_event(&mut self, evt: Interrupt)
Resets the given event.
Sourcepub fn is_event_triggered(&self, evt: Interrupt) -> bool
pub fn is_event_triggered(&self, evt: Interrupt) -> bool
Checks if the given event has been triggered.
Sourcepub fn set_compare(
&mut self,
reg: CompareChannel,
val: u32,
) -> Result<(), CompareOutOfRangeError>
pub fn set_compare( &mut self, reg: CompareChannel, val: u32, ) -> Result<(), CompareOutOfRangeError>
Set the compare value of a given register. The compare registers have a width of 24 bits.