#pragma once #ifndef _BUTTONS_H_ #define _BUTTONS_H_ /* Events */ #define EVT_BTN1_PRS EVENT_MASK(0) #define EVT_BTN2_PRS EVENT_MASK(1) #define EVT_BTN3_PRS EVENT_MASK(2) #define EVT_BTN4_PRS EVENT_MASK(3) /* time constant in ms */ #define BTN_SCAN_PERIOD 10 #define BTN_SCAN_PAUSE 200 #define BTN_TIME_PRESSED 30 #define BTN_TIME_HOLDED 500 #define BTN_TIME_REPEATED 50 #define BUTTON_NUMS 4 /* type defs */ typedef enum btn_num { Button1 = 0, Button2 = 1, Button3 = 2, Button4 = 3 } button_num_t; typedef enum btn_state { BTN_st_Clear = 0, BTN_st_Pressed, BTN_st_Holded, BTN_st_Released } button_state_t; /* function prototypes */ #ifdef __cplusplus extern "C" { #endif void buttons_Init(thread_t * thread); button_state_t buttons_GetState(const button_num_t btn); #ifdef __cplusplus } #endif #endif /* _BUTTONS_H_ */