From 200afc46fa5251f32a91e56a02a1752e81cb8851 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 27 May 2020 20:04:13 +0200 Subject: [PATCH] cpu/atmega328p: Relocate default timer config --- .../include/periph_conf_atmega_common.h | 16 +------ cpu/atmega328p/include/default_timer_config.h | 44 +++++++++++++++++++ cpu/atmega328p/include/periph_cpu.h | 3 ++ 3 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 cpu/atmega328p/include/default_timer_config.h diff --git a/boards/common/atmega/include/periph_conf_atmega_common.h b/boards/common/atmega/include/periph_conf_atmega_common.h index 18a2474fa6..ba1a397153 100644 --- a/boards/common/atmega/include/periph_conf_atmega_common.h +++ b/boards/common/atmega/include/periph_conf_atmega_common.h @@ -53,11 +53,6 @@ extern "C" { * * @details Only the 16 bit timers are used by xtimer * - * ATmega328p - * ========== - * The timer driver only supports the 16-bit timer (Timer1) - * so this is the only one we can use here. - * * ATmega1281 * ========== * The ATmega1281 has 6 timers. Timer0 and Timer2 are 8 Bit Timers, @@ -81,16 +76,7 @@ extern "C" { * @{ */ #ifndef TIMER_NUMOF -#if defined(CPU_ATMEGA328P) - #define TIMER_NUMOF (1U) - #define TIMER_CHANNELS (2) - - #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 -#elif defined(CPU_ATMEGA1284P) +#if defined(CPU_ATMEGA1284P) #define TIMER_NUMOF (2U) #define TIMER_CHANNELS (2) diff --git a/cpu/atmega328p/include/default_timer_config.h b/cpu/atmega328p/include/default_timer_config.h new file mode 100644 index 0000000000..b1d39ecc93 --- /dev/null +++ b/cpu/atmega328p/include/default_timer_config.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2015 HAW Hamburg + * 2016 Freie Universität Berlin + * + * 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_atmega328p + * @{ + * + * @file + * @brief Default timer configuration + * + * @author René Herthel + * @author Hauke Petersen + */ + +#ifndef DEFAULT_TIMER_CONFIG_H +#define DEFAULT_TIMER_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef TIMER_NUMOF +#define TIMER_NUMOF (1U) +#define TIMER_CHANNELS (2) + +#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 +#endif /* TIMER_NUMOF */ + +#ifdef __cplusplus +} +#endif + +#endif /* DEFAULT_TIMER_CONFIG_H */ +/** @} */ diff --git a/cpu/atmega328p/include/periph_cpu.h b/cpu/atmega328p/include/periph_cpu.h index ac4be4cd09..9b8a7c9d5f 100644 --- a/cpu/atmega328p/include/periph_cpu.h +++ b/cpu/atmega328p/include/periph_cpu.h @@ -68,5 +68,8 @@ enum { } #endif +#include "periph_conf.h" +#include "default_timer_config.h" + #endif /* PERIPH_CPU_H */ /** @} */