Merge branch 'dev' of https://github.com/littlevgl/lvgl into dev
This commit is contained in:
@@ -394,10 +394,10 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
#endif
|
||||
#if LV_TICK_CUSTOM == 1
|
||||
#ifndef LV_TICK_CUSTOM_INCLUDE
|
||||
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/
|
||||
#endif
|
||||
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current sys time in ms*/
|
||||
#endif
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 16
|
||||
#define DMA2D_COLOR_FORMAT DMA2D_RGB565
|
||||
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_RGB565
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define DMA2D_COLOR_FORMAT DMA2D_ARGB8888
|
||||
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_ARGB8888
|
||||
#else
|
||||
/*Can't use GPU with other formats*/
|
||||
#endif
|
||||
@@ -68,7 +68,7 @@ void lv_gpu_stm32_dma2d_init(void)
|
||||
volatile uint32_t temp = RCC->AHB1ENR;
|
||||
|
||||
/* set output colour mode */
|
||||
DMA2D->OPFCCR = DMA2D_COLOR_FORMAT;
|
||||
DMA2D->OPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +160,7 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
|
||||
DMA2D->CR = 0;
|
||||
/* copy output colour mode, this register controls both input and output colour format */
|
||||
DMA2D->FGPFCCR = DMA2D_COLOR_FORMAT;
|
||||
DMA2D->FGPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||
DMA2D->FGMAR = (uint32_t)map;
|
||||
DMA2D->FGOR = map_w - copy_w;
|
||||
DMA2D->OMAR = (uint32_t)buf;
|
||||
@@ -189,11 +189,11 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
|
||||
invalidate_cache();
|
||||
DMA2D->CR = 0x20000;
|
||||
|
||||
DMA2D->BGPFCCR = DMA2D_COLOR_FORMAT;
|
||||
DMA2D->BGPFCCR = LV_DMA2D_COLOR_FORMAT;
|
||||
DMA2D->BGMAR = (uint32_t)buf;
|
||||
DMA2D->BGOR = buf_w - copy_w;
|
||||
|
||||
DMA2D->FGPFCCR = (uint32_t)DMA2D_COLOR_FORMAT
|
||||
DMA2D->FGPFCCR = (uint32_t)LV_DMA2D_COLOR_FORMAT
|
||||
/* alpha mode 2, replace with foreground * alpha value */
|
||||
| (2 << DMA2D_FGPFCCR_AM_Pos)
|
||||
/* alpha value */
|
||||
|
||||
@@ -20,11 +20,11 @@ extern "C" {
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define DMA2D_ARGB8888 0
|
||||
#define DMA2D_RGB888 1
|
||||
#define DMA2D_RGB565 2
|
||||
#define DMA2D_ARGB1555 3
|
||||
#define DMA2D_ARGB4444 4
|
||||
#define LV_DMA2D_ARGB8888 0
|
||||
#define LV_DMA2D_RGB888 1
|
||||
#define LV_DMA2D_RGB565 2
|
||||
#define LV_DMA2D_ARGB1555 3
|
||||
#define LV_DMA2D_ARGB4444 4
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static uint32_t sys_time = 0;
|
||||
static volatile uint32_t tick_irq_flag;
|
||||
static volatile uint8_t tick_irq_flag;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -106,6 +106,17 @@ void lv_theme_set_base(lv_theme_t * new, lv_theme_t * base)
|
||||
new->base = base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a callback for a theme.
|
||||
* The callback is used to add styles to different objects
|
||||
* @param theme pointer to theme which callback should be set
|
||||
* @param cb pointer to the callback
|
||||
*/
|
||||
void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb)
|
||||
{
|
||||
theme->apply_cb = apply_cb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the small font of the theme
|
||||
* @return pointer to the font
|
||||
|
||||
@@ -206,6 +206,14 @@ void lv_theme_copy(lv_theme_t * theme, const lv_theme_t * copy);
|
||||
*/
|
||||
void lv_theme_set_base(lv_theme_t * new, lv_theme_t * base);
|
||||
|
||||
/**
|
||||
* Set an apply callback for a theme.
|
||||
* The apply callback is used to add styles to different objects
|
||||
* @param theme pointer to theme which callback should be set
|
||||
* @param apply_cb pointer to the callback
|
||||
*/
|
||||
void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb);
|
||||
|
||||
/**
|
||||
* Get the small font of the theme
|
||||
* @return pointer to the font
|
||||
|
||||
@@ -792,6 +792,39 @@ static void roller_init(void)
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TABVIEW != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TABLE != 0
|
||||
style_init_reset(&styles->table_cell);
|
||||
lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_pad_left(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_top(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_win_shared_init(void)
|
||||
{
|
||||
#if LV_USE_TABVIEW || LV_USE_WIN
|
||||
style_init_reset(&styles->tabview_btns_bg);
|
||||
lv_style_set_bg_opa(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&styles->tabview_btns_bg, LV_STATE_DEFAULT, COLOR_BG);
|
||||
@@ -831,34 +864,6 @@ static void tabview_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TABLE != 0
|
||||
style_init_reset(&styles->table_cell);
|
||||
lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_pad_left(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_top(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&styles->table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
@@ -927,6 +932,7 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
||||
tileview_init();
|
||||
table_init();
|
||||
win_init();
|
||||
tabview_win_shared_init();
|
||||
|
||||
theme.apply_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
|
||||
@@ -289,6 +289,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
if(lv_btn_get_checkable(btn)) {
|
||||
@@ -309,6 +310,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -992,6 +992,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
ext->btn_id_act = LV_BTNMATRIX_BTN_NONE;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT) {
|
||||
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE)
|
||||
@@ -1059,10 +1060,13 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
ext->btn_id_act = ext->btn_id_focused;
|
||||
lv_obj_invalidate(btnm);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -519,6 +519,7 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
lv_obj_invalidate(calendar);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
uint8_t c = *((uint8_t *)param);
|
||||
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
@@ -541,6 +542,7 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
}
|
||||
lv_obj_invalidate(calendar);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -193,11 +193,13 @@ static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param
|
||||
lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG));
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN || c == LV_KEY_LEFT || c == LV_KEY_UP) {
|
||||
/*Follow the backgrounds state with the bullet*/
|
||||
lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -701,6 +701,7 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p
|
||||
lv_obj_invalidate(cpicker);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
|
||||
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
@@ -745,6 +746,7 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSED) {
|
||||
ext->last_change_time = lv_tick_get();
|
||||
|
||||
@@ -968,6 +968,7 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
|
||||
if(ext->page) lv_obj_refresh_style(ext->page, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
|
||||
if(ext->page == NULL) {
|
||||
@@ -992,10 +993,13 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
|
||||
ext->sel_opt_id = ext->sel_opt_id_orig;
|
||||
lv_dropdown_close(ddlist);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -730,8 +730,10 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
|
||||
|
||||
@@ -412,6 +412,7 @@ static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param
|
||||
{
|
||||
lv_res_t res;
|
||||
|
||||
#if LV_USE_GROUP
|
||||
/*Translate LV_KEY_UP/DOWN to LV_KEY_LEFT/RIGHT */
|
||||
char c_trans = 0;
|
||||
if(sign == LV_SIGNAL_CONTROL) {
|
||||
@@ -421,6 +422,7 @@ static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param
|
||||
|
||||
param = &c_trans;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
lv_get_style_info_t * info = param;
|
||||
@@ -460,8 +462,11 @@ static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param
|
||||
if(btn_id != LV_BTNMATRIX_BTN_NONE) lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROL ||
|
||||
sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
else if(
|
||||
#if LV_USE_GROUP
|
||||
sign == LV_SIGNAL_CONTROL || sign == LV_SIGNAL_GET_EDITABLE ||
|
||||
#endif
|
||||
sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS) {
|
||||
if(ext->btnm) {
|
||||
ext->btnm->signal_cb(ext->btnm, sign, param);
|
||||
}
|
||||
|
||||
@@ -859,6 +859,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
refr_ext_draw_pad(page);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
uint32_t c = *((uint32_t *)param);
|
||||
|
||||
if(c == LV_KEY_DOWN) {
|
||||
@@ -883,10 +884,13 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
else
|
||||
lv_page_scroll_hor(page, lv_obj_get_width(page) / 4);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -574,13 +574,16 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
|
||||
/* Include the ancient signal function */
|
||||
if(sign != LV_SIGNAL_CONTROL) { /*Don't let the page to scroll on keys*/
|
||||
#if LV_USE_GROUP
|
||||
res = ancestor_signal(roller, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
LV_UNUSED(ext);
|
||||
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_t * label = get_label(roller);
|
||||
@@ -640,6 +643,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
|
||||
if(ext->sel_opt_id + 1 < ext->option_cnt) {
|
||||
@@ -656,6 +660,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
ext->sel_opt_id_ori = ori_id;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_obj_clean_style_list(roller, LV_ROLLER_PART_SELECTED);
|
||||
|
||||
@@ -407,6 +407,7 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
|
||||
@@ -419,13 +420,16 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
lv_obj_clean_style_list(slider, LV_SLIDER_PART_KNOB);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -390,8 +390,10 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
|
||||
/* Include the ancient signal function */
|
||||
if(sign != LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
res = ancestor_signal(spinbox, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
#endif
|
||||
}
|
||||
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
|
||||
|
||||
@@ -464,6 +466,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
|
||||
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
|
||||
@@ -488,6 +491,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
else {
|
||||
lv_textarea_add_char(spinbox, c);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -296,12 +296,14 @@ static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
char c = *((char *)param);
|
||||
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) lv_switch_on(sw, LV_ANIM_ON);
|
||||
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) lv_switch_off(sw, LV_ANIM_ON);
|
||||
|
||||
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SWITCH_PART_KNOB);
|
||||
@@ -320,8 +322,10 @@ static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
sw->ext_draw_pad = LV_MATH_MAX(sw->ext_draw_pad, knob_size);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = false; /*The ancestor slider is editable the switch is not*/
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -645,12 +645,17 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROL || sign == LV_SIGNAL_PRESSED ||
|
||||
sign == LV_SIGNAL_RELEASED) {
|
||||
if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS ||
|
||||
#if LV_USE_GROUP
|
||||
sign == LV_SIGNAL_CONTROL ||
|
||||
#endif
|
||||
sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_RELEASED) {
|
||||
|
||||
/* The button matrix is not in a group (the tab view is in it) but it should handle the
|
||||
* group signals. So propagate the related signals to the button matrix manually*/
|
||||
|
||||
@@ -221,7 +221,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/**
|
||||
* Insert a character to the current cursor position.
|
||||
* To add a wide char, e.g. 'Á' use `lv_txt_encoded_conv_wc('Á')`
|
||||
* To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')`
|
||||
* @param ta pointer to a text area object
|
||||
* @param c a character (e.g. 'a')
|
||||
*/
|
||||
@@ -1466,6 +1466,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
|
||||
if(c == LV_KEY_RIGHT)
|
||||
lv_textarea_cursor_right(ta);
|
||||
@@ -1486,10 +1487,13 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
|
||||
else {
|
||||
lv_textarea_add_char(ta, c);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_GET_EDITABLE) {
|
||||
#if LV_USE_GROUP
|
||||
bool * editable = (bool *)param;
|
||||
*editable = true;
|
||||
#endif
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING || sign == LV_SIGNAL_PRESS_LOST ||
|
||||
sign == LV_SIGNAL_RELEASED) {
|
||||
|
||||
@@ -106,7 +106,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
|
||||
/**
|
||||
* Insert a character to the current cursor position.
|
||||
* To add a wide char, e.g. 'Á' use `lv_txt_encoded_conv_wc('Á')`
|
||||
* To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')`
|
||||
* @param ta pointer to a text area object
|
||||
* @param c a character (e.g. 'a')
|
||||
*/
|
||||
|
||||
@@ -645,8 +645,10 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
|
||||
ext->title_txt = NULL;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CONTROL) {
|
||||
#if LV_USE_GROUP
|
||||
/*Forward all the control signals to the page*/
|
||||
ext->page->signal_cb(ext->page, sign, param);
|
||||
#endif
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
39
src/lvgl.h
Normal file
39
src/lvgl.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file lvgl.h
|
||||
* This file exists only to be compatible with Arduino's library structure
|
||||
*/
|
||||
|
||||
#ifndef LVGL_SRC_H
|
||||
#define LVGL_SRC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../lvgl.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*LVGL_SRC_H*/
|
||||
Reference in New Issue
Block a user