GONEC_ARTERY_UserIndication/Inc/UserIndication.h

97 lines
2.3 KiB
C

/*
* UserIndication.h
*
* Created on: Oct 29, 2022
* Author: xemon
*/
#ifndef USER_INDICATION_INC_USERINDICATION_H_
#define USER_INDICATION_INC_USERINDICATION_H_
#include <cmsis_os.h>
#include <BaseTypes.h>
#include <GpioPinInterface.h>
//#include <EraGlonassUveos_Indicatior.h>
typedef struct {
tGpioPin red;
tGpioPin green;
} tRedGreenLed;
typedef struct {
tGpioPin red;
tGpioPin green;
tGpioPin blue;
} tOnBoardLed;
typedef enum {
DEVICE_MODE_STARTUP = 0,
DEVICE_MODE_TESTING = 1,
DEVICE_MODE_WAIT_GSM_BOOT = 2,
DEVICE_MODE_ERROR_FLASH = 3,
DEVICE_MODE_ERROR_GSM = 4,
DEVICE_MODE_ERROR_CODEC = 5,
DEVICE_MODE_FAILURE = 6,
DEVICE_MODE_ERROR_ON_INIT_TEST1 = 7,
DEVICE_MODE_ERROR_ON_INIT_TEST2 = 8,
DEVICE_MODE_UVEOS_ERA_WAIT_GNSS = 9,
DEVICE_MODE_UVEOS_ERA_GNSS_READY = 10,
DEVICE_MODE_UVEOS_CALL_INITIATE = 11,
DEVICE_MODE_UVEOS_DIALING = 12,
DEVICE_MODE_UVEOS_MSD_TRANSMIT = 13,
DEVICE_MODE_UVEOS_SMS_TRANSMIT = 14,
DEVICE_MODE_UVEOS_CALL_ACTIVE = 15,
DEVICE_MODE_UVEOS_CALL_FAILURE = 16,
DEVICE_MODE_UVEOS_PASSIVE = 17,
DEVICE_MODE_UVEOS_IN_CALL = 18,
DEVICE_MODE_UVEOS_GARAG_MODE = 19,
} eDeviceModes;
typedef struct {
// tRedGreenLed *uiuLed; //User Interface Unit (Блок интерфейса пользователя/БИП)
// tOnBoardLed *onBoardLed;
eDeviceModes mode;
tStringLink currentModeName;
// tEraGlonassUveosIndicator uveosIndicator;
uint8_t tick;
struct {
osThreadId_t id;
uint32_t stack[128];
StaticTask_t controlBlock;
osThreadAttr_t attr;
} thread;
} tUserIndication;
void UserIndication_Init(
tUserIndication *env,
eDeviceModes initMode
// tRedGreenLed *uiuLed,
// tOnBoardLed *onBoardLed
);
void UserIndication_SetMode(tUserIndication *env, eDeviceModes mode);
void UserIndication_StartThread(tUserIndication *env);
void UserIndication_StopThread(tUserIndication *env);
static const uint8_t UIU_OFF = (0);
static const uint8_t UIU_RED = (0x1 << 0);
static const uint8_t UIU_GREEN = (0x1 << 1);
static const uint8_t UIU_ORANGE = UIU_GREEN | UIU_RED;
void UserIndication_Uiu(tUserIndication *env, uint8_t value);
#endif /* USER_INDICATION_INC_USERINDICATION_H_ */