Chrispy
High-performance multichannel ADC sampling and audio recording.
Loading...
Searching...
No Matches
Timer.cpp File Reference
#include "Timer.h"
#include <Arduino.h>
#include <avr/interrupt.h>
#include <limits.h>
#include <math.h>

Data Structures

struct  Timer1
 

Macros

#define SKIP_PRESCALER   0
 
#define CTC_MODE   (0b01 << WGM12)
 
#define max(a, b)   (a >= b ? a : b)
 
#define min(a, b)   (a >= b ? b : a)
 

Functions

TimerRc activate_t1 (TimerConfig &cfg)
 Activate the 16-bit timer 1 on ATMEGA2560 with a given configuration.
 
void deactivate_t1 ()
 Deactivate 16-bit timer 1 on ATMEGA2560.
 
const char * error_str (TimerRc rc)
 Retrieve a string description of a timer return code.
 

Macro Definition Documentation

◆ CTC_MODE

#define CTC_MODE   (0b01 << WGM12)

◆ max

#define max (   a,
 
)    (a >= b ? a : b)

◆ min

#define min (   a,
 
)    (a >= b ? b : a)

◆ SKIP_PRESCALER

#define SKIP_PRESCALER   0

Function Documentation

◆ activate_t1()

TimerRc activate_t1 ( TimerConfig cfg)

Activate the 16-bit timer 1 on ATMEGA2560 with a given configuration.

Parameters
cfgComputed timer configuration with desired clock frequency.
Returns
(TimerRc): Return code from operation.

◆ deactivate_t1()

void deactivate_t1 ( )

Deactivate 16-bit timer 1 on ATMEGA2560.

◆ error_str()

const char * error_str ( TimerRc  rc)

Retrieve a string description of a timer return code.

Parameters
rcReturn code to get its string for.
Returns
(const char*): Static string for return code.