From fbc87f79b803620716171d5f814c1f49b2bcf34b Mon Sep 17 00:00:00 2001 From: KLASSENTS Date: Tue, 27 May 2025 16:20:37 +0700 Subject: [PATCH] =?UTF-8?q?=D1=81=D1=80=D0=B0=D0=B7=D1=83=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D1=8F=D0=B5=D1=82=D1=81=D1=8F,=20?= =?UTF-8?q?=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=20=D0=BB=D0=B8=20?= =?UTF-8?q?=D1=88=D0=B8=D0=BC,=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BE=D0=BD?= =?UTF-8?q?=20=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B5=D0=BD=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=BE=D0=B3=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cores/arduino/wiring_digital.c | 10 +++++----- cores/arduino/wiring_pulse.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) 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);