mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
atmega: fix periph timer configuration
- correct number of timers for atmega328p from 2 to 1 - correct number of timer channels for atmega328p from 3 to 2 - adapt atmega periph timer implementation accordingly
This commit is contained in:
parent
85b9be71da
commit
262a04c9cf
@ -49,7 +49,8 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#ifdef CPU_ATMEGA328P
|
||||
#define TIMER_NUMOF (2U)
|
||||
#define TIMER_NUMOF (1U)
|
||||
#define TIMER_CHANNELS (2)
|
||||
|
||||
#define TIMER_0 MEGA_TIMER1
|
||||
#define TIMER_0_MASK &TIMSK1
|
||||
@ -60,6 +61,7 @@ extern "C" {
|
||||
|
||||
#ifdef CPU_ATMEGA2560
|
||||
#define TIMER_NUMOF (2U)
|
||||
#define TIMER_CHANNELS (3)
|
||||
|
||||
#define TIMER_0 MEGA_TIMER1
|
||||
#define TIMER_0_MASK &TIMSK1
|
||||
|
@ -57,6 +57,7 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (3U)
|
||||
#define TIMER_CHANNELS (3)
|
||||
|
||||
#define TIMER_0 MEGA_TIMER4
|
||||
#define TIMER_0_MASK &TIMSK4
|
||||
|
@ -51,6 +51,7 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (2U)
|
||||
#define TIMER_CHANNELS (2)
|
||||
|
||||
#define TIMER_0 MEGA_TIMER1
|
||||
#define TIMER_0_MASK &TIMSK1
|
||||
|
@ -44,6 +44,7 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (2U)
|
||||
#define TIMER_CHANNELS (3)
|
||||
|
||||
#define TIMER_0 MEGA_TIMER1
|
||||
#define TIMER_0_MASK &TIMSK1
|
||||
|
@ -32,11 +32,6 @@
|
||||
#define ENABLE_DEBUG (0)
|
||||
#include "debug.h"
|
||||
|
||||
/**
|
||||
* @brief All timers have three channels
|
||||
*/
|
||||
#define CHANNELS (3)
|
||||
|
||||
/**
|
||||
* @brief We have 5 possible prescaler values
|
||||
*/
|
||||
@ -137,7 +132,7 @@ int timer_init(tim_t tim, unsigned long freq, timer_cb_t cb, void *arg)
|
||||
|
||||
int timer_set_absolute(tim_t tim, int channel, unsigned int value)
|
||||
{
|
||||
if (channel >= CHANNELS) {
|
||||
if (channel >= TIMER_CHANNELS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -150,7 +145,7 @@ int timer_set_absolute(tim_t tim, int channel, unsigned int value)
|
||||
|
||||
int timer_clear(tim_t tim, int channel)
|
||||
{
|
||||
if (channel >= CHANNELS) {
|
||||
if (channel >= TIMER_CHANNELS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user