Struct nrf52840_hal::pac::SYST [−]
pub struct SYST { /* fields omitted */ }
Expand description
SysTick: System Timer
Implementations
impl SYST
impl SYST
pub fn clear_current(&mut self)
pub fn clear_current(&mut self)
Clears current value to 0
After calling clear_current()
, the next call to has_wrapped()
will return false
.
pub fn disable_counter(&mut self)
pub fn disable_counter(&mut self)
Disables counter
pub fn disable_interrupt(&mut self)
pub fn disable_interrupt(&mut self)
Disables SysTick interrupt
pub fn enable_counter(&mut self)
pub fn enable_counter(&mut self)
Enables counter
NOTE The reference manual indicates that:
“The SysTick counter reload and current value are undefined at reset, the correct initialization sequence for the SysTick counter is:
- Program reload value
- Clear current value
- Program Control and Status register“
The sequence translates to self.set_reload(x); self.clear_current(); self.enable_counter()
pub fn enable_interrupt(&mut self)
pub fn enable_interrupt(&mut self)
Enables SysTick interrupt
pub fn get_clock_source(&mut self) -> SystClkSource
pub fn get_clock_source(&mut self) -> SystClkSource
Gets clock source
NOTE This takes &mut self
because the read operation is side effectful and can clear the
bit that indicates that the timer has wrapped (cf. SYST.has_wrapped
)
pub fn get_current() -> u32
pub fn get_current() -> u32
Gets current value
pub fn get_reload() -> u32
pub fn get_reload() -> u32
Gets reload value
pub fn get_ticks_per_10ms() -> u32
pub fn get_ticks_per_10ms() -> u32
Returns the reload value with which the counter would wrap once per 10 ms
Returns 0
if the value is not known (e.g. because the clock can
change dynamically).
pub fn has_reference_clock() -> bool
pub fn has_reference_clock() -> bool
Checks if an external reference clock is available
pub fn has_wrapped(&mut self) -> bool
pub fn has_wrapped(&mut self) -> bool
Checks if the counter wrapped (underflowed) since the last check
NOTE This takes &mut self
because the read operation is side effectful and will clear
the bit of the read register.
pub fn is_counter_enabled(&mut self) -> bool
pub fn is_counter_enabled(&mut self) -> bool
Checks if counter is enabled
NOTE This takes &mut self
because the read operation is side effectful and can clear the
bit that indicates that the timer has wrapped (cf. SYST.has_wrapped
)
pub fn is_interrupt_enabled(&mut self) -> bool
pub fn is_interrupt_enabled(&mut self) -> bool
Checks if SysTick interrupt is enabled
NOTE This takes &mut self
because the read operation is side effectful and can clear the
bit that indicates that the timer has wrapped (cf. SYST.has_wrapped
)
pub fn is_precise() -> bool
pub fn is_precise() -> bool
Checks if the calibration value is precise
Returns false
if using the reload value returned by
get_ticks_per_10ms()
may result in a period significantly deviating
from 10 ms.
pub fn set_clock_source(&mut self, clk_source: SystClkSource)
pub fn set_clock_source(&mut self, clk_source: SystClkSource)
Sets clock source
pub fn set_reload(&mut self, value: u32)
pub fn set_reload(&mut self, value: u32)
Sets reload value
Valid values are between 1
and 0x00ffffff
.
NOTE To make the timer wrap every N
ticks set the reload value to N - 1
impl SYST
impl SYST
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> CheckedAs for T
[src]
impl<T> CheckedAs for T
[src]pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]Casts the value.
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
[src]
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
[src]pub fn lossless_try_into(self) -> Option<Dst>
[src]
pub fn lossless_try_into(self) -> Option<Dst>
[src]Performs the conversion.
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
[src]
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
[src]pub fn lossy_into(self) -> Dst
[src]
pub fn lossy_into(self) -> Dst
[src]Performs the conversion.
impl<T> OverflowingAs for T
[src]
impl<T> OverflowingAs for T
[src]pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]Casts the value.
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> SaturatingAs for T
[src]
impl<T> SaturatingAs for T
[src]pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]Casts the value.
impl<T> UnwrappedAs for T
[src]
impl<T> UnwrappedAs for T
[src]pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]Casts the value.
impl<T> WrappingAs for T
[src]
impl<T> WrappingAs for T
[src]pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]Casts the value.