This commit is contained in:
cfif 2024-12-04 13:10:49 +03:00
commit b10571f0bb
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,26 @@
//
// Created by xemon on 16.11.22.
//
#ifndef UVEOS_ON_NATION_USERINPUTBUTTONEVENT_H
#define UVEOS_ON_NATION_USERINPUTBUTTONEVENT_H
#include "stdint.h"
typedef enum {
USER_INPUT_BUTTON_ACTION_RAISE,
USER_INPUT_BUTTON_ACTION_FALL,
} eUserInputButtonAction;
typedef struct {
uint16_t buttonId;
eUserInputButtonAction action;
uint32_t duration;
} tUserInputButtonEvent;
#define UserInputButtonEventIs(EVENT, BUTTON, ACTION) ((EVENT).buttonId == BUTTON && (EVENT).action == USER_INPUT_BUTTON_ACTION_##ACTION)
#define UserInputButtonEventBetween(EVENT, MIN, MAX) (((EVENT).duration > MIN ) && ((EVENT).duration < MAX))
#define UserInputButtonEventIsBetween(EVENT, BUTTON, ACTION, MIN, MAX) (UserInputButtonEventIs(EVENT, BUTTON, ACTION) && UserInputButtonEventBetween(EVENT, MIN, MAX))
#endif //UVEOS_ON_NATION_USERINPUTBUTTONEVENT_H

View File

@ -0,0 +1,4 @@
//
// Created by xemon on 16.11.22.
//
#include "UserInputButtonEvent.h"

12
modular.json Normal file
View File

@ -0,0 +1,12 @@
{
"dep": [
],
"cmake": {
"inc_dirs": [
"Inc"
],
"srcs": [
"Src/**.c"
]
}
}