Merge branch 'beta'

This commit is contained in:
Gabor Kiss-Vamosi
2018-01-19 15:45:58 +01:00
24 changed files with 182 additions and 63 deletions

View File

@@ -52,12 +52,12 @@
/* Enable anti-aliasing /* Enable anti-aliasing
* If enabled everything will be rendered in double size and filtered to normal size. * If enabled everything will be rendered in double size and filtered to normal size.
* Fonts and Images will be downscaled */ * Fonts and Images will be downscaled */
#define LV_ANTIALIAS 1 /*1: Enable anti-aliasing*/ #define LV_ANTIALIAS 0 /*1: Enable anti-aliasing*/
/* Enable anti-aliasing only for fonts (texts) /* Enable anti-aliasing only for fonts (texts)
* It downscales the fonts to half size so you should use double sized fonts * It downscales the fonts to half size so you should use double sized fonts
* Much faster then normal anti-aliasing */ * Much faster then normal anti-aliasing */
#define LV_FONT_ANTIALIAS 0 /*1: Enable font anti-aliasing*/ #define LV_FONT_ANTIALIAS 1 /*1: Enable font anti-aliasing*/
/*Screen refresh settings*/ /*Screen refresh settings*/
#define LV_REFR_PERIOD 50 /*Screen refresh period in milliseconds*/ #define LV_REFR_PERIOD 50 /*Screen refresh period in milliseconds*/
@@ -90,6 +90,10 @@
#define USE_LV_GPU 1 /*1: Enable GPU interface*/ #define USE_LV_GPU 1 /*1: Enable GPU interface*/
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/ #define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/
/*Compiler attributes*/
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment function */
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to task handler function */
/*================ /*================
* THEME USAGE * THEME USAGE
*================*/ *================*/
@@ -135,10 +139,10 @@
#define USE_LV_FONT_SYMBOL_30_FEEDBACK 0 #define USE_LV_FONT_SYMBOL_30_FEEDBACK 0
#define USE_LV_FONT_DEJAVU_40 1 #define USE_LV_FONT_DEJAVU_40 1
#define USE_LV_FONT_DEJAVU_40_SUP 1 #define USE_LV_FONT_DEJAVU_40_SUP 0
#define USE_LV_FONT_DEJAVU_40_LATIN_EXT_A 1 #define USE_LV_FONT_DEJAVU_40_LATIN_EXT_A 0
#define USE_LV_FONT_DEJAVU_40_LATIN_EXT_B 1 #define USE_LV_FONT_DEJAVU_40_LATIN_EXT_B 0
#define USE_LV_FONT_DEJAVU_40_CYRILLIC 1 #define USE_LV_FONT_DEJAVU_40_CYRILLIC 0
#define USE_LV_FONT_SYMBOL_40_BASIC 1 #define USE_LV_FONT_SYMBOL_40_BASIC 1
#define USE_LV_FONT_SYMBOL_40_FILE 1 #define USE_LV_FONT_SYMBOL_40_FILE 1
#define USE_LV_FONT_SYMBOL_40_FEEDBACK 1 #define USE_LV_FONT_SYMBOL_40_FEEDBACK 1
@@ -184,7 +188,7 @@
#define LV_LABEL_SCROLL_SPEED 25 /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/ #define LV_LABEL_SCROLL_SPEED 25 /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL/ROLL' mode*/
#endif #endif
/*Image (dependencies: lv_label*/ /*Image (dependencies: lv_label, lv_filesystem*/
#define USE_LV_IMG 1 #define USE_LV_IMG 1
/*Line (dependencies: -*/ /*Line (dependencies: -*/
@@ -200,10 +204,10 @@
/*Page (dependencies: lv_cont)*/ /*Page (dependencies: lv_cont)*/
#define USE_LV_PAGE 1 #define USE_LV_PAGE 1
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ /*Window (dependencies: lv_btn, lv_label, lv_img, lv_page)*/
#define USE_LV_WIN 1 #define USE_LV_WIN 1
/*Tab (dependencies: lv_page, lv_btnm)*/ /*Tab view (dependencies: lv_page, lv_btnm)*/
#define USE_LV_TABVIEW 1 #define USE_LV_TABVIEW 1
#if USE_LV_TABVIEW != 0 #if USE_LV_TABVIEW != 0
#define LV_TABVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/ #define LV_TABVIEW_ANIM_TIME 300 /*Time of slide animation [ms] (0: no animation)*/
@@ -216,7 +220,7 @@
/*Bar (dependencies: -)*/ /*Bar (dependencies: -)*/
#define USE_LV_BAR 1 #define USE_LV_BAR 1
/*Line meter (dependencies: *;)*/ /*Line meter (dependencies: - )*/
#define USE_LV_LMETER 1 #define USE_LV_LMETER 1
/*Gauge (dependencies:bar, lmeter)*/ /*Gauge (dependencies:bar, lmeter)*/
@@ -228,7 +232,7 @@
/*LED (dependencies: -)*/ /*LED (dependencies: -)*/
#define USE_LV_LED 1 #define USE_LV_LED 1
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ /*Message box (dependencies: lv_cont, lv_btnm, lv_label)*/
#define USE_LV_MBOX 1 #define USE_LV_MBOX 1
/*Text area (dependencies: lv_label, lv_page)*/ /*Text area (dependencies: lv_label, lv_page)*/
@@ -248,7 +252,7 @@
/*Button matrix (dependencies: -)*/ /*Button matrix (dependencies: -)*/
#define USE_LV_BTNM 1 #define USE_LV_BTNM 1
/*Keyboard (dependencies: lv_btnm)*/ /*Keyboard (dependencies: lv_btnm, lv_ta)*/
#define USE_LV_KB 1 #define USE_LV_KB 1
/*Check box (dependencies: lv_btn, lv_label)*/ /*Check box (dependencies: lv_btn, lv_label)*/

