usbcan_relay: add standalone buttons reactions

This commit is contained in:
2021-09-10 12:06:01 +03:00
parent 50fdc3e104
commit 1c4c7d9636
91 changed files with 200 additions and 547 deletions

View File

@@ -27,6 +27,8 @@ typedef struct{
static keybase allkeys[BTNSNO] = {0}; // array for buttons' states
uint32_t lastUnsleep = 0; // last keys activity time
void process_keys(){
static uint32_t lastT = 0;
if(Tms == lastT) return;
@@ -61,6 +63,7 @@ void process_keys(){
}
if(e != k->event){
k->lastTms = Tms;
lastUnsleep = Tms;
}
}
}
@@ -79,3 +82,9 @@ keyevent keystate(uint8_t k, uint32_t *T){
if(T) *T = allkeys[k].lastTms;
return evt;
}
// getter of keyevent for allkeys[]
keyevent keyevt(uint8_t k){
if(k >= BTNSNO) return EVT_NONE;
return allkeys[k].event;
}