1. The variable "key_up" is initialized as 1, which means that the key is initially released.
  2. If "mode" is 1 (which is not used in the code), the function supports continuous pressing of the key.
  3. If none of the keys are pressed or the WK_UP button is not released, the "key_up" flag remains unchanged. Otherwise, the "key_up" flag is set to 0 and the function returns the corresponding key code. If none of the keys are pressed and the WK_UP button is released, the "key_up" flag is set to 1 to indicate that the key is released. If no key is pressed, the function returns 0 to indicate that no key is pressed
u8 KEY_Scanu8 mode① u8 key_up=1; 按键松开标志ifmode==1 ② ; 支持连按ifkey_up&&KEY0==0KEY1==0KEY2==0WK_UP==1delay_ms10;key_up=0;ifKEY0==0 return KEY0_PRES;else ifKEY1==0 return KEY1_PRES;

原文地址: https://www.cveoy.top/t/topic/hdFD 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录