##按键消抖
uint16_t key_scan(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
{
uint16_t count;
for(count = 0;count < 10;)
{
HAL_Delay(10);
if(HAL_GPIO_ReadPin(GPIOx,GPIO_Pin)==0)
{
count++;
}
else count–;
}
if(count > 10) return 1;
if(count < 5) return 0;
}
按键消抖
最新推荐文章于 2023-07-26 19:26:33 发布