44 lines
765 B
C
44 lines
765 B
C
/*
|
|
* 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_ */
|