/**************************************************************************** * * Copyright (c) 2005 Dave Hylands * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ****************************************************************************/ /** * * @file Timer.h * * @brief Defines all of the hardware definitions for the chip. * ****************************************************************************/ #if !defined( TIMER_H ) #define TIMER_H /**< Include Guard */ #include "Config.h" #include /* ---- Include Files ---------------------------------------------------- */ /* ---- Constants and Types ---------------------------------------------- */ #define TIMER0_CLOCK_SEL_MASK (( 1 << CS02 ) | ( 1 << CS01 ) ( 1 << CS00 )) #if defined (__AVR_ATmega8__) \ || defined (__AVR_ATmega16__) \ || defined (__AVR_ATmega32__) \ || defined (__AVR_ATmega48__) \ || defined (__AVR_ATmega88__) \ || defined (__AVR_ATmega168__) #define TIMER0_CLOCK_SEL_NONE (( 0 << CS02 ) | ( 0 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_1 (( 0 << CS02 ) | ( 0 << CS01 ) | ( 1 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_8 (( 0 << CS02 ) | ( 1 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_64 (( 0 << CS02 ) | ( 1 << CS01 ) | ( 1 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_256 (( 1 << CS02 ) | ( 0 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_1024 (( 1 << CS02 ) | ( 0 << CS01 ) | ( 1 << CS00 )) #define TIMER0_CLOCK_SEL_T0_FALLING (( 1 << CS02 ) | ( 1 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_T0_RISING (( 1 << CS02 ) | ( 1 << CS01 ) | ( 1 << CS00 )) #elif defined (__AVR_ATmega64__) \ || defined (__AVR_ATmega128__) #define TIMER0_CLOCK_SEL_NONE (( 0 << CS02 ) | ( 0 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_1 (( 0 << CS02 ) | ( 0 << CS01 ) | ( 1 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_8 (( 0 << CS02 ) | ( 1 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_32 (( 0 << CS02 ) | ( 1 << CS01 ) | ( 1 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_64 (( 1 << CS02 ) | ( 0 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_128 (( 1 << CS02 ) | ( 0 << CS01 ) | ( 1 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_256 (( 1 << CS02 ) | ( 1 << CS01 ) | ( 0 << CS00 )) #define TIMER0_CLOCK_SEL_DIV_1024 (( 1 << CS02 ) | ( 1 << CS01 ) | ( 1 << CS00 )) #define TIMER1_CLOCK_SEL_NONE (( 0 << CS12 ) | ( 0 << CS11 ) | ( 0 << CS10 )) #define TIMER1_CLOCK_SEL_DIV_1 (( 0 << CS12 ) | ( 0 << CS11 ) | ( 1 << CS10 )) #define TIMER1_CLOCK_SEL_DIV_8 (( 0 << CS12 ) | ( 1 << CS11 ) | ( 0 << CS10 )) #define TIMER1_CLOCK_SEL_DIV_64 (( 0 << CS12 ) | ( 1 << CS11 ) | ( 1 << CS10 )) #define TIMER1_CLOCK_SEL_DIV_256 (( 1 << CS12 ) | ( 0 << CS11 ) | ( 0 << CS10 )) #define TIMER1_CLOCK_SEL_DIV_1024 (( 1 << CS12 ) | ( 0 << CS11 ) | ( 1 << CS10 )) #define TIMER1_CLOCK_SEL_T3_FALLING (( 1 << CS12 ) | ( 1 << CS11 ) | ( 0 << CS10 )) #define TIMER1_CLOCK_SEL_T3_RISING (( 1 << CS12 ) | ( 1 << CS11 ) | ( 1 << CS10 )) #define TIMER2_CLOCK_SEL_NONE (( 0 << CS22 ) | ( 0 << CS21 ) | ( 0 << CS20 )) #define TIMER2_CLOCK_SEL_DIV_1 (( 0 << CS22 ) | ( 0 << CS21 ) | ( 1 << CS20 )) #define TIMER2_CLOCK_SEL_DIV_8 (( 0 << CS22 ) | ( 1 << CS21 ) | ( 0 << CS20 )) #define TIMER2_CLOCK_SEL_DIV_64 (( 0 << CS22 ) | ( 1 << CS21 ) | ( 1 << CS20 )) #define TIMER2_CLOCK_SEL_DIV_256 (( 1 << CS22 ) | ( 0 << CS21 ) | ( 0 << CS20 )) #define TIMER2_CLOCK_SEL_DIV_1024 (( 1 << CS22 ) | ( 0 << CS21 ) | ( 1 << CS20 )) #define TIMER2_CLOCK_SEL_T2_FALLING (( 1 << CS22 ) | ( 1 << CS21 ) | ( 0 << CS20 )) #define TIMER2_CLOCK_SEL_T2_RISING (( 1 << CS22 ) | ( 1 << CS21 ) | ( 1 << CS20 )) #define TIMER3_CLOCK_SEL_NONE (( 0 << CS32 ) | ( 0 << CS31 ) | ( 0 << CS30 )) #define TIMER3_CLOCK_SEL_DIV_1 (( 0 << CS32 ) | ( 0 << CS31 ) | ( 1 << CS30 )) #define TIMER3_CLOCK_SEL_DIV_8 (( 0 << CS32 ) | ( 1 << CS31 ) | ( 0 << CS30 )) #define TIMER3_CLOCK_SEL_DIV_64 (( 0 << CS32 ) | ( 1 << CS31 ) | ( 1 << CS30 )) #define TIMER3_CLOCK_SEL_DIV_256 (( 1 << CS32 ) | ( 0 << CS31 ) | ( 0 << CS30 )) #define TIMER3_CLOCK_SEL_DIV_1024 (( 1 << CS32 ) | ( 0 << CS31 ) | ( 1 << CS30 )) #define TIMER3_CLOCK_SEL_T3_FALLING (( 1 << CS32 ) | ( 1 << CS31 ) | ( 0 << CS30 )) #define TIMER3_CLOCK_SEL_T3_RISING (( 1 << CS32 ) | ( 1 << CS31 ) | ( 1 << CS30 )) #define TIMER_3A_PIN 3 #define TIMER_3A_MASK ( 1 << 3 ) #define TIMER_3A_PORT PORTE #define TIMER_3A_DDR DDRE #define TIMER_3A_OCR OCR3A #define TIMER_3A_COM_1 COM3A1 #define TIMER_3A_COM0 COM3A0 #define TIMER_3A_TCCRA TCCR3A #define TIMER_3B_PIN 4 #define TIMER_3B_MASK ( 1 << 4 ) #define TIMER_3B_PORT PORTE #define TIMER_3B_DDR DDRE #define TIMER_3B_OCR OCR3B #define TIMER_3B_COM_1 COM3B1 #define TIMER_3B_COM0 COM3B0 #define TIMER_3B_TCCRA TCCR3A #define TIMER_3C_PIN 5 #define TIMER_3C_MASK ( 1 << 5 ) #define TIMER_3C_PORT PORTE #define TIMER_3C_DDR DDRE #define TIMER_3C_OCR OCR3C #define TIMER_3C_COM_1 COM3C1 #define TIMER_3C_COM0 COM3C0 #define TIMER_3C_TCCRA TCCR3A #else # error Common/avr/Timer.h Processor not supported #endif /* ---- Variable Externs ------------------------------------------------- */ /* ---- Function Prototypes ---------------------------------------------- */ #endif // TIMER_H