mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam3: use TIMER_CHANNEL_NUMOF
This commit is contained in:
parent
c8ff026640
commit
51135a50fc
@ -68,7 +68,7 @@ typedef uint32_t gpio_t;
|
||||
/**
|
||||
* @brief We use 3 channels for each defined timer
|
||||
*/
|
||||
#define TIMER_CHANNELS (3)
|
||||
#define TIMER_CHANNEL_NUMOF (3)
|
||||
|
||||
/**
|
||||
* @brief The RTT width is fixed to 32-bit
|
||||
|
@ -124,7 +124,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;
|
||||
}
|
||||
(&dev(tim)->TC_CHANNEL[0].TC_RA)[channel] = value;
|
||||
@ -135,7 +135,7 @@ int timer_set_absolute(tim_t tim, int channel, unsigned int value)
|
||||
|
||||
int timer_clear(tim_t tim, int channel)
|
||||
{
|
||||
if (channel >= TIMER_CHANNELS) {
|
||||
if (channel >= TIMER_CHANNEL_NUMOF) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ static inline void isr_handler(tim_t tim)
|
||||
{
|
||||
uint32_t status = dev(tim)->TC_CHANNEL[0].TC_SR;
|
||||
|
||||
for (int i = 0; i < TIMER_CHANNELS; i++) {
|
||||
for (int i = 0; i < TIMER_CHANNEL_NUMOF; i++) {
|
||||
if (status & (TC_SR_CPAS << i)) {
|
||||
dev(tim)->TC_CHANNEL[0].TC_IDR = (TC_IDR_CPAS << i);
|
||||
isr_ctx[tim].cb(isr_ctx[tim].arg, i);
|
||||
|
Loading…
Reference in New Issue
Block a user