при отключени шим добавила проверку, работает ли на этом конкретном пине сейчас таймер. если работает, тогда выключаем его и пин настраиваем на вход
This commit is contained in:
1 parent
39ee35f88d
commit
e548e7e486
3 files changed
+43
-3
No files matched your search
@@ -148,7 +148,7 @@ It is recommended to turn off the timer in the following order:
|
||||
*/
|
||||
void analogWriteStop(uint32_t PinNumber)
|
||||
{
|
||||
if (pwmIsInited > 0)
|
||||
if ((pwmIsInited > 0) && (digitalPinPwmIsOn(PinNumber)))
|
||||
{
|
||||
// load the timer address and channel number corresponding to the specified pin
|
||||
htimer32.Instance = pwmPinToTimer(PinNumber);
|
||||
@@ -164,6 +164,10 @@ void analogWriteStop(uint32_t PinNumber)
|
||||
HAL_Timer32_Stop(&htimer32);
|
||||
HAL_Timer32_Deinit(&htimer32);
|
||||
}
|
||||
|
||||
// config pin as input when timer channel off
|
||||
HAL_GPIO_PinConfig(digitalPinToPort(PinNumber), digitalPinToBitMask(PinNumber),
|
||||
HAL_GPIO_MODE_GPIO_INPUT, HAL_GPIO_PULL_NONE, HAL_GPIO_DS_2MA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user