Merge pull request #8176 from PeterKietzmann/pr_msp430_check_tim_chan

cpu/xxx430: correct channel check in periph timer driver
This commit is contained in:
Martine Lenders 2017-11-29 17:09:21 +01:00 committed by GitHub
commit 071d9c2d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);