MHAA Timer Core v1.0.0
Wrapping timer counts and optional control
Loading...
Searching...
No Matches
mhaa::timer::Timer Class Reference

Operates a borrowed up counter and computes elapsed ticks across a wrap. More...

#include <timer.hpp>

Public Member Functions

 Timer (Counter &counter, CompareControl *compare=nullptr, InputCapture *capture=nullptr)
 Timer (ClockControl &counter, CompareControl *compare=nullptr, InputCapture *capture=nullptr)
void start ()
void stop ()
Count ticks () const
uint8_t width_bits () const
bool set_ticks (Count count)
bool set_tick_frequency_hz (uint32_t frequency_hz)
bool set_compare (ChannelId channel, Count threshold)
bool try_capture (Count &count)
 Preserves count if capture is unavailable or no event is ready.
Count elapsed_since (Count previous) const
 Computes elapsed ticks modulo the counter width.

Detailed Description

Operates a borrowed up counter and computes elapsed ticks across a wrap.

Definition at line 16 of file timer.hpp.

Constructor & Destructor Documentation

◆ Timer() [1/2]

mhaa::timer::Timer::Timer ( Counter & counter,
CompareControl * compare = nullptr,
InputCapture * capture = nullptr )
inlineexplicit

Definition at line 19 of file timer.hpp.

◆ Timer() [2/2]

mhaa::timer::Timer::Timer ( ClockControl & counter,
CompareControl * compare = nullptr,
InputCapture * capture = nullptr )
inlineexplicit

Definition at line 23 of file timer.hpp.

Member Function Documentation

◆ elapsed_since()

Count mhaa::timer::Timer::elapsed_since ( Count previous) const
inline

Computes elapsed ticks modulo the counter width.

Definition at line 48 of file timer.hpp.

◆ set_compare()

bool mhaa::timer::Timer::set_compare ( ChannelId channel,
Count threshold )
inline

Definition at line 39 of file timer.hpp.

◆ set_tick_frequency_hz()

bool mhaa::timer::Timer::set_tick_frequency_hz ( uint32_t frequency_hz)
inline

Definition at line 34 of file timer.hpp.

◆ set_ticks()

bool mhaa::timer::Timer::set_ticks ( Count count)
inline

Definition at line 32 of file timer.hpp.

◆ start()

void mhaa::timer::Timer::start ( )
inline

Definition at line 27 of file timer.hpp.

◆ stop()

void mhaa::timer::Timer::stop ( )
inline

Definition at line 28 of file timer.hpp.

◆ ticks()

Count mhaa::timer::Timer::ticks ( ) const
inline

Definition at line 29 of file timer.hpp.

◆ try_capture()

bool mhaa::timer::Timer::try_capture ( Count & count)
inline

Preserves count if capture is unavailable or no event is ready.

Definition at line 45 of file timer.hpp.

◆ width_bits()

uint8_t mhaa::timer::Timer::width_bits ( ) const
inline

Definition at line 31 of file timer.hpp.


The documentation for this class was generated from the following file: