diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c index 7c678ef..e4f6633 100644 --- a/cores/arduino/wiring_digital.c +++ b/cores/arduino/wiring_digital.c @@ -37,8 +37,8 @@ void pinMode(uint32_t PinNumber, uint32_t PinMode) return; } - if (digitalPinHasPWM(PinNumber)) - // if the pin can use PWM, disable PWM + if (digitalPinPwmIsOn(PinNumber)) + // if the pin use PWM, disable PWM analogWriteStop(PinNumber); // determine the port and the pin number in the port @@ -104,7 +104,7 @@ __attribute__((noinline, section(".ram_text"))) void digitalWrite(uint32_t PinNu } if (digitalPinPwmIsOn(PinNumber)) - // if the pin can use PWM, disable PWM + // if the pin use PWM, disable PWM analogWriteStop(PinNumber); if (Val == HIGH) @@ -123,7 +123,7 @@ __attribute__((noinline, section(".ram_text"))) int digitalRead(uint32_t PinNumb } if (digitalPinPwmIsOn(PinNumber)) - // if the pin can use PWM, disable PWM + // if the pin use PWM, disable PWM analogWriteStop(PinNumber); return GPIO_READ_PIN(digitalPinToPort(PinNumber), digitalPinToBitMask(PinNumber)); @@ -139,7 +139,7 @@ __attribute__((noinline, section(".ram_text"))) void digitalToggle(uint32_t PinN } if (digitalPinPwmIsOn(PinNumber)) - // if the pin can use PWM, disable PWM + // if the pin use PWM, disable PWM analogWriteStop(PinNumber); GPIO_TOGGLE_PIN(digitalPinToPort(PinNumber), digitalPinToBitMask(PinNumber)); diff --git a/cores/arduino/wiring_pulse.cpp b/cores/arduino/wiring_pulse.cpp index eefd0f9..522b74f 100644 --- a/cores/arduino/wiring_pulse.cpp +++ b/cores/arduino/wiring_pulse.cpp @@ -13,7 +13,7 @@ unsigned long pulseIn(int pin, int state, unsigned long timeout) ErrorMsgHandler("pulseIn(): pin number exceeds the total number of pins"); return -1; } - if (digitalPinHasPWM(pin)) + if (digitalPinPwmIsOn(pin) > 0) // pwm off analogWriteStop(pin);