//
// Created by villuton on 01.09.2025.
//

#ifndef CHARGER_INDICATION_H
#define CHARGER_INDICATION_H

#include "ChargerConfig.h"
#include "Gpios.h"
#include "cmsis_os2.h"
#include "FreeRTOS.h"

///Перечисление режимов индикации
typedef enum {
    MOD_CH_STARTUP = 0,
    MOD_CH_ERROR,
    MOD_CH_OK,
    MOD_CH_CHARGE,
} eIndicationMod;

typedef struct {
    uint32_t timer;
    uint32_t timeOn;
    uint32_t timeOff;
    bool pinFlag;
    bool isPermanent;
} tMod;

typedef struct {
    tMod mod[INDICATION_MOD_NUM];
    uint32_t iterationMs;
    tLedPins *ledPins;
    uint8_t chanel[INDICATION_CHANEL_NUM];

    struct {
        osThreadId_t id;
        uint32_t stack[128];
        StaticTask_t controlBlock;
        osThreadAttr_t attr;
    } thread;
} tIndication;


void Indication_Init(tIndication *env,
                     tLedPins *ledPins);

void Indication_StartThread(tIndication *env);

void Indication_ChanelSetMode(tIndication *env,
                              eIndicationMod indicationMod,
                              eChargerChannels channel);
#endif //CHARGER_INDICATION_H
