diff --git a/boards/common/atmega/include/periph_conf_atmega_common.h b/boards/common/atmega/include/periph_conf_atmega_common.h index 0cf2d2bb98..a065f857ac 100644 --- a/boards/common/atmega/include/periph_conf_atmega_common.h +++ b/boards/common/atmega/include/periph_conf_atmega_common.h @@ -93,35 +93,10 @@ extern "C" { * The timer driver only supports the four 16-bit timers (Timer1, Timer3, * Timer4, Timer5), so those are the only ones we can use here. * - * - * ATmega32U4 - * ========== - * The ATmega32U4 has 4 timers. Timer0 and Timer2 are 8 Bit Timers. - * - * The timer driver only supports the two 16-bit timers (Timer1 and - * Timer3), so those are the only ones we can use here. - * * @{ */ #ifndef TIMER_NUMOF -#if defined(CPU_ATMEGA32U4) - #define TIMER_NUMOF (2U) - #define TIMER_CHANNELS (3) - - #define TIMER_0 MEGA_TIMER1 - #define TIMER_0_MASK &TIMSK1 - #define TIMER_0_FLAG &TIFR1 - #define TIMER_0_ISRA TIMER1_COMPA_vect - #define TIMER_0_ISRB TIMER1_COMPB_vect - #define TIMER_0_ISRC TIMER1_COMPC_vect - - #define TIMER_1 MEGA_TIMER3 - #define TIMER_1_MASK &TIMSK3 - #define TIMER_1_FLAG &TIFR3 - #define TIMER_1_ISRA TIMER3_COMPA_vect - #define TIMER_1_ISRB TIMER3_COMPB_vect - #define TIMER_1_ISRC TIMER3_COMPC_vect -#elif defined(CPU_ATMEGA128RFA1) || defined(CPU_ATMEGA256RFR2) +#if defined(CPU_ATMEGA128RFA1) || defined(CPU_ATMEGA256RFR2) #define TIMER_NUMOF (3U) #define TIMER_CHANNELS (3) diff --git a/cpu/atmega32u4/include/default_timer_config.h b/cpu/atmega32u4/include/default_timer_config.h new file mode 100644 index 0000000000..b0d89240a1 --- /dev/null +++ b/cpu/atmega32u4/include/default_timer_config.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2017 Thomas Perrot + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup cpu_atmega32u4 + * @{ + * + * @file + * @brief Default ATmega32U4 Timer Config + * + * @author Thomas Perrot + * + */ + +#ifndef DEFAULT_TIMER_CONFIG_H +#define DEFAULT_TIMER_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef TIMER_NUMOF +#define TIMER_NUMOF (2U) +#define TIMER_CHANNELS (3) + +#define TIMER_0 MEGA_TIMER1 +#define TIMER_0_MASK &TIMSK1 +#define TIMER_0_FLAG &TIFR1 +#define TIMER_0_ISRA TIMER1_COMPA_vect +#define TIMER_0_ISRB TIMER1_COMPB_vect +#define TIMER_0_ISRC TIMER1_COMPC_vect + +#define TIMER_1 MEGA_TIMER3 +#define TIMER_1_MASK &TIMSK3 +#define TIMER_1_FLAG &TIFR3 +#define TIMER_1_ISRA TIMER3_COMPA_vect +#define TIMER_1_ISRB TIMER3_COMPB_vect +#define TIMER_1_ISRC TIMER3_COMPC_vect +#endif /* TIMER_NUMOF */ + +#ifdef __cplusplus +} +#endif + +#endif /* DEFAULT_TIMER_CONFIG_H */ +/** @} */ diff --git a/cpu/atmega32u4/include/periph_cpu.h b/cpu/atmega32u4/include/periph_cpu.h index 603ef70625..6a6bf86b94 100644 --- a/cpu/atmega32u4/include/periph_cpu.h +++ b/cpu/atmega32u4/include/periph_cpu.h @@ -66,5 +66,8 @@ enum { } #endif +#include "periph_conf.h" +#include "default_timer_config.h" + #endif /* PERIPH_CPU_H */ /** @} */