34 lines
No EOL
891 B
C
34 lines
No EOL
891 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/task.h>
|
|
#include <freertos/event_groups.h>
|
|
|
|
#define INPUTS_TAG ("INPUT")
|
|
|
|
extern TaskHandle_t T_ReadInputs_Handle;
|
|
extern EventGroupHandle_t EV_InputEventGroupHandle;
|
|
|
|
typedef enum InputEventGroupFlags {
|
|
INPUT_EVENT_WHEEL = (1 << 0),
|
|
INPUT_EVENT_KEY_FORWARD = (1 << 1),
|
|
INPUT_EVENT_KEY_BACKSPACE = (1 << 2),
|
|
INPUT_EVENT_KEY_DONE = (1 << 3),
|
|
INPUT_EVENT_KEY_CANCEL = (1 << 4),
|
|
INPUT_EVENT_KEY_OPTION = (1 << 5)
|
|
} UIEventGroupFlags_t;
|
|
|
|
typedef struct InputState {
|
|
bool forward, backspace, done, cancel, option;
|
|
int wheel;
|
|
uint8_t _wheelQuadrant;
|
|
} InputState_t;
|
|
|
|
void init_inputs();
|
|
|
|
InputState_t waitForInputEvents(UIEventGroupFlags_t events, BaseType_t xWaitForAll, TickType_t xTicksToWait);
|
|
|
|
InputState_t getInputState(); |