#ifndef EEZ_LVGL_UI_GUI_H
#define EEZ_LVGL_UI_GUI_H

#include <lvgl.h>

#define SLEEP_TIMEOUT 30000 //sleep display after 30 secs
#define GFX_BL 1
#define BL_BRIGHTNESS 0x1FF

#define TouchInt 8
#define TouchRST 9
#define TouchSCL 7
#define TouchSDA 6

#define TouchI2CAddr 0x15

#define ChipIdRegister 0xA7
#define CST716ChipId 0X20
#define CST816SChipId 0XB4
#define CST816TChipId 0XB5
#define CST816DChipId 0XB6
#define CST826ChipId 0X11
#define CST830ChipId 0X12
#define CST836UChipId 0X13
#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 240

#if defined(EEZ_FOR_LVGL)
#include <eez/flow/lvgl_api.h>
#endif

#if !defined(EEZ_FOR_LVGL)
#include "screens.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif


void TouchHandleInterrupt(void);
void ui_init();
void ui_exitSleep();
bool ui_isSleeping(void);
void ui_tick();
void DisplayInit(void);
void log_print(lv_log_level_t level, const char * buf);
void loadScreen(ScreensEnum screenId);
void loadChart(uint8_t chartId);
void ui_chart_autoscale(void);
float ui_getSetTemp(void);
ScreensEnum ui_getCurrentScreen(void);
ChartsEnum ui_getCurrentChart(void);
void displaySleep();
void displayWake();
void TouchInit();
void my_touch_read(lv_indev_t * indev, lv_indev_data_t * data);
void my_flush_cb(lv_display_t * display, const lv_area_t * area, uint8_t * px_map);
void setBacklight(uint16_t _brightness, uint16_t _fadeTime);


#ifdef __cplusplus
}
#endif

#endif // EEZ_LVGL_UI_GUI_H