/****************************************************************************
	Ovladac podsvetleni

*****************************************************************************/
#ifndef BACKLIGHT_H
#define BACKLIGHT_H

/****************************************************************************
	Stavy podsviceni

*****************************************************************************/
typedef enum BACKLIGHT_STATE
{
  BACKLIGHT_IDLE,			//zakazano
  BACKLIGHT_OFF,			//vypnuto
  BACKLIGHT_RISING,			//zapinaci rampa
  BACKLIGHT_ON,				//zapnuto
  BACKLIGHT_FALLING,		//vypinaci rampa
}BACKLIGHT_STATE;

#define MAXIMUM_BACKLIGHT_DAC_VALUE 300			//MAximalni proud diodami - odpovidajici hodnota DAC
#define BACKLIGHT_DAC_STEP 50					//krok pro nastavovani podsvetleni
#define BACKLIGHT_DAC_STEP_COUNT 9				//Pocet povolenych kroku

#define BACKLIGHT_TIMEOUT_MINIMUM 10001			//Minimalni cas pro zapnute podsvetleni
#define BACKLIGHT_TIMEOUT_MAXIMUM 100001		//Maximalni cas...
#define BACKLIGHT_TIMEOUT_SETP 1000				//Casovy krok, po kterem lze nastavovat

/****************************************************************************
	Struktura definujici parametry podsvetleni

*****************************************************************************/
typedef struct BACKLIGHT_SETUP_STRUCT
{
	short RampUp;				//strmost zapinaci rampy
	short RampDown;				//strmost vypinaci rampy
	int TimeOut;				//cas podsviceni
	int HardTimeOut;			//cas vypnuti displeje
	short DACMinimum;			//Aktualni minimalni proud diodami - odpovidajici hodnota DAC
	short DACMaximum;			//Maximalni proud diodami....
}BACKLIGHT_SETUP_STRUCT;

extern BACKLIGHT_SETUP_STRUCT currentBacklight;
extern BACKLIGHT_STATE backlightState;


void Backlight(void);
void BacklightRequest(void);
void BacklightInit(void);
void BacklightForceValue(int value);
BACKLIGHT_STATE GetBacklightState(void);
#endif