ATmega644 Smart-Card
Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Communication::Timer Class Reference

Class that provides functionality for the ATmega644's on-board 16-bit timer, such as an ISR. More...

Collaboration diagram for Communication::Timer:
Collaboration graph

Static Public Member Functions

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 Public Attributes

static constexpr uint16_t ETU = 372/1
 The counter value which the timer should match. More...
 

Static Private Member Functions

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.
 

Private Attributes

static void __used__
 
static void __externally_visible__
 

Static Private Attributes

static CommunicationmComm
 Communication object to access the class methods & attributes.
 
static constexpr uint16_t TIMER_BOTTOM = 0x0000
 Timer bottom value.
 

Detailed Description

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

Member Function Documentation

◆ init()

static void Communication::Timer::init ( Communication comm)
static

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
[in]comm(Communication *): Communication pointer.

◆ 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.

Member Data Documentation

◆ 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: