Lanqiao Cup Embedded-Button
(1) Personal habits
Will create separate KEY.c and KEY.h and put them under the HARAWARE folder
(2) Write void KEY_init (void) function
Note; this IO is configured as a pull-up input
(3) Write a macro to define the button status bit
(4) Write void KEY_read (void) function
(5) Problem
Question one (1) (2):
According to its hardware connection:
Question two:
(1) It can achieve the effect of anti-shake, and also serve as a time reference for the long press/short press later
(2) It can be seen in the SysTick timer
Question three:
In order to facilitate reading the level status of the button IO port
(6) Long press / short press
(1) When key_temp=1, it means a short press
(2) If it is key_temp=10, the pressing time must exceed 10*50ms=500ms to take effect