96 lines
2.3 KiB
C
96 lines
2.3 KiB
C
//
|
|
// Created by ilya on 04.04.24.
|
|
//
|
|
|
|
#ifndef SMART_COMPONENTS_USERINPUT_H
|
|
#define SMART_COMPONENTS_USERINPUT_H
|
|
|
|
#include "UserInputButtonWatcher.h"
|
|
|
|
//#define AURUS_CAR_UI 1
|
|
|
|
//Кнопки БИП
|
|
typedef struct {
|
|
tGpioPin additional;
|
|
tGpioPin emergency;
|
|
} tUserInputPins;
|
|
/**
|
|
* Минимальное время нажатия для перехода
|
|
* в сервисный режим
|
|
*/
|
|
#define SERVICE_MODE_MIN 7000
|
|
/**
|
|
* Максимальное время нажатия для перехода
|
|
* в сервисный режим
|
|
*/
|
|
#define SERVICE_MODE_MAX 0xFFFF
|
|
typedef enum {
|
|
// UI_BUTTON_EMERGENCY,
|
|
// UI_BUTTON_ADDITIONAL,
|
|
|
|
UI_VIRT_BUTTON_EMERGENCY,
|
|
UI_VIRT_BUTTON_ADDITIONAL,
|
|
UI_CUSTOM_BUTTON_TEST_MODE,
|
|
UI_CUSTOM_BUTTON_EMERGENCY,
|
|
} eUserInputButtonIds;
|
|
|
|
typedef struct {
|
|
tAdcIO *adcIo;
|
|
uint16_t lowLevel;
|
|
uint16_t HightLevel;
|
|
} tUserInputButtonWatcherCustomAdcEnv;
|
|
|
|
typedef struct {
|
|
tUserInputPins *userInputPins;
|
|
uint64_t buttonThisPresTime;
|
|
uint64_t buttonWaitPresTime;
|
|
uint64_t waitPresTime;
|
|
uint16_t presCounter;
|
|
uint16_t presLimit;
|
|
bool flIsPreset;
|
|
} tUserInputButtonWatcherCustomEnvTestMode;
|
|
|
|
typedef struct {
|
|
tUserInputPins *userInputPins;
|
|
} tUserInputButtonWatcherCustomSampleMode;
|
|
|
|
typedef struct {
|
|
tUserInputPins *userInputPins;
|
|
uint64_t buttonThisPresTime;
|
|
uint16_t buttonWaitPresTime;
|
|
bool flIsPreset;
|
|
} tUserInputButtonWatcherCustomEnvEmerMode;
|
|
|
|
typedef struct {
|
|
struct {
|
|
tUserInputButtonWatch watches[8];
|
|
} mem;
|
|
tUserInputButtonWatcher watcher;
|
|
tUserButtonsInterface buttonsInterface;
|
|
|
|
struct {
|
|
osThreadId_t id;
|
|
uint32_t stack[512];
|
|
StaticTask_t controlBlock;
|
|
osThreadAttr_t attr;
|
|
} thread;
|
|
|
|
tUserInputButtonWatcherCustomSampleMode CustomEnvSampleEmer;
|
|
tUserInputButtonWatcherCustomSampleMode CustomEnvSampleAdd;
|
|
|
|
tUserInputButtonWatcherCustomEnvTestMode CustomEnvTestMode;
|
|
tUserInputButtonWatcherCustomEnvEmerMode CustomEnvEmerMode;
|
|
} tUserInput;
|
|
|
|
|
|
void UserInput_Init(
|
|
tUserInput *env,
|
|
tUserInputPins *pins,
|
|
const uint16_t *buttonPresTimeEmerMode,
|
|
const uint16_t *buttonPresTimeTestMode
|
|
);
|
|
|
|
void UserInput_StartThread(tUserInput *env);
|
|
|
|
#endif //SMART_COMPONENTS_USERINPUT_H
|