1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/atmega{128rfa1,256rfr2}: Relocate default timer config

This commit is contained in:
Marian Buschsieweke 2020-05-27 20:03:01 +02:00
parent 9138e48746
commit a950d6bbb6
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
5 changed files with 123 additions and 40 deletions

View File

@ -53,21 +53,6 @@ extern "C" {
*
* @details Only the 16 bit timers are used by xtimer
*
* ATmega256RFR2
* =============
* The timer driver only supports the four 16-bit timers
* (Timer1, TST, Timer3, Timer4, Timer5), so those are the Timer we can use here.
* Timer 1, TST, PORT B5/6/7 Out, Port D4/6 In, Analog Comparator Input Capture, Output Compare Modulator, PWM
* Timer 3, TST, PORT E3/4/5 Out, Port E/6/7 In, Input or Output Compare and PWM Output
* Timer 4, TST, It can not be connected to any I/O Pin,
* Timer 5, TST, It can not be connected to any I/O Pin,
*
* Using Atmel Timer 4 and 5 seems to be the best choice
* Using Atmel Timer 4 as Xtimer
* and Atmel Timer 5 as timer available for the the application seems to be the best choice,
* as the special functions of the other timer are not lost.
* Atmel Timer1 to be used as PWM timer for RGB LED
*
* ATmega328p
* ==========
* The timer driver only supports the 16-bit timer (Timer1)
@ -96,31 +81,7 @@ extern "C" {
* @{
*/
#ifndef TIMER_NUMOF
#if defined(CPU_ATMEGA128RFA1) || defined(CPU_ATMEGA256RFR2)
#define TIMER_NUMOF (3U)
#define TIMER_CHANNELS (3)
#define TIMER_0 MEGA_TIMER4
#define TIMER_0_MASK &TIMSK4
#define TIMER_0_FLAG &TIFR4
#define TIMER_0_ISRA TIMER4_COMPA_vect
#define TIMER_0_ISRB TIMER4_COMPB_vect
#define TIMER_0_ISRC TIMER4_COMPC_vect
#define TIMER_1 MEGA_TIMER5
#define TIMER_1_MASK &TIMSK5
#define TIMER_1_FLAG &TIFR5
#define TIMER_1_ISRA TIMER5_COMPA_vect
#define TIMER_1_ISRB TIMER5_COMPB_vect
#define TIMER_1_ISRC TIMER5_COMPC_vect
#define TIMER_2 MEGA_TIMER1
#define TIMER_2_MASK &TIMSK1
#define TIMER_2_FLAG &TIFR1
#define TIMER_2_ISRA TIMER1_COMPA_vect
#define TIMER_2_ISRB TIMER1_COMPB_vect
#define TIMER_2_ISRC TIMER1_COMPC_vect
#elif defined(CPU_ATMEGA328P)
#if defined(CPU_ATMEGA328P)
#define TIMER_NUMOF (1U)
#define TIMER_CHANNELS (2)

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) Josua Arndt, Steffen Robertz 2017 RWTH Aachen
*
* 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_atmega128rfa1
* @{
*
* @file
* @brief Default timer configuration
*
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
* @author Steffen Robertz <steffen.robertz@rwth-aachen.de>
*/
#ifndef DEFAULT_TIMER_CONFIG_H
#define DEFAULT_TIMER_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef TIMER_NUMOF
#define TIMER_NUMOF (3U)
#define TIMER_CHANNELS (3)
#define TIMER_0 MEGA_TIMER4
#define TIMER_0_MASK &TIMSK4
#define TIMER_0_FLAG &TIFR4
#define TIMER_0_ISRA TIMER4_COMPA_vect
#define TIMER_0_ISRB TIMER4_COMPB_vect
#define TIMER_0_ISRC TIMER4_COMPC_vect
#define TIMER_1 MEGA_TIMER5
#define TIMER_1_MASK &TIMSK5
#define TIMER_1_FLAG &TIFR5
#define TIMER_1_ISRA TIMER5_COMPA_vect
#define TIMER_1_ISRB TIMER5_COMPB_vect
#define TIMER_1_ISRC TIMER5_COMPC_vect
#define TIMER_2 MEGA_TIMER1
#define TIMER_2_MASK &TIMSK1
#define TIMER_2_FLAG &TIFR1
#define TIMER_2_ISRA TIMER1_COMPA_vect
#define TIMER_2_ISRB TIMER1_COMPB_vect
#define TIMER_2_ISRC TIMER1_COMPC_vect
#endif /* TIMER_NUMOF */
#ifdef __cplusplus
}
#endif
#endif /* DEFAULT_TIMER_CONFIG_H */
/** @} */

View File

@ -73,5 +73,8 @@ enum {
}
#endif
#include "periph_conf.h"
#include "default_timer_config.h"
#endif /* PERIPH_CPU_H */
/** @} */

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) Josua Arndt, Steffen Robertz 2017 RWTH Aachen
*
* 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_atmega256rfr2
* @{
*
* @file
* @brief Default timer configuration
*
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
* @author Steffen Robertz <steffen.robertz@rwth-aachen.de>
*/
#ifndef DEFAULT_TIMER_CONFIG_H
#define DEFAULT_TIMER_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef TIMER_NUMOF
#define TIMER_NUMOF (3U)
#define TIMER_CHANNELS (3)
#define TIMER_0 MEGA_TIMER4
#define TIMER_0_MASK &TIMSK4
#define TIMER_0_FLAG &TIFR4
#define TIMER_0_ISRA TIMER4_COMPA_vect
#define TIMER_0_ISRB TIMER4_COMPB_vect
#define TIMER_0_ISRC TIMER4_COMPC_vect
#define TIMER_1 MEGA_TIMER5
#define TIMER_1_MASK &TIMSK5
#define TIMER_1_FLAG &TIFR5
#define TIMER_1_ISRA TIMER5_COMPA_vect
#define TIMER_1_ISRB TIMER5_COMPB_vect
#define TIMER_1_ISRC TIMER5_COMPC_vect
#define TIMER_2 MEGA_TIMER1
#define TIMER_2_MASK &TIMSK1
#define TIMER_2_FLAG &TIFR1
#define TIMER_2_ISRA TIMER1_COMPA_vect
#define TIMER_2_ISRB TIMER1_COMPB_vect
#define TIMER_2_ISRC TIMER1_COMPC_vect
#endif /* TIMER_NUMOF */
#ifdef __cplusplus
}
#endif
#endif /* DEFAULT_TIMER_CONFIG_H */
/** @} */

View File

@ -73,5 +73,8 @@ enum {
}
#endif
#include "periph_conf.h"
#include "default_timer_config.h"
#endif /* PERIPH_CPU_H */
/** @} */