View File

@@ -51,6 +51,16 @@ lv_group_t * lv_group_create(void)
return group; return group;
} }
/**
* Delete a group object
* @param group pointer to a group
*/
void lv_group_del(lv_group_t * group)
{
lv_ll_clear(&(group->obj_ll));
lv_mem_free(group);
}
/** /**
* Add an object to a group * Add an object to a group
* @param group pointer to a group * @param group pointer to a group
@@ -83,8 +93,8 @@ void lv_group_remove_obj(lv_obj_t * obj)
LL_READ(g->obj_ll, i) { LL_READ(g->obj_ll, i) {
if(*i == obj) { if(*i == obj) {
lv_ll_rem(&g->obj_ll, i); lv_ll_rem(&g->obj_ll, i);
lv_mem_free(i);
obj->group_p = NULL; obj->group_p = NULL;
break;
} }
} }

View File

@@ -27,6 +27,8 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
#if LV_INDEV_READ_PERIOD != 0
static void indev_proc_task(void * param); static void indev_proc_task(void * param);
static void indev_proc_point(lv_indev_proc_t * indev); static void indev_proc_point(lv_indev_proc_t * indev);
static void indev_proc_press(lv_indev_proc_t * info); static void indev_proc_press(lv_indev_proc_t * info);
@@ -34,11 +36,11 @@ static void indev_proc_release(lv_indev_proc_t * state);
static lv_obj_t * indev_search_obj(const lv_indev_proc_t * indev, lv_obj_t * obj); static lv_obj_t * indev_search_obj(const lv_indev_proc_t * indev, lv_obj_t * obj);
static void indev_drag(lv_indev_proc_t * state); static void indev_drag(lv_indev_proc_t * state);
static void indev_drag_throw(lv_indev_proc_t * state); static void indev_drag_throw(lv_indev_proc_t * state);
#endif
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_task_t *indev_proc_task_p;
static lv_indev_t *indev_act; static lv_indev_t *indev_act;
/********************** /**********************
@@ -55,9 +57,7 @@ static lv_indev_t *indev_act;
void lv_indev_init(void) void lv_indev_init(void)
{ {
#if LV_INDEV_READ_PERIOD != 0 #if LV_INDEV_READ_PERIOD != 0
indev_proc_task_p = lv_task_create(indev_proc_task, LV_INDEV_READ_PERIOD, LV_TASK_PRIO_MID, NULL); lv_task_create(indev_proc_task, LV_INDEV_READ_PERIOD, LV_TASK_PRIO_MID, NULL);
#else
indev_proc_task_p = lv_task_create(indev_proc_task, 1, LV_TASK_PRIO_OFF); /*Not use lv_indev_proc*/
#endif #endif
lv_indev_reset(NULL); /*Reset all input devices*/ lv_indev_reset(NULL); /*Reset all input devices*/
@@ -208,6 +208,7 @@ void lv_indev_wait_release(lv_indev_t * indev)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
#if LV_INDEV_READ_PERIOD != 0
/** /**
* Called periodically to handle the input devices * Called periodically to handle the input devices
* @param param unused * @param param unused
@@ -622,3 +623,4 @@ static void indev_drag_throw(lv_indev_proc_t * state)
drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_END, indev_act); drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
} }
} }
#endif

View File

@@ -1202,7 +1202,17 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
while(par) { while(par) {
if(par->style_p) { if(par->style_p) {
if(par->style_p->glass == 0) { if(par->style_p->glass == 0) {
#if USE_LV_GROUP == 0
style_act = par->style_p; style_act = par->style_p;
#else
/*Is a parent is focused then use then focused style*/
lv_group_t *g = lv_obj_get_group(par);
if(lv_group_get_focused(g) == par) {
style_act = lv_group_mod_style(g, par->style_p);
} else {
style_act = par->style_p;
}
#endif
break; break;
} }
} }

