diff --git a/cpu/atmega1281/include/default_timer_config.h b/cpu/atmega1281/include/default_timer_config.h index 41fb5f7857..5cb1aaadf2 100644 --- a/cpu/atmega1281/include/default_timer_config.h +++ b/cpu/atmega1281/include/default_timer_config.h @@ -29,7 +29,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (2U) -#define TIMER_CHANNELS (3) +#define TIMER_CHANNEL_NUMOF (3) #define TIMER_0 MEGA_TIMER1 #define TIMER_0_MASK &TIMSK1 diff --git a/cpu/atmega1284p/include/default_timer_config.h b/cpu/atmega1284p/include/default_timer_config.h index 56eac636de..62fbdb2afb 100644 --- a/cpu/atmega1284p/include/default_timer_config.h +++ b/cpu/atmega1284p/include/default_timer_config.h @@ -28,7 +28,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (2U) -#define TIMER_CHANNELS (2) +#define TIMER_CHANNEL_NUMOF (2) #define TIMER_0 MEGA_TIMER1 #define TIMER_0_MASK &TIMSK1 diff --git a/cpu/atmega128rfa1/include/default_timer_config.h b/cpu/atmega128rfa1/include/default_timer_config.h index e3a7901e04..3f193cee61 100644 --- a/cpu/atmega128rfa1/include/default_timer_config.h +++ b/cpu/atmega128rfa1/include/default_timer_config.h @@ -26,7 +26,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (3U) -#define TIMER_CHANNELS (3) +#define TIMER_CHANNEL_NUMOF (3) #define TIMER_0 MEGA_TIMER4 #define TIMER_0_MASK &TIMSK4 diff --git a/cpu/atmega2560/include/default_timer_config.h b/cpu/atmega2560/include/default_timer_config.h index b38e8fe312..b3d850a259 100644 --- a/cpu/atmega2560/include/default_timer_config.h +++ b/cpu/atmega2560/include/default_timer_config.h @@ -29,7 +29,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (2U) -#define TIMER_CHANNELS (3) +#define TIMER_CHANNEL_NUMOF (3) #define TIMER_0 MEGA_TIMER1 #define TIMER_0_MASK &TIMSK1 diff --git a/cpu/atmega256rfr2/include/default_timer_config.h b/cpu/atmega256rfr2/include/default_timer_config.h index 8670c66553..a96cdde2cb 100644 --- a/cpu/atmega256rfr2/include/default_timer_config.h +++ b/cpu/atmega256rfr2/include/default_timer_config.h @@ -26,7 +26,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (3U) -#define TIMER_CHANNELS (3) +#define TIMER_CHANNEL_NUMOF (3) #define TIMER_0 MEGA_TIMER4 #define TIMER_0_MASK &TIMSK4 diff --git a/cpu/atmega328p/include/default_timer_config.h b/cpu/atmega328p/include/default_timer_config.h index b1d39ecc93..08e3ffebeb 100644 --- a/cpu/atmega328p/include/default_timer_config.h +++ b/cpu/atmega328p/include/default_timer_config.h @@ -27,7 +27,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (1U) -#define TIMER_CHANNELS (2) +#define TIMER_CHANNEL_NUMOF (2) #define TIMER_0 MEGA_TIMER1 #define TIMER_0_MASK &TIMSK1 diff --git a/cpu/atmega32u4/include/default_timer_config.h b/cpu/atmega32u4/include/default_timer_config.h index b0d89240a1..fe454f8435 100644 --- a/cpu/atmega32u4/include/default_timer_config.h +++ b/cpu/atmega32u4/include/default_timer_config.h @@ -26,7 +26,7 @@ extern "C" { #ifndef TIMER_NUMOF #define TIMER_NUMOF (2U) -#define TIMER_CHANNELS (3) +#define TIMER_CHANNEL_NUMOF (3) #define TIMER_0 MEGA_TIMER1 #define TIMER_0_MASK &TIMSK1 diff --git a/cpu/atmega_common/periph/timer.c b/cpu/atmega_common/periph/timer.c index 45229de5f7..eadfc4ddc5 100644 --- a/cpu/atmega_common/periph/timer.c +++ b/cpu/atmega_common/periph/timer.c @@ -78,17 +78,17 @@ static unsigned _oneshot; static inline void set_oneshot(tim_t tim, int chan) { - _oneshot |= (1 << chan) << (TIMER_CHANNELS * tim); + _oneshot |= (1 << chan) << (TIMER_CHANNEL_NUMOF * tim); } static inline void clear_oneshot(tim_t tim, int chan) { - _oneshot &= ~((1 << chan) << (TIMER_CHANNELS * tim)); + _oneshot &= ~((1 << chan) << (TIMER_CHANNEL_NUMOF * tim)); } static inline bool is_oneshot(tim_t tim, int chan) { - return _oneshot & ((1 << chan) << (TIMER_CHANNELS * tim)); + return _oneshot & ((1 << chan) << (TIMER_CHANNEL_NUMOF * tim)); } /** @@ -150,7 +150,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 >= TIMER_CHANNELS) { + if (channel >= TIMER_CHANNEL_NUMOF) { return -1; } @@ -168,7 +168,7 @@ int timer_set_absolute(tim_t tim, int channel, unsigned int value) int timer_set(tim_t tim, int channel, unsigned int timeout) { - if (channel >= TIMER_CHANNELS) { + if (channel >= TIMER_CHANNEL_NUMOF) { return -1; } @@ -197,7 +197,7 @@ int timer_set_periodic(tim_t tim, int channel, unsigned int value, uint8_t flags { int res = 0; - if (channel >= TIMER_CHANNELS) { + if (channel >= TIMER_CHANNEL_NUMOF) { return -1; } @@ -235,7 +235,7 @@ int timer_set_periodic(tim_t tim, int channel, unsigned int value, uint8_t flags int timer_clear(tim_t tim, int channel) { - if (channel >= TIMER_CHANNELS) { + if (channel >= TIMER_CHANNEL_NUMOF) { return -1; }