From b10571f0bbb2d42e60a780fbff6a1b15de7bf228 Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 4 Dec 2024 13:10:49 +0300 Subject: [PATCH] Init --- Inc/UserInputButtonEvent.h | 26 ++++++++++++++++++++++++++ Src/UserInputButtonEvent.c | 4 ++++ modular.json | 12 ++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 Inc/UserInputButtonEvent.h create mode 100644 Src/UserInputButtonEvent.c create mode 100644 modular.json diff --git a/Inc/UserInputButtonEvent.h b/Inc/UserInputButtonEvent.h new file mode 100644 index 0000000..7c58556 --- /dev/null +++ b/Inc/UserInputButtonEvent.h @@ -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 diff --git a/Src/UserInputButtonEvent.c b/Src/UserInputButtonEvent.c new file mode 100644 index 0000000..78e2c01 --- /dev/null +++ b/Src/UserInputButtonEvent.c @@ -0,0 +1,4 @@ +// +// Created by xemon on 16.11.22. +// +#include "UserInputButtonEvent.h" \ No newline at end of file diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..d4d574e --- /dev/null +++ b/modular.json @@ -0,0 +1,12 @@ +{ + "dep": [ + ], + "cmake": { + "inc_dirs": [ + "Inc" + ], + "srcs": [ + "Src/**.c" + ] + } +} \ No newline at end of file