Fix off-by-one error in digitalPinToTimer

This commit is contained in:
Ralf Schlatterbeck 2014-06-29 18:06:48 +02:00
parent ddbfd6712c
commit fbe6ae6a60
2 changed files with 4 additions and 4 deletions

View file

@ -13,7 +13,7 @@
extern "C" {
#include <stdio.h>
#include "led_pwm.h"
#define LED_PIN 5
#define LED_PIN 4
uint8_t pwm = 128;
uint8_t period_100ms = 10; /* one second */

View file

@ -59,11 +59,11 @@ extern "C"{
* contiki for sleep/wakeup timing and is not usable for PWM.
*/
#define digitalPinToTimer(pin) \
( (pin) == 3 \
( (pin) == 2 \
? TIMER3A \
: ( (pin) == 4 \
: ( (pin) == 3 \
? TIMER3B \
: ((pin == 5) ? TIMER3C : NOT_ON_TIMER) \
: ((pin == 4) ? TIMER3C : NOT_ON_TIMER) \
) \
)