stm32f4xx_hal::timer::counter

Struct Counter

source
pub struct Counter<TIM, const FREQ: u32>(/* private fields */);
Expand description

Periodic non-blocking timer that implements embedded_hal_02::timer::CountDown

Implementations§

source§

impl<TIM: Instance, const FREQ: u32> Counter<TIM, FREQ>

source

pub fn release(self) -> FTimer<TIM, FREQ>

Releases the TIM peripheral

source

pub fn now(&self) -> TimerInstantU32<FREQ>

source

pub fn start(&mut self, timeout: TimerDurationU32<FREQ>) -> Result<(), Error>

source

pub fn wait(&mut self) -> Result<(), Error>

source

pub fn cancel(&mut self) -> Result<(), Error>

Methods from Deref<Target = FTimer<T, FREQ>>§

source

pub fn configure(&mut self, clocks: &Clocks)

Calculate prescaler depending on Clocks state

source

pub fn set_master_mode(&mut self, mode: TIM::Mms)

Trait Implementations§

source§

impl<TIM: Instance, const FREQ: u32> Cancel for Counter<TIM, FREQ>

source§

type Error = Error

Error returned when a countdown can’t be canceled.
source§

fn cancel(&mut self) -> Result<(), Self::Error>

Tries to cancel this countdown. Read more
source§

impl<T, const FREQ: u32> Deref for Counter<T, FREQ>

source§

type Target = FTimer<T, FREQ>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T, const FREQ: u32> DerefMut for Counter<T, FREQ>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<TIM: Instance, const FREQ: u32> Timer<FREQ> for Counter<TIM, FREQ>

source§

type Error = Error

An error that might happen during waiting
source§

fn now(&mut self) -> TimerInstantU32<FREQ>

Return current time Instant
source§

fn start(&mut self, duration: TimerDurationU32<FREQ>) -> Result<(), Self::Error>

Start timer with a duration
source§

fn cancel(&mut self) -> Result<(), Self::Error>

Tries to stop this timer. An error will be returned if the timer has already been canceled or was never started. An error is also returned if the timer is not Periodic and has already expired.
source§

fn wait(&mut self) -> Result<(), Self::Error>

Wait until timer duration has expired. Must return nb::Error::WouldBlock if timer duration is not yet over. Must return OK(()) as soon as timer duration has expired.
source§

impl<TIM: Instance, const FREQ: u32> CountDown for Counter<TIM, FREQ>

source§

type Time = Duration<u32, 1, FREQ>

The unit of time used by this timer
source§

fn start<T>(&mut self, timeout: T)
where T: Into<Self::Time>,

Starts a new count down
source§

fn wait(&mut self) -> Result<(), Void>

Non-blockingly “waits” until the count down finishes Read more
source§

impl<TIM: Instance, const FREQ: u32> Periodic for Counter<TIM, FREQ>

Auto Trait Implementations§

§

impl<TIM, const FREQ: u32> Freeze for Counter<TIM, FREQ>
where TIM: Freeze,

§

impl<TIM, const FREQ: u32> RefUnwindSafe for Counter<TIM, FREQ>
where TIM: RefUnwindSafe,

§

impl<TIM, const FREQ: u32> Send for Counter<TIM, FREQ>
where TIM: Send,

§

impl<TIM, const FREQ: u32> Sync for Counter<TIM, FREQ>
where TIM: Sync,

§

impl<TIM, const FREQ: u32> Unpin for Counter<TIM, FREQ>
where TIM: Unpin,

§

impl<TIM, const FREQ: u32> UnwindSafe for Counter<TIM, FREQ>
where TIM: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.