View File

@@ -45,7 +45,7 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma
static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style);
static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style);
static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style);
#if USE_LV_SHADOW #if USE_LV_SHADOW && LV_VDB_SIZE
static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style);
static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style);
static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style); static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style);
@@ -62,12 +62,18 @@ static void point_swap(lv_point_t * p1, lv_point_t * p2);
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
#if LV_VDB_SIZE != 0 #if LV_VDB_SIZE != 0
#if USE_LV_SHADOW
static void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vpx; static void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vpx;
#endif
static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vfill; static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vfill;
static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter; static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter;
#if USE_LV_IMG
static void (*map_fp)(const lv_area_t * coords, const lv_area_t * mask, const lv_color_t * map_p, lv_opa_t opa, bool transp, bool upscale, lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap; static void (*map_fp)(const lv_area_t * coords, const lv_area_t * mask, const lv_color_t * map_p, lv_opa_t opa, bool transp, bool upscale, lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap;
#endif
#else #else
static void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rpx; /* px_fp used only by shadow drawing the shadows are not drawn with out VDB
* static void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rpx;
*/
static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rfill; static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rfill;
static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter; static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter;
#if USE_LV_IMG #if USE_LV_IMG

View File

@@ -8,6 +8,7 @@
*********************/ *********************/
#include "lv_hal_tick.h" #include "lv_hal_tick.h"
#include <stddef.h> #include <stddef.h>
#include "../../lv_conf.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -39,7 +40,7 @@ static volatile uint8_t tick_irq_flag;
* You have to call this function periodically * You have to call this function periodically
* @param tick_period the call period of this function in milliseconds * @param tick_period the call period of this function in milliseconds
*/ */
void lv_tick_inc(uint32_t tick_period) inline void LV_ATTRIBUTE_TICK_INC lv_tick_inc(uint32_t tick_period)
{ {
tick_irq_flag = 0; tick_irq_flag = 0;
sys_time += tick_period; sys_time += tick_period;

View File

@@ -19,6 +19,9 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#ifndef LV_ATTRIBUTE_TICK_INC
#define LV_ATTRIBUTE_TICK_INC
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS

View File

@@ -147,17 +147,17 @@ static inline uint8_t lv_color_to1(lv_color_t color)
#if LV_COLOR_DEPTH == 1 #if LV_COLOR_DEPTH == 1
return color.full; return color.full;
#elif LV_COLOR_DEPTH == 8 #elif LV_COLOR_DEPTH == 8
if((color.red & 0b100) || if((color.red & 0x4) ||
(color.green & 0b100) || (color.green & 0x4) ||
(color.blue & 0b10)) { (color.blue & 0x2)) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
#elif LV_COLOR_DEPTH == 16 #elif LV_COLOR_DEPTH == 16
if((color.red & 0b10000) || if((color.red & 0x10) ||
(color.green & 0b100000) || (color.green & 0x20) ||
(color.blue & 0b10000)) { (color.blue & 0x10)) {
return 1; return 1;
} else { } else {
return 0; return 0;
@@ -261,6 +261,9 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
return (uint16_t) bright >> 3; return (uint16_t) bright >> 3;
} }
/* The most simple macro to create a color from R,G and B values
* The order of bit field is different on Big-endian and Little-endian machines*/
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#if LV_COLOR_DEPTH == 1 #if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)}) #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(b8 >> 7 | g8 >> 7 | r8 >> 7)})
#elif LV_COLOR_DEPTH == 8 #elif LV_COLOR_DEPTH == 8
@@ -270,6 +273,17 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
#elif LV_COLOR_DEPTH == 24 #elif LV_COLOR_DEPTH == 24
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8}}) #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8}})
#endif #endif
#else
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){(r8 >> 7 | g8 >> 7 | b8 >> 7)})
#elif LV_COLOR_DEPTH == 8
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 6, g8 >> 5, b8 >> 5}})
#elif LV_COLOR_DEPTH == 16
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8 >> 3, g8 >> 2, b8 >> 3}})
#elif LV_COLOR_DEPTH == 24
#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{r8, g8, b8}})
#endif
#endif
#define LV_COLOR_HEX(c) LV_COLOR_MAKE(((uint32_t)((uint32_t)c >> 16) & 0xFF), \ #define LV_COLOR_HEX(c) LV_COLOR_MAKE(((uint32_t)((uint32_t)c >> 16) & 0xFF), \
((uint32_t)((uint32_t)c >> 8) & 0xFF), \ ((uint32_t)((uint32_t)c >> 8) & 0xFF), \

