/* 
 * File:   AudioConsoleLedMgr.h
 * Author: JF
 *
 * Created on February 23, 2025, 3:26 PM
 */

#ifndef AUDIOCONSOLELEDMGR_H
#define	AUDIOCONSOLELEDMGR_H

#include "define.h"
#include "BoardCfg.h"
#include "AudioConsole.h"

#define LED_EFFECT_TIMEOUT 50 //millisecs

#define AUDIO_CONSOLE_MAIN_PWR_STATUS_LED VU1_BACKLIGHT_PIN
#define AUDIO_CONSOLE_ZONE2_PWR_STATUS_LED VU2_BACKLIGHT_PIN
#define AUDIO_CONSOLE_LINK_Z2_STATUS_LED PUSH_BUTTON_LED3_PIN
#define AUDIO_CONSOLE_MAIN_MUTE_STATUS_LED PUSH_BUTTON_LED1_PIN
#define AUDIO_CONSOLE_Z2_MUTE_STATUS_LED PUSH_BUTTON_LED2_PIN

enum eAudioConsoleLED
{
    AUDIO_CONSOLE_SYNC_Z2_LED,
    AUDIO_CONSOLE_MAIN_PWR_LED,     //VU1 backlight
    AUDIO_CONSOLE_Z2_PWR_LED,       //VU2 backlight
    AUDIO_CONSOLE_MAIN_MUTE_LED,
    AUDIO_CONSOLE_Z2_MUTE_LED,
    AUDIO_CONSOLE_PUSHBTN_4_LED,
    AUDIO_CONSOLE_PUSHBTN_5_LED,
    AUDIO_CONSOLE_PUSHBTN_6_LED,
    AUDIO_CONSOLE_PUSHBTN_7_LED,
    
    AUDIO_CONSOLE_NB_LED
            
};


typedef struct BtnLEDDimmer
{
    int Counter;
    int ONPeriod;
    int TotalPeriod;    
    bool IsON;
    bool BreathEffect;
    int DimmerSlope;
}BtnLedDimmer_t;

void AudioConsoleLedMgrInit();
void AudioConsoleLedMgrTick();
int UpdatePushButtonLEDs(AVReceiverStatus_t *MainZoneStatus, AVReceiverStatus_t* Z2Status);
int LedMgrShowOfflineMode(bool Offline);
int LedMgrSetLED(int LedID, bool ON, int Percent, bool breathe);
int TurnON(int LedID);
int TurnOFF(int LedID);

#endif	/* AUDIOCONSOLELEDMGR_H */

