сразу проверяется, включен ли шим, если он доступен на ноге
This commit is contained in:
parent
08dea74f86
commit
fbc87f79b8
@ -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));
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user