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

Merge pull request #14319 from benpicco/cpu/ezr32wg/TIMER_CHANNELS

cpu/ezr32wg: define TIMER_CHANNEL_NUMOF
This commit is contained in:
benpicco 2020-06-24 09:52:29 +02:00 committed by GitHub
commit cdacdd79e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -38,6 +38,11 @@ extern "C" {
typedef uint32_t tim_t;
/** @} */
/**
* @brief This timer implementation has three available channels
*/
#define TIMER_CHANNEL_NUMOF (3)
/**
* @brief Starting offset of CPU_ID
*/

View File

@ -26,11 +26,6 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
/**
* @brief This timer implementation has three available channels
*/
#define CC_CHANNELS (3U)
/**
* @brief Timer state memory
*/
@ -87,7 +82,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
{
TIMER_TypeDef *tim;
if ((channel < 0) || (channel >= (int)CC_CHANNELS)) {
if ((channel < 0) || (channel >= TIMER_CHANNEL_NUMOF)) {
return -1;
}
@ -99,7 +94,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
int timer_clear(tim_t dev, int channel)
{
if ((channel < 0) || (channel >= (int)CC_CHANNELS)) {
if ((channel < 0) || (channel >= TIMER_CHANNEL_NUMOF)) {
return -1;
}
@ -131,7 +126,7 @@ void timer_reset(tim_t dev)
void TIMER_0_ISR(void)
{
TIMER_TypeDef *tim = timer_config[0].timer;
for (unsigned i = 0; i < CC_CHANNELS; i++) {
for (int i = 0; i < TIMER_CHANNEL_NUMOF; i++) {
if (tim->IF & (TIMER_IF_CC0 << i)) {
tim->CC[i].CTRL = _TIMER_CC_CTRL_MODE_OFF;
tim->IFC = (TIMER_IFC_CC0 << i);