/****************************************************************************
 Title	:	TERMINAL FOR VISUALIZATION AND CONTROL CONDITIONS IN HOUSE
 Author	:	Patrik Szalay <xszala01@stud.feec.vutbr.cz>
 File	:	UI.h
 Software:	CodeWarrior Development Studio Version: 10.6 Build Id:140329
 Target	:	MC9S08LH64
*****************************************************************************/

#ifndef UI_H_
#define UI_H_

#include <hidef.h>
#include "derivative.h"
#include "IO.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "lcd_dsp.h"
#include "LCD_GD-5360P.h"
#include "regulation.h"
#include "temp_meas.h"
#include "clock.h"
#include "serial.h"

#define UP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4
#define ENTER 5


typedef struct MeasErr{
	bool roomTemp;
	bool waterOutTemp;
	bool waterReturnTemp;
	bool outdoorTemp;
	bool outdoorHum;
}MeasErr;

typedef enum 
{
	BCKLGHT,
	HOME,
	MENU_MAIN,
	MENU_SETUP,
	MENU_DATETIME,
	MENU_TEMPERATURE,
	MENU_PROGRAM,
	MENU_ROOMTEMP,
	MENU_WATERTEMP,
	MENU_MODESELECT,
	MENU_AUTOSWITCHING,
	MENU_STATUS,
	MENU_RESET,
	MENU_EXIT
}UIState;
typedef enum 
{
	CUR_NONE,
	CUR_Setup,
	CUR_Return,
	CUR_DateTimeSetup,
	CUR_TemperaturesSetup,
	CUR_ProgramSetup,
	CUR_DateSetup,
	CUR_TimeSetup,
	CUR_Save,
	CUR_Date_D,
	CUR_Date_M,
	CUR_Date_Y,
	CUR_Date_DOW,
	CUR_Time_H,
	CUR_Time_M,
	CUR_RoomTempSetup,
	CUR_WaterTempSetup,
	CUR_DayTempSetup,
	CUR_NightTempSetup,
	CUR_RoomTempHystSetup,
	CUR_DayTemp,
	CUR_NightTemp,
	CUR_TempHyst,
	CUR_WaterMaxTempSetup,
	CUR_WaterMaxTemp,
	CUR_WaterTempHystSetup,
	CUR_WaterTempHyst,
	CUR_WaterPumpTimeSetup,
	CUR_WaterPumpTime,
	CUR_Program,
	CUR_ModeSelectSetup,
	CUR_AutoSwitchingSetup,
	CUR_ModeTimeSetup,
	CUR_DayStart,
	CUR_DayEnd,
	CUR_SystTypeSetup,
	CUR_SystType,
	CUR_AutoSwitchingOnSetup,
	CUR_AutoSwitchingOn,
	CUR_AutoSwitchingOffSetup,
	CUR_AutoSwitchingOff,
	CUR_AutoSwitchingStateSetup,
	CUR_AutoSwitchingState,
	CUR_Status,
	CUR_Yes,
	CUR_No,
	CUR_Reset,
	
}UICursor;

extern bool refreshTime;
extern MeasErr MeasError;

void refreshUI(void);

void UIhomeScreen(void);

void cursor(byte button);
void UIMenu_Main(void);
void UIMenu_Setup(void);
void UIMenu_DateTime(void);
void UIMenu_Temperature(void);
void UIMenu_RoomTemperature(void);
void UIMenu_WaterTemperature(void);
void UIMenu_Program(void);
void UIMenu_ModeSelect(void);
void UIMenu_AutoSwitching(void);
void UIMenu_Status(void);
void UIenableNavigate(void);
void UIMenu_Reset(void);

void restart(void);
#endif /* UI_H_ */