View File

@@ -52,8 +52,8 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t n_size)
ll_p->head = NULL; ll_p->head = NULL;
ll_p->tail = NULL; ll_p->tail = NULL;
if(n_size & 0b11) { if(n_size & 0x3) { /*Round up to 4*/
n_size &= ~0b11; n_size &= ~0x3;
n_size += 4; n_size += 4;
} }

View File

@@ -10,6 +10,7 @@
#include <stddef.h> #include <stddef.h>
#include "lv_task.h" #include "lv_task.h"
#include "../lv_hal/lv_hal_tick.h" #include "../lv_hal/lv_hal_tick.h"
#include "../../lv_conf.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -54,7 +55,7 @@ void lv_task_init(void)
/** /**
* Call it periodically to handle lv_tasks. * Call it periodically to handle lv_tasks.
*/ */
void lv_task_handler(void) inline void LV_ATTRIBUTE_TASK_HANDLER lv_task_handler(void)
{ {
static uint32_t idle_period_start = 0; static uint32_t idle_period_start = 0;
static uint32_t handler_start = 0; static uint32_t handler_start = 0;

View File

@@ -22,7 +22,9 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#ifndef LV_ATTRIBUTE_TASK_HANDLER
#define LV_ATTRIBUTE_TASK_HANDLER
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/

View File

@@ -302,10 +302,10 @@ void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
*/ */
uint8_t lv_txt_utf8_size(uint8_t c) uint8_t lv_txt_utf8_size(uint8_t c)
{ {
if((c & 0b10000000) == 0) return 1; if((c & 0x80) == 0) return 1;
else if((c & 0b11100000) == 0b11000000) return 2; else if((c & 0xE0) == 0xC0) return 2;
else if((c & 0b11110000) == 0b11100000) return 3; else if((c & 0xF0) == 0xE0) return 3;
else if((c & 0b11111000) == 0b11110000) return 4; else if((c & 0xF1) == 0xF0) return 4;
return 0; return 0;
} }
@@ -381,41 +381,41 @@ uint32_t lv_txt_utf8_next(const char * txt, uint32_t * i)
/*Real UTF-8 decode*/ /*Real UTF-8 decode*/
else { else {
/*2 bytes UTF-8 code*/ /*2 bytes UTF-8 code*/
if((txt[*i] & 0b11100000) == 0b11000000) { if((txt[*i] & 0xE0) == 0xC0) {
result = (uint32_t)(txt[*i] & 0b00011111) << 6; result = (uint32_t)(txt[*i] & 0x1F) << 6;
(*i)++; (*i)++;
if((txt[*i] & 0b11000000) != 0b10000000) return 0; /*Invalid UTF-8 code*/ if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/
result += (txt[*i] & 0b00111111); result += (txt[*i] & 0x3F);
(*i)++; (*i)++;
} }
/*3 bytes UTF-8 code*/ /*3 bytes UTF-8 code*/
else if((txt[*i] & 0b11110000) == 0b11100000) { else if((txt[*i] & 0xF0) == 0xE0) {
result = (uint32_t)(txt[*i] & 0b00001111) << 12; result = (uint32_t)(txt[*i] & 0x0F) << 12;
(*i)++; (*i)++;
if((txt[*i] & 0b11000000) != 0b10000000) return 0; /*Invalid UTF-8 code*/ if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/
result += (uint32_t)(txt[*i] & 0b00111111) << 6; result += (uint32_t)(txt[*i] & 0x3F) << 6;
(*i)++; (*i)++;
if((txt[*i] & 0b11000000) != 0b10000000) return 0; /*Invalid UTF-8 code*/ if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/
result += (txt[*i] & 0b00111111); result += (txt[*i] & 0x3F);
(*i)++; (*i)++;
} }
/*3 bytes UTF-8 code*/ /*4 bytes UTF-8 code*/
else if((txt[*i] & 0b11111000) == 0b11110000) { else if((txt[*i] & 0xF8) == 0xF0) {
result = (uint32_t)(txt[*i] & 0b00001111) << 18; result = (uint32_t)(txt[*i] & 0x07) << 18;
(*i)++; (*i)++;
if((txt[*i] & 0b11000000) != 0b10000000) return 0; /*Invalid UTF-8 code*/ if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/
result += (uint32_t)(txt[*i] & 0b00111111) << 12; result += (uint32_t)(txt[*i] & 0x3F) << 12;
(*i)++; (*i)++;
if((txt[*i] & 0b11000000) != 0b10000000) return 0; /*Invalid UTF-8 code*/ if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/
result += (uint32_t)(txt[*i] & 0b00111111) << 6; result += (uint32_t)(txt[*i] & 0x3F) << 6;
(*i)++; (*i)++;
if((txt[*i] & 0b11000000) != 0b10000000) return 0; /*Invalid UTF-8 code*/ if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/
result += (uint32_t)(txt[*i] & 0b00111111) << 6; result += (uint32_t)(txt[*i] & 0x3F) << 6;
(*i)++; (*i)++;
} else { } else {
(*i)++; /*Not UTF-8 char. Go the next.*/ (*i)++; /*Not UTF-8 char. Go the next.*/

View File

@@ -7,8 +7,9 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../lv_conf.h"
#include "lv_ufs.h" #include "lv_ufs.h"
#if USE_LV_FILESYSTEM
#include "lv_ll.h" #include "lv_ll.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@@ -196,6 +197,7 @@ lv_fs_res_t lv_ufs_close (void * file_p)
lv_fs_res_t lv_ufs_remove(const char * fn) lv_fs_res_t lv_ufs_remove(const char * fn)
{ {
lv_ufs_ent_t* ent = lv_ufs_ent_get(fn); lv_ufs_ent_t* ent = lv_ufs_ent_get(fn);
if(ent == NULL) return LV_FS_RES_DENIED; /*File not exists*/
/*Can not be deleted is opened*/ /*Can not be deleted is opened*/
if(ent->oc != 0) return LV_FS_RES_DENIED; if(ent->oc != 0) return LV_FS_RES_DENIED;
@@ -500,3 +502,5 @@ static lv_ufs_ent_t* lv_ufs_ent_new(const char * fn)
return new_ent; return new_ent;
} }
#endif /*USE_LV_FILESYSTEM*/

View File

@@ -15,6 +15,10 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../lv_conf.h"
#if USE_LV_FILESYSTEM
#include <stdbool.h> #include <stdbool.h>
#include "lv_fs.h" #include "lv_fs.h"
#include "lv_mem.h" #include "lv_mem.h"
@@ -197,6 +201,8 @@ lv_fs_res_t lv_ufs_free (uint32_t * total_p, uint32_t * free_p);
* MACROS * MACROS
**********************/ **********************/
#endif /*USE_LV_FILESYSTEM*/
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View File

@@ -9,6 +9,15 @@
#include "../../lv_conf.h" #include "../../lv_conf.h"
#if USE_LV_IMG != 0 #if USE_LV_IMG != 0
/*Testing of dependencies*/
#if USE_LV_LABEL == 0
#error "lv_img: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
#endif
#if USE_LV_FILESYSTEM == 0
#error "lv_img: lv_fs is required. Enable it in lv_conf.h (USE_LV_FILESYSTEM 1) "
#endif
#include "lv_img.h" #include "lv_img.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -16,6 +16,15 @@ extern "C" {
#include "../../lv_conf.h" #include "../../lv_conf.h"
#if USE_LV_KB != 0 #if USE_LV_KB != 0
/*Testing of dependencies*/
#if USE_LV_BTNM == 0
#error "lv_kb: lv_btnm is required. Enable it in lv_conf.h (USE_LV_BTNM 1) "
#endif
#if USE_LV_TA == 0
#error "lv_kb: lv_ta is required. Enable it in lv_conf.h (USE_LV_TA 1) "
#endif
#include "../lv_core/lv_obj.h" #include "../lv_core/lv_obj.h"
#include "lv_btnm.h" #include "lv_btnm.h"

View File

@@ -44,7 +44,9 @@ static void refr_btn_width(lv_obj_t *list);
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_signal_func_t btn_signal; static lv_signal_func_t btn_signal;
#if USE_LV_IMG
static lv_signal_func_t img_signal; static lv_signal_func_t img_signal;
#endif
static lv_signal_func_t label_signal; static lv_signal_func_t label_signal;
static lv_signal_func_t ancestor_signal; static lv_signal_func_t ancestor_signal;
@@ -110,8 +112,10 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t *new_btn; lv_obj_t *new_btn;
while(copy_btn) { while(copy_btn) {
new_btn = lv_btn_create(new_list, copy_btn); new_btn = lv_btn_create(new_list, copy_btn);
#if USE_LV_IMG
lv_obj_t *copy_img = lv_list_get_btn_img(copy_btn); lv_obj_t *copy_img = lv_list_get_btn_img(copy_btn);
if(copy_img) lv_img_create(new_btn, copy_img); if(copy_img) lv_img_create(new_btn, copy_img);
#endif
lv_label_create(new_btn, lv_list_get_btn_label(copy_btn)); lv_label_create(new_btn, lv_list_get_btn_label(copy_btn));
copy_btn = lv_obj_get_child_back(lv_page_get_scrl(copy), copy_btn); copy_btn = lv_obj_get_child_back(lv_page_get_scrl(copy), copy_btn);
} }
@@ -527,14 +531,14 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
lv_list_ext_t *ext = lv_obj_get_ext_attr(list); lv_list_ext_t *ext = lv_obj_get_ext_attr(list);
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
while(btn != NULL) { while(btn != NULL) {
if(lv_btn_get_state(btn) == LV_BTN_STATE_PR) break; if(lv_btn_get_state(btn) == LV_BTN_STATE_TGL_REL) break;
btn_prev = btn; btn_prev = btn;
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
} }
if(btn_prev != NULL && btn != NULL) { if(btn_prev != NULL && btn != NULL) {
lv_btn_set_state(btn, LV_BTN_STATE_REL); lv_btn_set_state(btn, LV_BTN_STATE_REL);
lv_btn_set_state(btn_prev, LV_BTN_STATE_PR); lv_btn_set_state(btn_prev, LV_BTN_STATE_TGL_REL);
lv_page_focus(list, btn_prev, ext->anim_time); lv_page_focus(list, btn_prev, ext->anim_time);
} }
} }
@@ -544,7 +548,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
lv_list_ext_t *ext = lv_obj_get_ext_attr(list); lv_list_ext_t *ext = lv_obj_get_ext_attr(list);
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
while(btn != NULL) { while(btn != NULL) {
if(lv_btn_get_state(btn) == LV_BTN_STATE_PR) break; if(lv_btn_get_state(btn) == LV_BTN_STATE_TGL_REL) break;
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
} }
@@ -552,7 +556,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
lv_obj_t * btn_prev = get_next_btn(list, btn); lv_obj_t * btn_prev = get_next_btn(list, btn);
if(btn_prev != NULL) { if(btn_prev != NULL) {
lv_btn_set_state(btn, LV_BTN_STATE_REL); lv_btn_set_state(btn, LV_BTN_STATE_REL);
lv_btn_set_state(btn_prev, LV_BTN_STATE_PR); lv_btn_set_state(btn_prev, LV_BTN_STATE_TGL_REL);
lv_page_focus(list, btn_prev, ext->anim_time); lv_page_focus(list, btn_prev, ext->anim_time);
} }
} }
@@ -561,7 +565,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
lv_obj_t * btn = NULL; lv_obj_t * btn = NULL;
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
while(btn != NULL) { while(btn != NULL) {
if(lv_btn_get_state(btn) == LV_BTN_STATE_PR) break; if(lv_btn_get_state(btn) == LV_BTN_STATE_TGL_REL) break;
btn = get_next_btn(list, btn); btn = get_next_btn(list, btn);
} }

View File

@@ -198,9 +198,9 @@ void lv_mbox_set_anim_time(lv_obj_t * mbox, uint16_t time)
*/ */
void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay) void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
{ {
#if USE_LV_ANIMATION
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox); lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
#if USE_LV_ANIMATION
if(ext->anim_time != 0) { if(ext->anim_time != 0) {
/*Add shrinking animations*/ /*Add shrinking animations*/
lv_obj_animate(mbox, LV_ANIM_GROW_H| LV_ANIM_OUT, ext->anim_time, delay, NULL); lv_obj_animate(mbox, LV_ANIM_GROW_H| LV_ANIM_OUT, ext->anim_time, delay, NULL);

View File

@@ -351,6 +351,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
if(id < 0) id = 0; if(id < 0) id = 0;
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1; if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
ext->ddlist.sel_opt_id = id; ext->ddlist.sel_opt_id = id;
if(ext->ddlist.action) ext->ddlist.action(roller);
} }
else if(sign == LV_SIGNAL_RELEASED) { else if(sign == LV_SIGNAL_RELEASED) {
/*If picked an option by clicking then set it*/ /*If picked an option by clicking then set it*/
@@ -362,6 +363,7 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign,
if(id < 0) id = 0; if(id < 0) id = 0;
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1; if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
ext->ddlist.sel_opt_id = id; ext->ddlist.sel_opt_id = id;
if(ext->ddlist.action) ext->ddlist.action(roller);
} }
} }

