Struct nrf52832_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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.