Class that provides functionality for the ATmega644's on-board 16-bit timer, such as an ISR.
More...
|
static void | init (Communication *comm) |
| Initialize the Timer class. More...
|
|
static void | stop () |
| Stop the 16-bit timer by setting no clock source.
|
|
static void | start () |
| Start the timer, by setting the counter value to TIMER_BOTTOM & setting the clock source to CS10.
|
|
static void | setMatchValue (const uint16_t matchValue) |
| Change the value of register OCR1A. More...
|
|
|
static constexpr uint16_t | ETU = 372/1 |
| The counter value which the timer should match. More...
|
|
|
static void | serviceRoutine () __asm__("__vector_13") __attribute__((__signal__ |
| Interrupt Service Routine for the 16-bit timer. An interrupt is triggered if the timer hits the value stored in OCR1A.
|
|
|
static void | __used__ |
|
static void | __externally_visible__ |
|
Class that provides functionality for the ATmega644's on-board 16-bit timer, such as an ISR.
- Authors
- Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
- Date
- 05.06.2022
- Copyright
- Philipp Karg 2022
◆ init()
Initialize the Timer class.
- Copy the address of the provided Communication pointer,
comm
to mComm.
- Set-up the timer: Enable CTC mode, enable Output Compare Match A Interrupts & set the match value to ETU.
- Parameters
-
◆ setMatchValue()
static void Communication::Timer::setMatchValue |
( |
const uint16_t |
matchValue | ) |
|
|
inlinestatic |
Change the value of register OCR1A.
- Parameters
-
[in] | matchValue | (const uint16_t): Value to set for OCR1A. |
◆ ETU
constexpr uint16_t Communication::Timer::ETU = 372/1 |
|
staticconstexpr |
The counter value which the timer should match.
The default value for a single elementary-time unit (ETU) is: 1ETU = F/D * 1/f_clk, where F is the clock rate conversion integer with a default value of 372 & D is the baud rate adjustment integer with a default value of 1.
If the Timer is run at the same clock speed as the CPU, it needs to count F/D = 372/1 times, to match at every ETU.
The documentation for this class was generated from the following file: