BeRTOS
timer_mega.h File Reference

Low-level timer module for AVR MEGA (interface). More...

#include <hw/hw_cpufreq.h>
#include "cfg/cfg_timer.h"
#include <cfg/compiler.h>
#include <cfg/macros.h>
#include <avr/io.h>
#include <avr/interrupt.h>

Go to the source code of this file.

Values for CONFIG_TIMER.

Select which hardware timer interrupt to use for system clock and softtimers.

Note:
The timer 1 overflow mode set the timer as a 24 kHz PWM.
#define TIMER_ON_OUTPUT_COMPARE0   1
 Default system timer.
#define TIMER_ON_OVERFLOW1   2
 Default system timer.
#define TIMER_ON_OUTPUT_COMPARE2   3
 Default system timer.
#define TIMER_ON_OVERFLOW3   4
 Default system timer.
#define TIMER_DEFAULT   TIMER_ON_OUTPUT_COMPARE0
 Default system timer.
#define TIMER_HW_HPTICKS_PER_SEC   DIV_ROUND(CPU_FREQ, TIMER_PRESCALER)
 Frequency of the hardware high precision timer.
#define OCR_DIVISOR   (DIV_ROUND(DIV_ROUND(CPU_FREQ, TIMER_PRESCALER), TIMER_TICKS_PER_SEC) - 1)
 System timer: additional division after the prescaler 12288000 / 64 / 192 (0..191) = 1 ms.
#define timer_hw_irq()   do {} while (0)
 Not needed, IRQ timer flag cleared automatically.
#define timer_hw_triggered()   (true)
 Not needed, timer IRQ handler called only for timer source.
void timer_hw_init (void)
 HW dependent timer initialization.

Detailed Description

Low-level timer module for AVR MEGA (interface).

Author:
Bernie Innocenti <bernie@codewiz.org>
Francesco Sacchi <batt@develer.com>
Luca Ottaviano <lottaviano@develer.com>

Definition in file timer_mega.h.


Define Documentation

#define TIMER_HW_HPTICKS_PER_SEC   DIV_ROUND(CPU_FREQ, TIMER_PRESCALER)

Frequency of the hardware high precision timer.

Definition at line 157 of file timer_mega.h.