basic button handler routines added, hard buttons tested
touch sensors were also preliminary tested but not all have been analyzed yet.
This commit is contained in:
43
firmware/app/ui/btn.h
Normal file
43
firmware/app/ui/btn.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* btn.h
|
||||
*
|
||||
* Created on: Oct 13, 2024
|
||||
* Author: true
|
||||
*/
|
||||
|
||||
#ifndef USER_UI_BTN_H_
|
||||
#define USER_UI_BTN_H_
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
#define HB_COUNT 3 // total hard buttons in system
|
||||
#define TS_COUNT 7 // total touch sensors in system
|
||||
#define BTN_COUNT (HB_COUNT + TS_COUNT) // total buttons in system
|
||||
|
||||
#define DEBOUNCE 12
|
||||
#define HOLD_COUNTS 600 // how long until a push-and-hold is detected
|
||||
|
||||
|
||||
|
||||
typedef struct BtnSub {
|
||||
uint16_t hold; // initial hold
|
||||
uint16_t repeat; // repeated hold
|
||||
void (*cb_push)(uint8_t);
|
||||
void (*cb_hold)(uint8_t);
|
||||
void (*cb_release)(uint8_t);
|
||||
} BtnSub;
|
||||
|
||||
|
||||
|
||||
extern BtnSub btn[BTN_COUNT];
|
||||
|
||||
|
||||
|
||||
void btn_process();
|
||||
|
||||
|
||||
|
||||
#endif /* USER_UI_BTN_H_ */
|
||||
Reference in New Issue
Block a user