minor fixes

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-14 14:56:34 +01:00
parent 95b1bd8409
commit bb08660cb6
105 changed files with 731 additions and 891 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
#include "../../../lvgl.h"
#if LV_USE_ARC
#if LV_USE_ARC && LV_BUILD_EXAMPLES
void lv_example_arc_1(void)
{
+2 -1
View File
@@ -1,5 +1,6 @@
#include "../../../lvgl.h"
#if LV_USE_ARC
#if LV_USE_ARC && LV_BUILD_EXAMPLES
/**
* An `lv_task` to call periodically to set the angles of the arc
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_BAR
#if LV_USE_BAR && LV_BUILD_EXAMPLES
void lv_example_bar_1(void)
{
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_BAR
#if LV_USE_BAR && LV_BUILD_EXAMPLES
/**
* Example of styling the bar
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_BAR
#if LV_USE_BAR && LV_BUILD_EXAMPLES
static void set_temp(lv_obj_t * bar, int32_t temp)
{
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_BAR
#if LV_USE_BAR && LV_BUILD_EXAMPLES
/**
* Bar with stripe pattern and ranged value
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_BAR
#if LV_USE_BAR && LV_BUILD_EXAMPLES
/**
* Bar with LTR and RTL base direction
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_BAR
#if LV_USE_BAR && LV_BUILD_EXAMPLES
static void event_cb(lv_obj_t * obj, lv_event_t e)
{
+3 -4
View File
@@ -1,14 +1,13 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_BTN
#if LV_USE_BTN && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
LV_LOG_USER("Clicked\n");
}
else if(event == LV_EVENT_VALUE_CHANGED) {
printf("Toggled\n");
LV_LOG_USER("Toggled\n");
}
}
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_BTNMATRIX
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
@@ -8,7 +7,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event)
uint32_t id = lv_btnmatrix_get_active_btn(obj);
const char * txt = lv_btnmatrix_get_btn_text(obj, id);
printf("%s was pressed\n", txt);
LV_LOG_USER("%s was pressed\n", txt);
}
}
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_BTNMATRIX
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES
void event_cb(lv_obj_t * obj, lv_event_t e)
@@ -1,7 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_BTNMATRIX
#if LV_USE_BTNMATRIX && LV_BUILD_EXAMPLES
static void event_cb(lv_obj_t * obj, lv_event_t e)
{
@@ -1,14 +1,12 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_CALENDAR
#if LV_USE_CALENDAR && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
lv_calendar_date_t date;
if(lv_calendar_get_pressed_date(obj, &date)) {
printf("Clicked date: %02d.%02d.%d\n", date.day, date.month, date.year);
LV_LOG_USER("Clicked date: %02d.%02d.%d\n", date.day, date.month, date.year);
}
}
}
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_CANVAS
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
#define CANVAS_WIDTH 200
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_CANVAS
#if LV_USE_CANVAS && LV_BUILD_EXAMPLES
#define CANVAS_WIDTH 50
#define CANVAS_HEIGHT 50
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_CHART
#if LV_USE_CHART && LV_BUILD_EXAMPLES
void lv_example_chart_1(void)
{
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_CHART
#if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES
static lv_obj_t * chart1;
static lv_chart_series_t * ser1;
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_CHART
#if LV_USE_CHART && LV_BUILD_EXAMPLES
static void event_cb(lv_obj_t * chart, lv_event_t e)
{
+2 -2
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_CHART
#if LV_USE_CHART && LV_BUILD_EXAMPLES
static void event_cb(lv_obj_t * chart, lv_event_t e)
@@ -15,7 +15,7 @@ static void event_cb(lv_obj_t * chart, lv_event_t e)
int32_t id = lv_chart_get_pressed_point(chart);
if(id < 0) return;
printf("Selected point %d\n", id);
LV_LOG_USER("Selected point %d\n", id);
lv_chart_series_t * ser = lv_chart_get_series_next(chart, NULL);
while(ser) {
@@ -1,13 +1,12 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_CHECKBOX
#if LV_USE_CHECKBOX && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
const char * txt = lv_checkbox_get_text(obj);
const char * state = lv_obj_get_state(obj) & LV_STATE_CHECKED ? "Checked" : "Unchecked";
printf("%s: %s\n", txt, state);
LV_LOG_USER("%s: %s\n", txt, state);
}
}
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_COLORWHEEL
#if LV_USE_COLORWHEEL && LV_BUILD_EXAMPLES
void lv_example_colorwheel_1(void)
{
@@ -1,14 +1,12 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_DROPDOWN
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
char buf[32];
lv_dropdown_get_selected_str(obj, buf, sizeof(buf));
printf("Option: %s\n", buf);
LV_LOG_USER("Option: %s\n", buf);
}
}
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_DROPDOWN
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES
/**
@@ -1,7 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_DROPDOWN
#if LV_USE_DROPDOWN && LV_BUILD_EXAMPLES
/**
* Create a menu from a drop-down list and show some drop-down list features and styling
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_IMG
#if LV_USE_IMG && LV_BUILD_EXAMPLES
/* Find the image here: https://github.com/lvgl/lv_examples/tree/master/assets */
LV_IMG_DECLARE(img_cogwheel_argb);
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_IMG
#if LV_USE_IMG && LV_BUILD_EXAMPLES
static lv_obj_t * create_slider(lv_color_t color);
static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_IMG
#if LV_USE_IMG && LV_BUILD_EXAMPLES
LV_IMG_DECLARE(img_cogwheel_argb);
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_IMG
#if LV_USE_IMG && LV_BUILD_EXAMPLES
LV_IMG_DECLARE(img_skew_strip);
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_IMGBTN
#if LV_USE_IMGBTN && LV_BUILD_EXAMPLES
void lv_example_imgbtn_1(void)
{
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_KEYBOARD
#if LV_USE_KEYBOARD && LV_BUILD_EXAMPLES
static void ta_event_cb(lv_obj_t * ta, lv_event_t e)
{
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_LABEL
#if LV_USE_LABEL && LV_BUILD_EXAMPLES
/**
* Show line wrap, re-color, line align and text scrolling.
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_LABEL
#if LV_USE_LABEL && LV_BUILD_EXAMPLES
/**
* Create a fake text shadow
+6 -2
View File
@@ -1,6 +1,9 @@
#include "../../../lvgl.h"
#if LV_USE_LED
#if LV_USE_LED && LV_BUILD_EXAMPLES
/**
* Create LED's with different brightness and color
*/
void lv_example_led_1(void)
{
/*Create a LED and switch it OFF*/
@@ -11,7 +14,8 @@ void lv_example_led_1(void)
/*Copy the previous LED and set a brightness*/
lv_obj_t * led2 = lv_led_create(lv_scr_act());
lv_obj_align(led2, NULL, LV_ALIGN_CENTER, 0, 0);
lv_led_set_bright(led2, 150);
lv_led_set_brightness(led2, 150);
lv_led_set_color(led2, LV_COLOR_RED);
/*Copy the previous LED and switch it ON*/
lv_obj_t * led3 = lv_led_create(lv_scr_act());
+1 -1
View File
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_LINE
#if LV_USE_LINE && LV_BUILD_EXAMPLES
void lv_example_line_1(void)
{
+2 -3
View File
@@ -1,11 +1,10 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_LIST
#if LV_USE_LIST && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
printf("Clicked: %s\n", lv_list_get_btn_text(obj));
LV_LOG_USER("Clicked: %s\n", lv_list_get_btn_text(obj));
}
}
void lv_list_example_1(void)
+1 -2
View File
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_METER
#if LV_USE_METER && LV_BUILD_EXAMPLES
static lv_obj_t * meter;
+1 -2
View File
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_METER
#if LV_USE_METER && LV_BUILD_EXAMPLES
static lv_obj_t * meter;
+1 -2
View File
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_METER
#if LV_USE_METER && LV_BUILD_EXAMPLES
static lv_obj_t * meter;
+1 -2
View File
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_METER
#if LV_USE_METER && LV_BUILD_EXAMPLES
/**
* Create a pie chart
@@ -1,11 +1,10 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_MSGBOX
#if LV_USE_MSGBOX && LV_BUILD_EXAMPLES
static void event_cb(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
printf("Button: %s\n", lv_msgbox_get_active_btn_text(obj));
LV_LOG_USER("Button: %s\n", lv_msgbox_get_active_btn_text(obj));
}
}
@@ -1,94 +0,0 @@
//#include "../../../lvgl.h"
//#if LV_USE_MSGBOX
//
//static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt);
//static void btn_event_cb(lv_obj_t *btn, lv_event_t evt);
//static void opa_anim(void * bg, lv_anim_value_t v);
//
//static lv_obj_t *mbox, *info;
//static lv_style_t style_modal;
//
//static const char welcome_info[] = "Welcome to the modal message box demo!\n"
// "Press the button to display a message box.";
//
//static const char in_msg_info[] = "Notice that you cannot touch "
// "the button again while the message box is open.";
//
//void lv_example_msgbox_2(void)
//{
// lv_style_init(&style_modal);
// lv_style_set_bg_color(&style_modal, LV_STATE_DEFAULT, LV_COLOR_BLACK);
//
// /* Create a button, then set its position and event callback */
// lv_obj_t *btn = lv_btn_create(lv_scr_act(), NULL);
// lv_obj_set_size(btn, 200, 60);
// lv_obj_set_event_cb(btn, btn_event_cb);
// lv_obj_align(btn, NULL, LV_ALIGN_IN_TOP_LEFT, 20, 20);
//
// /* Create a label on the button */
// lv_obj_t *label = lv_label_create(btn, NULL);
// lv_label_set_text(label, "Display a message box!");
//
// /* Create an informative label on the screen */
// info = lv_label_create(lv_scr_act(), NULL);
// lv_label_set_text(info, welcome_info);
// lv_label_set_long_mode(info, LV_LABEL_LONG_BREAK); /* Make sure text will wrap */
// lv_obj_set_width(info, LV_HOR_RES - 10);
// lv_obj_align(info, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 5, -5);
//
//}
//
//static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt)
//{
// if(evt == LV_EVENT_DELETE && obj == mbox) {
// /* Delete the parent modal background */
// lv_obj_del_async(lv_obj_get_parent(mbox));
// mbox = NULL; /* happens before object is actually deleted! */
// lv_label_set_text(info, welcome_info);
// } else if(evt == LV_EVENT_VALUE_CHANGED) {
// /* A button was clicked */
// lv_msgbox_start_auto_close(mbox, 0);
// }
//}
//
//static void btn_event_cb(lv_obj_t *btn, lv_event_t evt)
//{
// if(evt == LV_EVENT_CLICKED) {
// /* Create a full-screen background */
//
// /* Create a base object for the modal background */
// lv_obj_t *obj = lv_obj_create(lv_scr_act(), NULL);
// lv_obj_reset_style_list(obj, LV_OBJ_PART_MAIN);
// lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &style_modal);
// lv_obj_set_pos(obj, 0, 0);
// lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES);
//
// static const char * btns2[] = {"Ok", "Cancel", ""};
//
// /* Create the message box as a child of the modal background */
// mbox = lv_msgbox_create(obj, NULL);
// lv_msgbox_add_btns(mbox, btns2);
// lv_msgbox_set_text(mbox, "Hello world!");
// lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
// lv_obj_set_event_cb(mbox, mbox_event_cb);
//
// /* Fade the message box in with an animation */
// lv_anim_t a;
// lv_anim_init(&a);
// lv_anim_set_var(&a, obj);
// lv_anim_set_time(&a, 500);
// lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_50);
// lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)opa_anim);
// lv_anim_start(&a);
//
// lv_label_set_text(info, in_msg_info);
// lv_obj_align(info, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 5, -5);
// }
//}
//
//static void opa_anim(void * bg, lv_anim_value_t v)
//{
// lv_obj_set_style_local_bg_opa(bg, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
//}
//
//#endif
+22 -21
View File
@@ -1,21 +1,22 @@
//#include "../../../lvgl.h"
//
//void lv_example_obj_1(void)
//{
// lv_obj_t * obj1;
// obj1 = lv_obj_create(lv_scr_act(), NULL);
// lv_obj_set_size(obj1, 100, 50);
// lv_obj_align(obj1, NULL, LV_ALIGN_CENTER, -60, -30);
//
// static lv_style_t style_shadow;
// lv_style_init(&style_shadow);
// lv_style_set_shadow_width(&style_shadow, LV_STATE_DEFAULT, 10);
// lv_style_set_shadow_spread(&style_shadow, LV_STATE_DEFAULT, 5);
// lv_style_set_shadow_color(&style_shadow, LV_STATE_DEFAULT, LV_COLOR_BLUE);
//
// /*Copy the previous object (drag is already enabled)*/
// lv_obj_t * obj3;
// obj3 = lv_obj_create(lv_scr_act(), NULL);
// lv_obj_add_style(obj3, LV_OBJ_PART_MAIN, &style_shadow);
// lv_obj_align(obj3, NULL, LV_ALIGN_CENTER, 60, 30);
//}
#include "../../../lvgl.h"
#if LV_BUILD_EXAMPLES
void lv_example_obj_1(void)
{
lv_obj_t * obj1;
obj1 = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_size(obj1, 100, 50);
lv_obj_align(obj1, NULL, LV_ALIGN_CENTER, -60, -30);
static lv_style_t style_shadow;
lv_style_init(&style_shadow);
lv_style_set_shadow_width(&style_shadow, 10);
lv_style_set_shadow_spread(&style_shadow, 5);
lv_style_set_shadow_color(&style_shadow, LV_COLOR_BLUE);
lv_obj_t * obj3;
obj3 = lv_obj_create(lv_scr_act(), NULL);
lv_obj_add_style(obj3, LV_PART_MAIN, LV_STATE_DEFAULT, &style_shadow);
lv_obj_align(obj3, NULL, LV_ALIGN_CENTER, 60, 30);
}
#endif
@@ -1,13 +1,12 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_ROLLER
#if LV_USE_ROLLER && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
char buf[32];
lv_roller_get_selected_str(obj, buf, sizeof(buf));
printf("Selected month: %s\n", buf);
LV_LOG_USER("Selected month: %s\n", buf);
}
}
@@ -1,13 +1,12 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_ROLLER
#if LV_USE_ROLLER && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
char buf[32];
lv_roller_get_selected_str(obj, buf, sizeof(buf));
printf("Selected value: %s\n", buf);
LV_LOG_USER("Selected value: %s\n", buf);
}
}
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_SLIDER
#if LV_USE_SLIDER && LV_BUILD_EXAMPLES
static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
static lv_obj_t * slider_label;
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_SLIDER
#if LV_USE_SLIDER && LV_BUILD_EXAMPLES
static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_SLIDER
#if LV_USE_SLIDER && LV_BUILD_EXAMPLES
static void slider_event_cb(lv_obj_t * slider, lv_event_t event);
@@ -1,6 +1,5 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_SPINBOX
#if LV_USE_SPINBOX && LV_BUILD_EXAMPLES
static lv_obj_t * spinbox;
@@ -1,5 +1,5 @@
#include "../../../lvgl.h"
#if LV_USE_SPINNER
#if LV_USE_SPINNER && LV_BUILD_EXAMPLES
void lv_example_spinner_1(void)
{
@@ -1,11 +1,10 @@
#include "../../../lvgl.h"
#include <stdio.h>
#if LV_USE_SWITCH
#if LV_USE_SWITCH && LV_BUILD_EXAMPLES
static void event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
printf("State: %s\n", lv_obj_has_state(obj, LV_STATE_CHECKED) ? "On" : "Off");
LV_LOG_USER("State: %s\n", lv_obj_has_state(obj, LV_STATE_CHECKED) ? "On" : "Off");
}
}

Some files were not shown because too many files have changed in this diff Show More