cursada_mc2
Base de control de temperatura para EDU-CIAA-NXP
Loading...
Searching...
No Matches
buttons_driver.h File Reference

Interfaz del driver de pulsadores discretos. More...

#include "chip.h"
+ Include dependency graph for buttons_driver.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TECLA1   1
 Identificador de la tecla 1.
 
#define TECLA2   2
 Identificador de la tecla 2.
 
#define TECLA3   3
 Identificador de la tecla 3.
 
#define TECLA4   4
 Identificador de la tecla 4.
 
#define PININT0_IRQ_HANDLER   GPIO0_IRQHandler
 Alias del handler de interrupcion del pulsador 1.
 
#define PININT1_IRQ_HANDLER   GPIO1_IRQHandler
 Alias del handler de interrupcion del pulsador 2.
 
#define PININT2_IRQ_HANDLER   GPIO2_IRQHandler
 Alias del handler de interrupcion del pulsador 3.
 
#define PININT3_IRQ_HANDLER   GPIO3_IRQHandler
 Alias del handler de interrupcion del pulsador 4.
 

Functions

void buttons_init (void)
 Inicializa los pines asociados a los cuatro pulsadores.
 
void button_notify_irq (uint8_t button_id)
 Notifica al driver que una tecla genero una interrupcion externa.
 
void buttons_process (uint32_t delta_ms)
 Procesa el debounce y actualiza los eventos latcheados de teclas.
 
uint8_t button_get_event (void)
 Devuelve y consume el siguiente evento de tecla confirmado.
 

Macro Definition Documentation

◆ PININT0_IRQ_HANDLER

#define PININT0_IRQ_HANDLER (   void)    GPIO0_IRQHandler

Definition at line 21 of file buttons_driver.h.

◆ PININT1_IRQ_HANDLER

#define PININT1_IRQ_HANDLER (   void)    GPIO1_IRQHandler

Definition at line 23 of file buttons_driver.h.

◆ PININT2_IRQ_HANDLER

#define PININT2_IRQ_HANDLER (   void)    GPIO2_IRQHandler

Definition at line 25 of file buttons_driver.h.

◆ PININT3_IRQ_HANDLER

#define PININT3_IRQ_HANDLER (   void)    GPIO3_IRQHandler

Definition at line 27 of file buttons_driver.h.

◆ TECLA1

#define TECLA1   1

Definition at line 12 of file buttons_driver.h.

◆ TECLA2

#define TECLA2   2

Definition at line 14 of file buttons_driver.h.

◆ TECLA3

#define TECLA3   3

Definition at line 16 of file buttons_driver.h.

◆ TECLA4

#define TECLA4   4

Definition at line 18 of file buttons_driver.h.

Function Documentation

◆ button_get_event()

uint8_t button_get_event ( void  )
Returns
TECLA1..TECLA4 si hay un evento pendiente, o 0 si no hay eventos para consumir.

Definition at line 163 of file buttons_driver.c.

References button_estados_, button_hw_, BUTTONS_CANTIDAD, button_estado_t::evento_pendiente, and button_hw_t::tecla.

Referenced by hmi_process().

◆ button_notify_irq()

void button_notify_irq ( uint8_t  button_id)

Esta funcion debe llamarse desde el handler asociado a la tecla correspondiente.

Parameters
button_idIdentificador de la tecla que disparo la IRQ.

Definition at line 107 of file buttons_driver.c.

References button_estados_, and button_indice_desde_tecla().

Referenced by PININT0_IRQ_HANDLER(), PININT1_IRQ_HANDLER(), PININT2_IRQ_HANDLER(), and PININT3_IRQ_HANDLER().

◆ buttons_init()

◆ buttons_process()

void buttons_process ( uint32_t  delta_ms)

Debe llamarse de manera periodica desde el lazo principal.

Parameters
delta_msTiempo transcurrido desde la ultima llamada, en milisegundos.

Definition at line 120 of file buttons_driver.c.

References button_estado_t::armado, button_esta_presionado(), button_estados_, BUTTONS_CANTIDAD, BUTTONS_DEBOUNCE_MS, button_estado_t::debounce_acumulado_ms, button_estado_t::evento_pendiente, and button_estado_t::irq_pendiente.

Referenced by app_step_20ms().