62 lines
2.0 KiB
C
62 lines
2.0 KiB
C
#ifndef GRAFIK_H
|
|
#define GRAFIK_H
|
|
|
|
/* Install the "lvgl" library version 9.X by kisvegabor to interface with the TFT Display - https://lvgl.io/
|
|
*** IMPORTANT: lv_conf.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials ***
|
|
*** YOU MUST USE THE lv_conf.h FILE PROVIDED IN THE LINK BELOW IN ORDER TO USE THE EXAMPLES FROM RANDOM NERD TUTORIALS ***
|
|
FULL INSTRUCTIONS AVAILABLE ON HOW CONFIGURE THE LIBRARY: https://RandomNerdTutorials.com/cyd-lvgl/ or https://RandomNerdTutorials.com/esp32-tft-lvgl/ */
|
|
#include <lvgl.h>
|
|
|
|
/* Install the "TFT_eSPI" library by Bodmer to interface with the TFT Display - https://github.com/Bodmer/TFT_eSPI
|
|
*** IMPORTANT: User_Setup.h available on the internet will probably NOT work with the examples available at Random Nerd Tutorials ***
|
|
*** YOU MUST USE THE User_Setup.h FILE PROVIDED IN THE LINK BELOW IN ORDER TO USE THE EXAMPLES FROM RANDOM NERD TUTORIALS ***
|
|
FULL INSTRUCTIONS AVAILABLE ON HOW CONFIGURE THE LIBRARY: https://RandomNerdTutorials.com/cyd-lvgl/ or https://RandomNerdTutorials.com/esp32-tft-lvgl/ */
|
|
#include <TFT_eSPI.h>
|
|
|
|
typedef struct {
|
|
lv_obj_t * arc;
|
|
const char * name;
|
|
int x;
|
|
int y;
|
|
int size;
|
|
float value;
|
|
const char* valformat;
|
|
const char* const unit;
|
|
int lowvalue;
|
|
int highvalue;
|
|
int green;
|
|
int yellow;
|
|
lv_style_t style_arc;
|
|
lv_style_t style_label;
|
|
lv_style_t lv_style_value_label;
|
|
|
|
} ARC;
|
|
|
|
|
|
|
|
#define SCREEN_WIDTH 320
|
|
#define SCREEN_HEIGHT 240
|
|
|
|
|
|
#ifdef MAIN
|
|
ARC arcTemp = {NULL, "temp", 40, -1, 110, 30.0, "%.1f", "°C", 10, 30, 20, 25};
|
|
ARC arcHum = {NULL, "humi", 170, -1, 110, 60.0, "%.0f", "%", 40, 100, 65, 70};
|
|
lv_obj_t * date_label;
|
|
lv_obj_t * time_label;
|
|
#else
|
|
extern ARC arcTemp;
|
|
extern ARC arcHum;
|
|
extern lv_obj_t * date_label;
|
|
extern lv_obj_t * time_label;
|
|
#endif
|
|
|
|
|
|
void setup_grafik(void);
|
|
void lv_create_main_gui(void);
|
|
void setValuetoArc(ARC arc, float value);
|
|
void drawChart();
|
|
void updatechartData(float value, float value_hum);
|
|
|
|
|
|
|
|
#endif |