View File

@@ -16,6 +16,11 @@ extern "C" {
#include "../../lv_conf.h" #include "../../lv_conf.h"
#if USE_LV_ROLLER != 0 #if USE_LV_ROLLER != 0
/*Testing of dependencies*/
#if USE_LV_DDLIST == 0
#error "lv_roller: lv_ddlist is required. Enable it in lv_conf.h (USE_LV_DDLIST 1) "
#endif
#include "../lv_core/lv_obj.h" #include "../lv_core/lv_obj.h"
#include "lv_ddlist.h" #include "lv_ddlist.h"
@@ -71,6 +76,17 @@ static inline void lv_roller_set_options(lv_obj_t * roller, const char * options
*/ */
void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en); void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en);
/**
* Set a function to call when a new option is chosen
* @param roller pointer to a roller
* @param action pointer to a callback function
*/
static inline void lv_roller_set_action(lv_obj_t * roller, lv_action_t action)
{
lv_ddlist_set_action(roller, action);
}
/** /**
* Set the height to show the given number of rows (options) * Set the height to show the given number of rows (options)
* @param roller pointer to a roller object * @param roller pointer to a roller object
@@ -138,7 +154,7 @@ static inline uint16_t lv_roller_get_selected(lv_obj_t *roller)
*/ */
static inline void lv_roller_get_selected_str(lv_obj_t * roller, char * buf) static inline void lv_roller_get_selected_str(lv_obj_t * roller, char * buf)
{ {
lv_roller_get_selected_str(roller, buf); lv_ddlist_get_selected_str(roller, buf);
} }
/** /**

View File

@@ -16,6 +16,11 @@ extern "C" {
#include "../../lv_conf.h" #include "../../lv_conf.h"
#if USE_LV_SLIDER != 0 #if USE_LV_SLIDER != 0
/*Testing of dependencies*/
#if USE_LV_BAR == 0
#error "lv_slider: lv_bar is required. Enable it in lv_conf.h (USE_LV_BAR 1) "
#endif
#include "../lv_core/lv_obj.h" #include "../lv_core/lv_obj.h"
#include "lv_bar.h" #include "lv_bar.h"

