146 lines
3.4 KiB
C
146 lines
3.4 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>
|
|
#include "AudioPlayerInterface.h"
|
|
|
|
#define USE_POLAR_DEPENDENT_BIP 1
|
|
|
|
#if USE_POLAR_DEPENDENT_BIP
|
|
typedef struct {
|
|
tGpioPin positiv;
|
|
tGpioPin negativ;
|
|
uint8_t mode;
|
|
} tRedLed;
|
|
|
|
typedef struct {
|
|
tGpioPin positiv;
|
|
tGpioPin negativ;
|
|
uint8_t mode;
|
|
} tGreenLed;
|
|
|
|
typedef struct {
|
|
tRedLed green;
|
|
tGreenLed red;
|
|
bool switchUILedMode;
|
|
} tIndicationBip;
|
|
#else
|
|
typedef struct {
|
|
tGpioPin red;
|
|
tGpioPin green;
|
|
} tBipLed;
|
|
#endif
|
|
|
|
|
|
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 = 19,
|
|
|
|
DEVICE_MODE_UVEOS_MANUAL_BEGIN = 20,
|
|
DEVICE_MODE_UVEOS_AUTOMATIC_BEGIN = 21,
|
|
DEVICE_MODE_UVEOS_TESTING_BEGIN = 22,
|
|
DEVICE_MODE_UVEOS_IGNITION_STATE = 22,
|
|
DEVICE_MODE_UVEOS_IGN_ON = 23,
|
|
|
|
} eDeviceModes;
|
|
|
|
|
|
typedef struct {
|
|
#if USE_POLAR_DEPENDENT_BIP
|
|
tIndicationBip *uiuLed; //User Interface Unit (Блок интерфейса пользователя/БИП)
|
|
#else
|
|
tBipLed *uiuLed; //User Interface Unit (Блок интерфейса пользователя/БИП)
|
|
#endif
|
|
|
|
tOnBoardLed *onBoardLed;
|
|
|
|
eDeviceModes mode;
|
|
tStringLink currentModeName;
|
|
|
|
tEraGlonassUveosIndicator uveosIndicator;
|
|
|
|
uint16_t tick;
|
|
uint16_t ledRedMode;
|
|
uint16_t ledGreenMode;
|
|
tAudioPlayerInterface *audioPlayer;
|
|
|
|
struct {
|
|
osThreadId_t id;
|
|
uint32_t stack[128];
|
|
StaticTask_t controlBlock;
|
|
osThreadAttr_t attr;
|
|
} thread;
|
|
} tUserIndication;
|
|
|
|
|
|
void UserIndication_Init(
|
|
tUserIndication *env,
|
|
eDeviceModes initMode,
|
|
#if USE_POLAR_DEPENDENT_BIP
|
|
tIndicationBip *uiuLed,
|
|
#else
|
|
tBipLed *uiuLed,
|
|
#endif
|
|
tOnBoardLed *onBoardLed,
|
|
tAudioPlayerInterface *audioPlayer
|
|
);
|
|
|
|
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_START_SIGNAL = (0x1 << 2);
|
|
static const uint8_t UIU_ORANGE = UIU_GREEN | UIU_RED;
|
|
|
|
void UserIndication_Uiu(tUserIndication *env, uint8_t value);
|
|
|
|
void UserIndicationDevStarUp(tUserIndication *env);
|
|
|
|
#endif /* USER_INDICATION_INC_USERINDICATION_H_ */
|