diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-12-11 19:56:50 -0500 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-12-11 19:56:50 -0500 |
commit | c58fcf5554827113680ee16559c36ed21e0ec0e0 (patch) | |
tree | 642552d3055d47962092c6d2b7233f6c8f086ddd /cores/arduino/wiring_digital.c | |
parent | a9d1368e4c424f17d7d77efeb666f2f7734c7b93 (diff) |
fixed TIMER4 use on Leonardo
ATMEGA32U4 has major differences in TIMER4 registers compared to ATMEGA1280 and 2560. turnOffPWM, analogWrite, and initialize routines had wrong registers, bit names, etc.
Diffstat (limited to 'cores/arduino/wiring_digital.c')
-rw-r--r--[-rwxr-xr-x] | cores/arduino/wiring_digital.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 97ef134..112defc 100755..100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -105,15 +105,31 @@ static void turnOffPWM(uint8_t timer) case TIMER3C: cbi(TCCR3A, COM3C1); break; #endif - #if defined(TCCR4A) && defined(COM4A1) - case TIMER4A: cbi(TCCR4A, COM4A1); break; - #endif + #if defined(TCCR4A) + case TIMER4A: + #if defined(PWM4A) + cbi(TCCR4A, PWM4A); + #elif defined(COM4A1) + cbi(TCCR4A, COM4A1); + #endif + break; + #endif + #if defined(TCCR4A) && defined(COM4B1) case TIMER4B: cbi(TCCR4A, COM4B1); break; #endif #if defined(TCCR4A) && defined(COM4C1) case TIMER4C: cbi(TCCR4A, COM4C1); break; #endif + + #if defined(TCCR4C) + case TIMER4D: + #if defined(PWM4D) + cbi(TCCR4C, PWM4D); + #endif + break; + #endif + #if defined(TCCR5A) case TIMER5A: cbi(TCCR5A, COM5A1); break; case TIMER5B: cbi(TCCR5A, COM5B1); break; |