View File

@@ -9,6 +9,11 @@
#include "../../lv_conf.h" #include "../../lv_conf.h"
#if USE_LV_SW != 0 #if USE_LV_SW != 0
/*Testing of dependencies*/
#if USE_LV_SLIDER == 0
#error "lv_sw: lv_slider is required. Enable it in lv_conf.h (USE_LV_SLIDER 1) "
#endif
#include "lv_sw.h" #include "lv_sw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -45,8 +45,10 @@ static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * mask, lv_design_mode_t
static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode); static bool lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mode_t mode);
static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param); static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param);
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param); static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
#if USE_LV_ANIMATION
static void cursor_blink_anim(lv_obj_t * ta, uint8_t show); static void cursor_blink_anim(lv_obj_t * ta, uint8_t show);
static void pwd_char_hider_anim(lv_obj_t * ta, int32_t x); static void pwd_char_hider_anim(lv_obj_t * ta, int32_t x);
#endif
static void pwd_char_hider(lv_obj_t * ta); static void pwd_char_hider(lv_obj_t * ta);
/********************** /**********************
@@ -987,6 +989,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
return res; return res;
} }
#if USE_LV_ANIMATION
/** /**
* Called to blink the cursor * Called to blink the cursor
* @param ta pointer to a text area * @param ta pointer to a text area
@@ -1018,6 +1022,8 @@ static void pwd_char_hider_anim(lv_obj_t * ta, int32_t x)
(void)x; (void)x;
} }
#endif
/** /**
* Hide all characters (convert them to '*') * Hide all characters (convert them to '*')
* @param ta: pointer to text area object * @param ta: pointer to text area object

2
lvgl.h
View File

@@ -56,7 +56,7 @@ extern "C" {
/*Current version of LittlevGL*/ /*Current version of LittlevGL*/
#define LVGL_VERSION_MAJOR 5 #define LVGL_VERSION_MAJOR 5
#define LVGL_VERSION_MINOR 0 #define LVGL_VERSION_MINOR 0
#define LVGL_VERSION_PATCH 1 #define LVGL_VERSION_PATCH 2
#define LVGL_VERSION_INFO "" #define LVGL_VERSION_INFO ""
/********************** /**********************