Keys and Interrupts

1. Release is high level, press is low level


 

2. There are 2 kinds of signals for the button: pop-up signal, press-down signal

 

3. The way soc reads the key signal: rotation mode and interrupt mode

Rotational training method:   Actively read the level of GPIO at regular intervals

Interrupt method:   The SoC sets the interrupt handler ISR corresponding to the interrupt triggered by the GPIO. When the button is pressed, the external interrupt corresponding to the GPIO will be automatically triggered, causing the ISR to execute, thereby automatically processing the button information.

 

4. Button debounce

Software debounce: Delay for a certain period of time, and then obtain the level status.

Hardware debounce: Reduce jitter by adding components such as capacitors in hardware

 

5. Internal and external interrupts

Internal interrupt: The interrupt source comes from inside the soc, such as serial port, timer interrupt

External interrupt: The interrupt source comes from outside the soc

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326618196&siteId=291194637