atMETEO
An ATmega based weather station
|
Wrapper for accessing built-in timers facilities. More...
Files | |
file | timer.h |
Wrapper for accessing built-in timers facilities. | |
Classes | |
struct | Avr::TimerUtils< prescaler > |
Compile time calculation of clock select and conversion of time (in us) to system clock ticks given the CPU frequency (F_CPU) and the prescaler . More... | |
class | Avr::TimerInputCapture< prescaler, TObserver > |
C++ wrapper for accessing the built-in input capture facility for measuring the width of external pulses. More... | |
Wrapper for accessing built-in timers facilities.
struct Avr::TimerUtils |
Compile time calculation of clock select and conversion of time (in us) to system clock ticks given the CPU frequency (F_CPU) and the prescaler
.
prescaler | The prescaler for the timer configuration. |
Static Public Member Functions | |
static constexpr uint8_t | clockSelect () |
Calculates the clock select value for the given prescaler . More... | |
template<uint16_t us> | |
static constexpr uint16_t | usToTicks () |
Converts us to ticks for the given CPU frequency and prescaler . More... | |
|
inlinestatic |
Calculates the clock select value for the given prescaler
.
The clock select value is needed to configure the timer with the given prescaler
. Typically it has to be set in the Timer/Counter Control Register (TCCR).
Usage:
|
inlinestatic |
Converts us to ticks for the given CPU frequency and prescaler
.
While time values are typically needed when writing an application, the Timer/Counter Register (TCNT) counts (prescaled) system clock ticks.
Usage:
us | Time value (in us) to be converted into system clock ticks. |
us
. class Avr::TimerInputCapture |
C++ wrapper for accessing the built-in input capture facility for measuring the width of external pulses.
Usage:
prescaler | The prescaler for the timer configuration. |
TObserver | The observer that is notified of input capture events using its void pulseWidthReceived(uint16_t pulseWidth) function. |
Static Public Member Functions | |
static TimerInputCapture & | instance () |
Returns the Avr::TimerInputCapture instance. More... | |
|
inlinestatic |
Returns the Avr::TimerInputCapture instance.