fix conflicts

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-18 17:31:09 +01:00
226 changed files with 1360 additions and 1348 deletions
+22 -26
View File
@@ -1,25 +1,21 @@
#include <lvgl.h>
#include <TFT_eSPI.h>
/* If you want to use the LVGL examples,
make sure to install the lv_examples Arduino library
and uncomment the following line.
#include <lv_examples.h> */
/*If you want to use the LVGL examples,
make sure to install the lv_examples Arduino library
and uncomment the following line.
#include <lv_examples.h>*/
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
TFT_eSPI tft = TFT_eSPI(); /*TFT instance*/
/* Change to your screen resolution */
/*Change to your screen resolution*/
static uint32_t screenWidth = 320;
static uint32_t screenHeight = 240;
<<<<<<< HEAD
static lv_disp_buf_t disp_buf;
=======
static lv_draw_buf_t draw_buf;
>>>>>>> xiaoxiang781216-disp
static lv_color_t buf[screenWidth * 10];
#if LV_USE_LOG != 0
/* Serial debugging */
/*Serial debugging*/
void my_print(lv_log_level_t level, const char *file, uint32_t line, const char *fn_name, const char *dsc)
{
Serial.printf("%s(%s)@%d->%s\r\n", file, fn_name, line, dsc);
@@ -27,7 +23,7 @@ void my_print(lv_log_level_t level, const char *file, uint32_t line, const char
}
#endif
/* Display flushing */
/*Display flushing*/
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
@@ -69,49 +65,49 @@ bool my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
Serial.begin(115200); /*prepare for possible serial debug*/
lv_init();
#if LV_USE_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
lv_log_register_print_cb(my_print); /*register print function for debugging*/
#endif
tft.begin(); /* TFT init */
tft.setRotation(1); /* Landscape orientation */
tft.begin(); /*TFT init*/
tft.setRotation(1); /*Landscape orientation*/
/* Set the touchscreen calibration data,
the actual data for your display can be aquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library */
/*Set the touchscreen calibration data,
the actual data for your display can be aquired using
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
uint16_t calData[5] = {275, 3620, 264, 3532, 1};
tft.setTouch(calData);
lv_draw_buf_init(&draw_buf, buf, NULL, screenWidth * 10);
/* Initialize the display */
/*Initialize the display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
/* Change the following line to your display resolution */
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
/* Initialize the (dummy) input device driver */
/*Initialize the (dummy) input device driver*/
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
/* Try an example from the lv_examples Arduino library
make sure to include it as written above.
lv_example_btn_1(); */
/*Try an example from the lv_examples Arduino library
make sure to include it as written above.
lv_example_btn_1();*/
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
lv_timer_handler(); /*let the GUI do its work*/
delay(5);
}
@@ -34,7 +34,7 @@ void lv_example_get_started_3(void);
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EX_GET_STARTED_H*/
@@ -17,13 +17,13 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
*/
void lv_example_get_started_3(void)
{
/* Create a slider in the center of the display */
/*Create a slider in the center of the display*/
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
lv_obj_set_width(slider, 200); /*Set the width*/
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/
lv_obj_add_event_cb(slider, slider_event_cb, NULL); /*Assign an event function*/
/* Create a label below the slider */
/*Create a label below the slider*/
label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label, "0");
lv_obj_align(label, slider, LV_ALIGN_OUT_TOP_MID, 0, -15); /*Align below the slider*/
+1 -1
View File
@@ -37,7 +37,7 @@ void lv_example_flex_6(void);
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_FLEX_H*/
+1 -1
View File
@@ -37,7 +37,7 @@ void lv_example_grid_6(void);
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_GRID_H*/
+2 -2
View File
@@ -28,8 +28,8 @@ void lv_example_grid_1(void)
uint8_t row = i / 3;
obj = lv_obj_create(cont, NULL);
/* Stretch the cell horizontally and vertically too
* Set span to 1 to make the cell 1 column/row sized */
/*Stretch the cell horizontally and vertically too
*Set span to 1 to make the cell 1 column/row sized*/
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
LV_GRID_STRETCH, row, 1);
+5 -5
View File
@@ -23,7 +23,7 @@ void lv_example_grid_2(void)
lv_obj_t * label;
lv_obj_t * obj;
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too */
/*Cell to 0;0 and align to to the start (left/top) horizontally and vertically too*/
obj = lv_obj_create(cont, NULL);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(obj, LV_GRID_START, 0, 1,
@@ -31,7 +31,7 @@ void lv_example_grid_2(void)
label = lv_label_create(obj, NULL);
lv_label_set_text(label, "c0, r0");
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too */
/*Cell to 1;0 and align to to the start (left) horizontally and center vertically too*/
obj = lv_obj_create(cont, NULL);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(obj, LV_GRID_START, 1, 1,
@@ -39,7 +39,7 @@ void lv_example_grid_2(void)
label = lv_label_create(obj, NULL);
lv_label_set_text(label, "c1, r0");
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too */
/*Cell to 2;0 and align to to the start (left) horizontally and end (bottom) vertically too*/
obj = lv_obj_create(cont, NULL);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(obj, LV_GRID_START, 2, 1,
@@ -47,7 +47,7 @@ void lv_example_grid_2(void)
label = lv_label_create(obj, NULL);
lv_label_set_text(label, "c2, r0");
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched. */
/*Cell to 1;1 but 2 column wide (span = 2).Set width and height to stretched.*/
obj = lv_obj_create(cont, NULL);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 1, 2,
@@ -55,7 +55,7 @@ void lv_example_grid_2(void)
label = lv_label_create(obj, NULL);
lv_label_set_text(label, "c1-2, r1");
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched. */
/*Cell to 0;1 but 2 rows tall (span = 2).Set width and height to stretched.*/
obj = lv_obj_create(cont, NULL);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, 0, 1,
+8 -8
View File
@@ -6,14 +6,14 @@
*/
void lv_example_grid_3(void)
{
/* Column 1: fix width 60 px
* Column 2: 1 unit from the remaining free space
* Column 3: 2 unit from the remaining free space */
/*Column 1: fix width 60 px
*Column 2: 1 unit from the remaining free space
*Column 3: 2 unit from the remaining free space*/
static lv_coord_t col_dsc[3] = {60, LV_GRID_FR(1), LV_GRID_FR(2)};
/* Row 1: fix width 60 px
* Row 2: 1 unit from the remaining free space
* Row 3: fix width 60 px */
/*Row 1: fix width 60 px
*Row 2: 1 unit from the remaining free space
*Row 3: fix width 60 px*/
static lv_coord_t row_dsc[3] = {40, LV_GRID_FR(1), 40};
static lv_grid_t grid;
@@ -34,8 +34,8 @@ void lv_example_grid_3(void)
uint8_t row = i / 3;
obj = lv_obj_create(cont, NULL);
/* Stretch the cell horizontally and vertically too
* Set span to 1 to make the cell 1 column/row sized */
/*Stretch the cell horizontally and vertically too
*Set span to 1 to make the cell 1 column/row sized*/
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
LV_GRID_STRETCH, row, 1);
+2 -2
View File
@@ -30,8 +30,8 @@ void lv_example_grid_4(void)
uint8_t row = i / 3;
obj = lv_obj_create(cont, NULL);
/* Stretch the cell horizontally and vertically too
* Set span to 1 to make the cell 1 column/row sized */
/*Stretch the cell horizontally and vertically too
*Set span to 1 to make the cell 1 column/row sized*/
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
LV_GRID_STRETCH, row, 1);
+2 -2
View File
@@ -29,8 +29,8 @@ void lv_example_grid_6(void)
uint8_t row = i / 3;
obj = lv_obj_create(cont, NULL);
/* Stretch the cell horizontally and vertically too
* Set span to 1 to make the cell 1 column/row sized */
/*Stretch the cell horizontally and vertically too
*Set span to 1 to make the cell 1 column/row sized*/
lv_obj_set_grid_cell(obj, LV_GRID_STRETCH, col, 1,
LV_GRID_STRETCH, row, 1);
+1 -1
View File
@@ -33,7 +33,7 @@ extern "C" {
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_LAYOUT_H*/
+1 -1
View File
@@ -36,7 +36,7 @@ extern "C" {
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLES_H*/
+14 -13
View File
@@ -54,7 +54,8 @@ void lv_port_disp_init(void)
* Create a buffer for drawing
*----------------------------*/
/* LVGL requires a buffer where it internally draws the widgets.
/**
* LVGL requires a buffer where it internally draws the widgets.
* Later this buffer will passed your display drivers `flush_cb` to copy its content to your display.
* The buffer has to be greater than 1 display row
*
@@ -72,7 +73,7 @@ void lv_port_disp_init(void)
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
* whole frame to display. This way you only need to change the frame buffer's address instead of
* copying the pixels.
* */
*/
/* Example for 1) */
static lv_draw_buf_t draw_buf_dsc_1;
@@ -123,15 +124,15 @@ void lv_port_disp_init(void)
* STATIC FUNCTIONS
**********************/
/* Initialize your display and the required peripherals. */
/*Initialize your display and the required peripherals.*/
static void disp_init(void)
{
/*You code here*/
}
/* Flush the content of the internal buffer the specific area on the display
* You can use DMA or any hardware acceleration to do this operation in the background but
* 'lv_disp_flush_ready()' has to be called when finished. */
/*Flush the content of the internal buffer the specific area on the display
*You can use DMA or any hardware acceleration to do this operation in the background but
*'lv_disp_flush_ready()' has to be called when finished.*/
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
@@ -140,21 +141,21 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo
int32_t y;
for(y = area->y1; y <= area->y2; y++) {
for(x = area->x1; x <= area->x2; x++) {
/* Put a pixel to the display. For example: */
/* put_px(x, y, *color_p)*/
/*Put a pixel to the display. For example:*/
/*put_px(x, y, *color_p)*/
color_p++;
}
}
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
/*IMPORTANT!!!
*Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
}
/*OPTIONAL: GPU INTERFACE*/
#if LV_USE_GPU
/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/
/*If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color*/
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color)
{
@@ -172,8 +173,8 @@ static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t
#endif /*LV_USE_GPU*/
#else /* Enable this file at the top */
#else /*Enable this file at the top*/
/* This dummy typedef exists purely to silence -Wpedantic. */
/*This dummy typedef exists purely to silence -Wpedantic.*/
typedef int keep_pedantic_happy;
#endif
+1 -1
View File
@@ -35,7 +35,7 @@ extern "C" {
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_PORT_DISP_TEMPL_H*/
+25 -25
View File
@@ -19,17 +19,17 @@
* TYPEDEFS
**********************/
/* Create a type to store the required data about your file.
* If you are using a File System library
* it already should have a File type.
* For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
/*Create a type to store the required data about your file.
*If you are using a File System library
*it already should have a File type.
*For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
typedef struct {
/*Add the data you need to store about a file*/
uint32_t dummy1;
uint32_t dummy2;
}file_t;
/*Similarly to `file_t` create a type for directory reading too */
/*Similarly to `file_t` create a type for directory reading too*/
typedef struct {
/*Add the data you need to store about directory reading*/
uint32_t dummy1;
@@ -83,7 +83,7 @@ void lv_port_fs_init(void)
* Register the file system interface in LVGL
*--------------------------------------------------*/
/* Add a simple drive to open images */
/*Add a simple drive to open images*/
lv_fs_drv_t fs_drv;
lv_fs_drv_init(&fs_drv);
@@ -114,7 +114,7 @@ void lv_port_fs_init(void)
* STATIC FUNCTIONS
**********************/
/* Initialize your Storage device and File system. */
/*Initialize your Storage device and File system.*/
static void fs_init(void)
{
/*E.g. for FatFS initialize the SD card and FatFS itself*/
@@ -138,19 +138,19 @@ static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path,
{
/*Open a file for write*/
/* Add your code here*/
/*Add your code here*/
}
else if(mode == LV_FS_MODE_RD)
{
/*Open a file for read*/
/* Add your code here*/
/*Add your code here*/
}
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD))
{
/*Open a file for read and write*/
/* Add your code here*/
/*Add your code here*/
}
return res;
@@ -167,7 +167,7 @@ static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -186,7 +186,7 @@ static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -204,7 +204,7 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -221,7 +221,7 @@ static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -237,7 +237,7 @@ static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -253,7 +253,7 @@ static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -268,7 +268,7 @@ static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -284,7 +284,7 @@ static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -300,7 +300,7 @@ static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const cha
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -317,7 +317,7 @@ static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * fr
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -333,7 +333,7 @@ static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *p
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -350,7 +350,7 @@ static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
@@ -365,13 +365,13 @@ static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
/*Add your code here*/
return res;
}
#else /* Enable this file at the top */
#else /*Enable this file at the top*/
/* This dummy typedef exists purely to silence -Wpedantic. */
/*This dummy typedef exists purely to silence -Wpedantic.*/
typedef int keep_pedantic_happy;
#endif
+1 -1
View File
@@ -35,7 +35,7 @@ extern "C" {
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_PORT_FS_TEMPL_H*/
+21 -20
View File
@@ -68,7 +68,8 @@ static lv_indev_state_t encoder_state;
void lv_port_indev_init(void)
{
/* Here you will find example implementation of input devices supported by LittelvGL:
/**
* Here you will find example implementation of input devices supported by LittelvGL:
* - Touchpad
* - Mouse (with cursor support)
* - Keypad (supports GUI usage only with key)
@@ -125,10 +126,10 @@ void lv_port_indev_init(void)
indev_drv.read_cb = keypad_read;
indev_keypad = lv_indev_drv_register(&indev_drv);
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
* add objects to the group with `lv_group_add_obj(group, obj)`
* and assign this input device to group to navigate in it:
* `lv_indev_set_group(indev_keypad, group);` */
/*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
*add objects to the group with `lv_group_add_obj(group, obj)`
*and assign this input device to group to navigate in it:
*`lv_indev_set_group(indev_keypad, group);`*/
/*------------------
* Encoder
@@ -143,10 +144,10 @@ void lv_port_indev_init(void)
indev_drv.read_cb = encoder_read;
indev_encoder = lv_indev_drv_register(&indev_drv);
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
* add objects to the group with `lv_group_add_obj(group, obj)`
* and assign this input device to group to navigate in it:
* `lv_indev_set_group(indev_encoder, group);` */
/*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
*add objects to the group with `lv_group_add_obj(group, obj)`
*and assign this input device to group to navigate in it:
*`lv_indev_set_group(indev_encoder, group);`*/
/*------------------
* Button
@@ -183,7 +184,7 @@ static void touchpad_init(void)
/*Your code comes here*/
}
/* Will be called by the library to read the touchpad */
/*Will be called by the library to read the touchpad*/
static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
@@ -226,13 +227,13 @@ static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
* Mouse
* -----------------*/
/* Initialize your mouse */
/*Initialize your mouse*/
static void mouse_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the mouse */
/*Will be called by the library to read the mouse*/
static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
/*Get the current x and y coordinates*/
@@ -270,13 +271,13 @@ static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
* Keypad
* -----------------*/
/* Initialize your keypad */
/*Initialize your keypad*/
static void keypad_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the mouse */
/*Will be called by the library to read the mouse*/
static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
@@ -331,13 +332,13 @@ static uint32_t keypad_get_key(void)
* Encoder
* -----------------*/
/* Initialize your keypad */
/*Initialize your keypad*/
static void encoder_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the encoder */
/*Will be called by the library to read the encoder*/
static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
@@ -361,13 +362,13 @@ static void encoder_handler(void)
* Button
* -----------------*/
/* Initialize your buttons */
/*Initialize your buttons*/
static void button_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the button */
/*Will be called by the library to read the button*/
static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
@@ -416,8 +417,8 @@ static bool button_is_pressed(uint8_t id)
return false;
}
#else /* Enable this file at the top */
#else /*Enable this file at the top*/
/* This dummy typedef exists purely to silence -Wpedantic. */
/*This dummy typedef exists purely to silence -Wpedantic.*/
typedef int keep_pedantic_happy;
#endif
+1 -1
View File
@@ -36,7 +36,7 @@ extern "C" {
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_PORT_INDEV_TEMPL_H*/
+1 -1
View File
@@ -34,7 +34,7 @@ void lv_example_scroll_3(void);
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_SCROLL_H*/
+1 -1
View File
@@ -42,7 +42,7 @@ void lv_example_style_11(void);
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_STYLE_H*/
+2 -2
View File
@@ -31,8 +31,8 @@ void lv_example_arc_2(void)
lv_arc_set_angles(arc, 270, 270);
lv_obj_align(arc, NULL, LV_ALIGN_CENTER, 0, 0);
/* Create an `lv_timer` to update the arc.
* Store the `arc` in the user data*/
/*Create an `lv_timer` to update the arc.
*Store the `arc` in the user data*/
lv_timer_create(arc_loader, 20, arc);
}
+1 -1
View File
@@ -28,7 +28,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
txt_area.x1 = txt_area.x2 - txt_size.x + 1;
dsc.color = lv_color_white();
}
/*If the indicator is still short put the text out of it on the right */
/*If the indicator is still short put the text out of it on the right*/
else {
txt_area.x1 = bar->indic_area.x2 + 5;
txt_area.x2 = txt_area.x1 + txt_size.x - 1;
+4 -4
View File
@@ -22,13 +22,13 @@ void lv_example_btn_3(void)
lv_anim_path_set_cb(&path_overshoot, lv_anim_path_overshoot);
/* Transition descriptor when going back to the default state.
* Add some delay to be sure the press transition is visible even if the press was very short*/
/*Transition descriptor when going back to the default state.
*Add some delay to be sure the press transition is visible even if the press was very short*/
static lv_style_transition_dsc_t transition_dsc_def;
lv_style_transition_dsc_init(&transition_dsc_def, props, &path_overshoot, 250, 100);
/* Transition descriptor when going to pressed state.
* No delay, go to presses state immediately*/
/*Transition descriptor when going to pressed state.
*No delay, go to presses state immediately*/
static lv_style_transition_dsc_t transition_dsc_pr;
lv_style_transition_dsc_init(&transition_dsc_pr, props, &path_ease_in_out, 250, 0);
@@ -7,7 +7,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
if(e == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
/*Change the draw descriptor the 2nd button */
/*Change the draw descriptor the 2nd button*/
if(dsc->id == 1) {
dsc->rect_dsc->radius = 0;
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_blue_darken_3();
@@ -18,7 +18,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
dsc->rect_dsc->shadow_ofs_y = 3;
dsc->label_dsc->color = lv_color_white();
}
/*Change the draw descriptor the 3rd button */
/*Change the draw descriptor the 3rd button*/
else if(dsc->id == 2) {
dsc->rect_dsc->radius = LV_RADIUS_CIRCLE;
if(lv_btnmatrix_get_selected_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_red_darken_3();
@@ -36,8 +36,8 @@ void lv_example_canvas_1(void)
lv_canvas_draw_text(canvas, 40, 20, 100, &label_dsc, "Some text on text canvas");
/* Test the rotation. It requires an other buffer where the orignal image is stored.
* So copy the current image to buffer and rotate it to the canvas */
/*Test the rotation. It requires an other buffer where the orignal image is stored.
*So copy the current image to buffer and rotate it to the canvas*/
static lv_color_t cbuf_tmp[CANVAS_WIDTH * CANVAS_HEIGHT];
memcpy(cbuf_tmp, cbuf, sizeof(cbuf_tmp));
lv_img_dsc_t img;
+1 -1
View File
@@ -7,7 +7,7 @@ static lv_chart_series_t * ser2;
static void event_cb(lv_obj_t * obj, lv_event_t e)
{
/*Add the faded area before the lines are drawn */
/*Add the faded area before the lines are drawn*/
if(e == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
if(dsc->part != LV_PART_ITEMS) return;
@@ -33,7 +33,7 @@ void lv_example_dropdown_3(void)
lv_dropdown_set_symbol(dropdown, &img_caret_down);
lv_obj_set_style_transform_angle(dropdown, LV_PART_MAIN, LV_STATE_CHECKED, 1800);
/* In a menu we don't need to show the last clicked item*/
/*In a menu we don't need to show the last clicked item*/
lv_dropdown_set_selected_highlight(dropdown, false);
lv_obj_add_event_cb(dropdown, event_cb, NULL);
+2 -2
View File
@@ -29,7 +29,7 @@ void lv_example_img_2(void)
lv_obj_align(blue_slider, green_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
lv_obj_align(intense_slider, blue_slider, LV_ALIGN_OUT_RIGHT_MID, 25, 0);
/* Now create the actual image */
/*Now create the actual image*/
LV_IMG_DECLARE(img_cogwheel_argb)
img1 = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img1, &img_cogwheel_argb);
@@ -43,7 +43,7 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event)
LV_UNUSED(slider);
if(event == LV_EVENT_VALUE_CHANGED) {
/* Recolor the image based on the sliders' values */
/*Recolor the image based on the sliders' values*/
lv_color_t color = lv_color_make(lv_slider_get_value(red_slider), lv_slider_get_value(green_slider), lv_slider_get_value(blue_slider));
lv_opa_t intense = lv_slider_get_value(intense_slider);
lv_obj_set_style_img_recolor_opa(img1, LV_PART_MAIN, LV_STATE_DEFAULT, intense);
+1 -1
View File
@@ -19,7 +19,7 @@ void lv_example_img_3(void)
{
LV_IMG_DECLARE(img_cogwheel_argb);
/* Now create the actual image */
/*Now create the actual image*/
lv_obj_t * img = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img, &img_cogwheel_argb);
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 50, 50);
@@ -7,7 +7,7 @@ void lv_example_imgbtn_1(void)
LV_IMG_DECLARE(imgbtn_right);
LV_IMG_DECLARE(imgbtn_mid);
/* Create a transition animation on width transformation and recolor.*/
/*Create a transition animation on width transformation and recolor.*/
static lv_style_prop_t tr_prop[] = {LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_IMG_RECOLOR_OPA, 0};
static lv_style_transition_dsc_t tr;
lv_style_transition_dsc_init(&tr, tr_prop, &lv_anim_path_def, 200, 0);
+5 -5
View File
@@ -6,17 +6,17 @@
*/
void lv_example_label_2(void)
{
/* Create a style for the shadow*/
/*Create a style for the shadow*/
static lv_style_t style_shadow;
lv_style_init(&style_shadow);
lv_style_set_text_opa(&style_shadow, LV_OPA_30);
lv_style_set_text_color(&style_shadow, lv_color_black());
/*Create a label for the shadow first (it's in the background) */
/*Create a label for the shadow first (it's in the background)*/
lv_obj_t * shadow_label = lv_label_create(lv_scr_act(), NULL);
lv_obj_add_style(shadow_label, LV_PART_MAIN, LV_STATE_DEFAULT, &style_shadow);
/* Create the main label */
/*Create the main label*/
lv_obj_t * main_label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(main_label, "A simple method to create\n"
"shadows on a text.\n"
@@ -26,10 +26,10 @@ void lv_example_label_2(void)
/*Set the same text for the shadow label*/
lv_label_set_text(shadow_label, lv_label_get_text(main_label));
/* Position the main label */
/*Position the main label*/
lv_obj_align(main_label, NULL, LV_ALIGN_CENTER, 0, 0);
/* Shift the second label down and to the right by 2 pixel */
/*Shift the second label down and to the right by 2 pixel*/
lv_obj_align(shadow_label, main_label, LV_ALIGN_IN_TOP_LEFT, 2, 2);
}
+1 -1
View File
@@ -121,7 +121,7 @@ void lv_example_win_1(void);
**********************/
#ifdef __cplusplus
} /* extern "C" */
} /*extern "C"*/
#endif
#endif /*LV_EX_WIDGETS_H*/
+2 -2
View File
@@ -23,7 +23,7 @@ void lv_example_meter_1(void)
lv_meter_indicator_t * indic;
/*Add a blue arc to the start */
/*Add a blue arc to the start*/
indic = lv_meter_add_arc(meter, scale, 3, lv_color_blue(), 0);
lv_meter_set_indicator_start_value(meter, indic, 0);
lv_meter_set_indicator_end_value(meter, indic, 20);
@@ -33,7 +33,7 @@ void lv_example_meter_1(void)
lv_meter_set_indicator_start_value(meter, indic, 0);
lv_meter_set_indicator_end_value(meter, indic, 20);
/*Add a red arc to the end */
/*Add a red arc to the end*/
indic = lv_meter_add_arc(meter, scale, 3, lv_color_red(), 0);
lv_meter_set_indicator_start_value(meter, indic, 80);
lv_meter_set_indicator_end_value(meter, indic, 100);
+1 -1
View File
@@ -26,7 +26,7 @@ void lv_example_meter_2(void)
lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10);
lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90);
/*Add a three arc indicator */
/*Add a three arc indicator*/
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_color_red(), 0);
lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_color_green(), -10);
lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_color_blue(), -20);
+1 -1
View File
@@ -31,7 +31,7 @@ void lv_example_meter_3(void)
LV_IMG_DECLARE(img_hand)
/*Add a the hands from images */
/*Add a the hands from images*/
lv_meter_indicator_t * indic_min = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5);
lv_meter_indicator_t * indic_hour = lv_meter_add_needle_img(meter, scale_min, &img_hand, 5, 5);
+1 -1
View File
@@ -18,7 +18,7 @@ void lv_example_meter_4(void)
lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, lv_color_black());
lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0);
/*Add a three arc indicator */
/*Add a three arc indicator*/
lv_coord_t indic_w = lv_obj_get_width(meter) / 2;
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, lv_color_orange(), 0);
lv_meter_set_indicator_start_value(meter, indic1, 0);
@@ -9,12 +9,12 @@ static lv_obj_t * slider_label;
*/
void lv_example_slider_1(void)
{
/* Create a slider in the center of the display */
/*Create a slider in the center of the display*/
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_add_event_cb(slider, slider_event_cb, NULL);
/* Create a label below the slider */
/*Create a label below the slider*/
slider_label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(slider_label, "0%");
@@ -19,7 +19,7 @@ void lv_example_slider_2(void)
lv_style_set_content_opa(&style_pr, LV_OPA_COVER);
lv_style_set_content_ofs_y(&style_pr, -15);
/* Create a slider in the center of the display */
/*Create a slider in the center of the display*/
lv_obj_t * slider;
slider = lv_slider_create(lv_scr_act(), NULL);
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
@@ -9,7 +9,7 @@ static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
*/
void lv_example_slider_3(void)
{
/* Create a slider in the center of the display */
/*Create a slider in the center of the display*/
lv_obj_t * slider;
slider = lv_slider_create(lv_scr_act(), NULL);
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0);
+1 -1
View File
@@ -64,7 +64,7 @@ void lv_example_table_2(void)
lv_obj_set_size(table, 150, 200);
lv_table_set_col_width(table, 0, 150);
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value */
lv_table_set_row_cnt(table, ITEM_CNT); /*Not required but avoids a lot of memory reallocation lv_table_set_set_value*/
lv_table_set_col_cnt(table, 1);
/*Don't make the cell pressed, we will draw something different in the event*/
@@ -7,7 +7,7 @@ static lv_obj_t * kb;
void lv_example_textarea_2(void)
{
/* Create the password box */
/*Create the password box*/
lv_obj_t * pwd_ta = lv_textarea_create(lv_scr_act(), NULL);
lv_textarea_set_text(pwd_ta, "");
lv_textarea_set_password_mode(pwd_ta, true);
@@ -16,33 +16,33 @@ void lv_example_textarea_2(void)
lv_obj_set_pos(pwd_ta, 5, 20);
lv_obj_add_event_cb(pwd_ta, ta_event_cb, NULL);
/* Create a label and position it above the text box */
/*Create a label and position it above the text box*/
lv_obj_t * pwd_label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(pwd_label, "Password:");
lv_obj_align(pwd_label, pwd_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
/* Create the one-line mode text area */
/*Create the one-line mode text area*/
lv_obj_t * oneline_ta = lv_textarea_create(lv_scr_act(), pwd_ta);
lv_textarea_set_password_mode(oneline_ta, false);
lv_obj_align(oneline_ta, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 20);
/* Create a label and position it above the text box */
/*Create a label and position it above the text box*/
lv_obj_t * oneline_label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(oneline_label, "Text:");
lv_obj_align(oneline_label, oneline_ta, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
/* Create a keyboard */
/*Create a keyboard*/
kb = lv_keyboard_create(lv_scr_act());
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
lv_keyboard_set_textarea(kb, pwd_ta); /* Focus it on one of the text areas to start */
lv_keyboard_set_textarea(kb, pwd_ta); /*Focus it on one of the text areas to start*/
}
static void ta_event_cb(lv_obj_t * ta, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
/* Focus on the clicked text area */
/*Focus on the clicked text area*/
if(kb != NULL)
lv_keyboard_set_textarea(kb, ta);
}
@@ -11,7 +11,7 @@ static lv_obj_t * kb;
*/
void lv_example_textarea_3(void)
{
/* Create the text area */
/*Create the text area*/
lv_obj_t * ta = lv_textarea_create(lv_scr_act(), NULL);
lv_obj_add_event_cb(ta, ta_event_cb, NULL);
lv_textarea_set_accepted_chars(ta, "0123456789:");
@@ -19,7 +19,7 @@ void lv_example_textarea_3(void)
lv_textarea_set_one_line(ta, true);
lv_textarea_set_text(ta, "");
/* Create a keyboard*/
/*Create a keyboard*/
kb = lv_keyboard_create(lv_scr_act());
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER);