/* * UserIndication.h * * Created on: Oct 29, 2022 * Author: xemon */ #ifndef USER_INDICATION_INC_USERINDICATION_H_ #define USER_INDICATION_INC_USERINDICATION_H_ #include #include #include #include #include "AudioPlayerInterface.h" #define USE_POLAR_DEPENDENT_BIP 0 typedef struct { tGpioPin ledsBip; tGpioPin red; tGpioPin green; } tBipLed; typedef struct { tGpioPin red1; tGpioPin green1; tGpioPin red2; tGpioPin green2; } tOnBoardLed; typedef enum { DEVICE_MODE_UVEOS_SYSTEM_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 = 23, DEVICE_MODE_UVEOS_IGN_ON = 24, DEVICE_MODE_UVEOS_WAIT_NETWORK = 25, DEVICE_MODE_UVEOS_UNDEFINDET = 26, } tDeviceModes; typedef struct { tBipLed *uiuLed; //User Interface Unit (Блок интерфейса пользователя/БИП) tOnBoardLed *onBoardLed; tDeviceModes mode; int32_t keepIgn; tStringLink currentModeName; tEraGlonassUveosIndicator uveosIndicator; uint16_t tick; bool bipPowerMode; uint32_t timerIsBusy; // tAudioPlayerInterface *audioPlayer; struct { osThreadId_t id; uint32_t stack[128]; StaticTask_t controlBlock; osThreadAttr_t attr; } thread; tDeviceModes tmpDeviceModes; uint16_t blincCount; } tUserIndication; void UserIndication_Init( tUserIndication *env, tDeviceModes initMode, tBipLed *uiuLed, tOnBoardLed *onBoardLed ); void UserIndication_SetMode(tUserIndication *env, tDeviceModes 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_ */