cpu/xxx430: correct channel check in periph timer driver

This commit is contained in:
PeterKietzmann 2017-11-29 16:47:09 +01:00
parent eb2c0e29ab
commit b6b6fd2626
2 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ int timer_init(tim_t dev, unsigned long freq, timer_cb_t cb, void *arg)
int timer_set_absolute(tim_t dev, int channel, unsigned int value)
{
if (dev != 0 || channel > TIMER_CHAN) {
if (dev != 0 || channel >= TIMER_CHAN) {
return -1;
}
TIMER_BASE->CCR[channel] = value;
@ -81,7 +81,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
int timer_clear(tim_t dev, int channel)
{
if (dev != 0 || channel > TIMER_CHAN) {
if (dev != 0 || channel >= TIMER_CHAN) {
return -1;
}
TIMER_BASE->CCTL[channel] &= ~(CCTL_CCIE);

View File

@ -70,7 +70,7 @@ int timer_init(tim_t dev, unsigned long freq, timer_cb_t cb, void *arg)
int timer_set_absolute(tim_t dev, int channel, unsigned int value)
{
if (dev != 0 || channel > TIMER_CHAN) {
if (dev != 0 || channel >= TIMER_CHAN) {
return -1;
}
TIMER_BASE->CCR[channel] = value;
@ -81,7 +81,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
int timer_clear(tim_t dev, int channel)
{
if (dev != 0 || channel > TIMER_CHAN) {
if (dev != 0 || channel >= TIMER_CHAN) {
return -1;
}
TIMER_BASE->CCTL[channel] &= ~(TIMER_CCTL_CCIE);