25 lines
459 B
C
25 lines
459 B
C
#ifndef BUTTONS_H
|
|
#define BUTTONS_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#define BTN_EVENT_PRESSED (1 << 0)
|
|
#define BTN_EVENT_RELEASED (1 << 1)
|
|
|
|
typedef enum {
|
|
BTN_ON,
|
|
BTN_OFF,
|
|
|
|
NUM_BUTTONS
|
|
} button_id_t;
|
|
|
|
void buttons_init(void);
|
|
void buttons_update_state(uint32_t time_ms);
|
|
|
|
uint8_t buttons_get_events(button_id_t button);
|
|
bool buttons_is_pressed(button_id_t button);
|
|
uint32_t buttons_get_last_change_time(button_id_t button);
|
|
|
|
#endif // BUTTONS_H
|