From cd050d05d1fa7ae87da68574a9e50edf6ac1ed8f Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 12 Feb 2011 14:47:08 -0500 Subject: Adding noAnalogWrite() function to disable PWM. Also, removing the inline version of digitalPinToTimer() (since we're not optimizing the functions that use it anyway). The noAnalogWrite() function is in wiring_analog.c, deriving from the previous turnOffPWM() which has moved from wiring_digital.c. http://code.google.com/p/arduino/issues/detail?id=476 --- cores/arduino/pins_arduino.h | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'cores/arduino/pins_arduino.h') diff --git a/cores/arduino/pins_arduino.h b/cores/arduino/pins_arduino.h index 4bf6470..ca6a821 100644 --- a/cores/arduino/pins_arduino.h +++ b/cores/arduino/pins_arduino.h @@ -339,30 +339,6 @@ INLINED uint8_t inlined_digitalPinToBitMask(uint8_t pin) } } -// XXX: this needs to return false (or -1) if the pin doesn't have a timer, -// rather than throwing a compilation error. -INLINED uint8_t inlined_digitalPinToTimer(uint8_t pin) -{ - switch(pin) { - case 2: return TIMER3B; // PE 4 ** 2 ** PWM2 - case 3: return TIMER3C; // PE 5 ** 3 ** PWM3 - case 4: return TIMER0B; // PG 5 ** 4 ** PWM4 - case 5: return TIMER3A; // PE 3 ** 5 ** PWM5 - case 6: return TIMER4A; // PH 3 ** 6 ** PWM6 - case 7: return TIMER4B; // PH 4 ** 7 ** PWM7 - case 8: return TIMER4C; // PH 5 ** 8 ** PWM8 - case 9: return TIMER2B; // PH 6 ** 9 ** PWM9 - case 10: return TIMER2A; // PB 4 ** 10 ** PWM10 - case 11: return TIMER1A; // PB 5 ** 11 ** PWM11 - case 12: return TIMER1B; // PB 6 ** 12 ** PWM12 - case 13: return TIMER0A; // PB 7 ** 13 ** PWM13 - case 44: return TIMER5C; // PL 5 ** 44 ** D44 - case 45: return TIMER5B; // PL 4 ** 45 ** D45 - case 46: return TIMER5A; // PL 3 ** 46 ** D46 - default: invalidPinSpecified(); - } -} - #else // defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) INLINED volatile uint8_t *inlined_portModeRegister(uint8_t port_index) @@ -455,25 +431,6 @@ INLINED uint8_t inlined_digitalPinToBitMask(uint8_t pin) } } -// XXX: this needs to return false (or -1) if the pin doesn't have a timer, -// rather than throwing a compilation error. -INLINED uint8_t inlined_digitalPinToTimer(uint8_t pin) -{ - switch(pin) { -#if defined(__AVR_ATmega8__) - case 11: return TIMER2; -#else - case 3: return TIMER2B; - case 5: return TIMER0B; - case 6: return TIMER0A; - case 11: return TIMER2A; -#endif - case 9: return TIMER1A; - case 10: return TIMER1B; - default: invalidPinSpecified(); - } -} - #endif // defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) // Get the bit location within the hardware port of the given virtual pin. -- cgit v1.2.3-18-g5258