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:
true
2026-05-08 20:07:06 -07:00
parent 180aa589ee
commit fe169b64f6
5 changed files with 175 additions and 16 deletions

43
firmware/app/ui/btn.h Normal file
View 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_ */