astyle code formatting

This commit is contained in:
Gabor Kiss-Vamosi
2018-10-05 17:22:49 +02:00
parent 23b65ca454
commit 41695bf9ac
95 changed files with 5399 additions and 5603 deletions
-1
View File
@@ -1 +0,0 @@
--style=kr --convert-tabs --indent=spaces=4 --indent-switches --pad-oper --unpad-paren --align-pointer=middle --suffix=.bak --lineend=linux --min-conditional-indent=
-1
View File
@@ -1 +0,0 @@
--convert-tabs --indent=spaces=4
+3 -3
View File
@@ -170,12 +170,12 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
Use 4 spaces indentation instead of tab.
You can use **astyle** to format the code. The required config flies are: `docs/astyle_c` and `docs/astyle_h`.
To format the header files:
To format the source files:
`$ find . -type f -name "*.c" | xargs astyle --options=docs/astyle_c`
To format the sorce files:
To format the header files:
`$ find . -type f -name "*.h" | xargs astyle --options=docs/astyle_h`
Append `-n` to the end to skip creation of backup file or use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups)
Append `-n` to the end to skip creation of backup file OR use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups)
-39
View File
@@ -1,39 +0,0 @@
# TODOs for major versions
Major versions released typically when API changes are required
## Contributing
Please create an issue to suggest a new feature instead of adding pull request to this file.
## v6 (released on: in progrss)
- [ ] lv_img_upscale removal (generate image with with opacity instead)
- [ ] disp_map and disp_fill removal
- [ ] disp_flush, mem_blend, mem_fill rework: usea lv_area_t as parameter an GPU support 2D area
- [ ] disp_flush: not const color map
- [ ] ext size removal, enable drawing on full parent.
- [ ] multiple display support
- [ ] lv_ufs removal (was required only in the the old image system)
## v5 (released on: 20.12.2017)
**Architectural changes**
- [x] Rename repository from *proj_pc* to *pc_simulator*
- [x] Integrate *hal* in LittlevGL as a normal folder
- [x] Create a new repository for examples
- [x] Convert Applications into simple examples
- [x] Add tests for all object types
**API changes**
- [x] Rework lv_style_t structure
- [x] Remove LV_DOWNSCALE (LV_ANTIALIAS will be used instead)
- [x] Rename (and slightly rework) some function, defines and enums to be more descriptive
- [x] lv_btnm: rework width control. Now a control byte is used for *width*, *hide* and *no long press* settings.
- [x] LV_LABEL_LONG_DOTS removed, use LV_LABEL_LONG_ROLL instead
- [x] *lv_list_set_element_text_roll()* removed.
- [x] *lv_ddlist_set_fix_height()* instead of *auto_size*
- [x] *lv_list_set_sb_out()* removed because now the scrollbar style can position the scrollbar
- [x] *lv_gauge* rework to make it more like line meter (remove background but add scale lines)
- [x] rename *lv_dispi_...* to *lv_indev_...*
- [x] *lv_dispi_t* removed from *lv_action_type_t*. Use lv_indev_act() instead
- [x] make styles to global variable to ensure less typing
- [x] make fonts to global variables to ensure less typing and easy user-font adding
- [x] join symbol fonts into normal built-in fonts
- [x] add inline functions to avoide direct use of anchestor functions (e.g. for buttons: lv_cont_set_fit -> lv_btn_set_fit)
-84
View File
@@ -1,84 +0,0 @@
# TODOs for minor versions
Minor versions (x.1.0, x.2.0 ...) released when one or more new feature is addded without changing the API. New features can be added with major versions (1.0.0, 2.0.0 ...) too.
## Contributing
Please create an issue to suggest a new feature instead of adding pull request to this file.
## Ideas
Here are ideas which are not assigned to a minor version yet:
- label: add a horzintal line (e.g. underline or line through).
- lv_split: new object type, a hor. or ver. line for decoration purpose
- lv_valset: new object type, a label with "+" and "-" buttons
- lv_listctrl: new object type, a list various controls on th right (sw, cb erc.)
- lv_inlist: new object type, inline drop down list (a button wich opens a list in place)
- lv_char: new_object type: characteristic set (like chart with draggable points)
- lv_vol: new_object type: volume meter (like a bar with segments)
- Anim. paths: monentum (tnh(x)), curve (exp), shake
- Hover, hover_lost signals
- Detached area (for video rendering where LittlevGL don't put pixels)
- lv_ta: add placeholder text
- image rotate
## v5.3 (planned)
Mainly graphical/drawing improvments and Lua support
- [ ] API extension: turn the relevant "lv_obj" functions to the specific type (lv_btn_set_size)
- [ ] Lua interface to create GUI with script
- [ ] Arabic glyph convert (based on letter position)
- [ ] Arc rawing
- [ ] Right-to-left write support
- [ ] Bit based VDB: 1, 2 or 4 bit
- [ ] Ttriangle drawing
## v5.2 (in progress)
Mainly new object and new feauters:
- [ ] New object type: Listview (table) #137
- [ ] New object type: Calendar
- [ ] New object type: Icon (button like image) #182
- [ ] New object type: QR code #199
- [ ] lv_page: scroll on LV_GROUP_KEY_UP/DOWN/LEFT/RIGHT
- [ ] lv_obj_align: option in lv_conf.h sav the last alignment's coordinate ad aply it on lv_obj_realign
- [ ] lv_line: perpndicular line ending
- [ ] lv_gauge: option to put lables outside of the scale
- [ ] lv_img: png support #254
- [ ] lv_tabview: add option to put the tab button to the bottom
- [ ] Error callback: add an option to register a callback called on error
- [ ] Support more character coding (e.g. UTF8, UTF16 etc)
## v5.1 (released on: 09.03.2018)
- [x] lv_refr_set_roundig_callback: set a function to modify the invalidated area for special display controllers
- [x] lv_group_set_focus_callback: set function to call when a new object is focused #94
- [x] lv_obj_get_type() return string, e.g. "lv_slider", "lv_btn" etc #91
- [x] Font handling extension for effective Chiese font handling (cutsom read functions)
- [x] Remove LV_FONT_ANTIALIAS and add fonts with BPP (bit-per-pixel): 1, 2, 4 and 8
- [x] lv_img: add pixel level opacity option (ARGB8888 or ARGB8565) (make image upscale pointless)
- [x] LV_ANTIALIAS rework: meaning anti-alias lines and curves
- [x] Merge symbol fonts (basic, file and feedback) into one font
- [x] lv_group: different default style_mod function with LV_COLOR_DEPTH 1
- [x] lv_img_set_src() to handle file path, symbols and const variables with one function
- [x] LV_PROTECT_PRESS_LOST: prevent the input devices to NOT find new object when the object's pressing is lost
- [x] lv_label: draw style.body.padding.hor/ver greater body if body_draw is enabled
- [x] LV_LAYOUT_PRETTY: in one row align obeóject vertically to middle
- [x] Add user data option to lv_indev_drv_t and pass it with lv_indev_data_t to the read function. #115
- [x] LV_GROUP_KEY_ENTER_LONG: sent by the library on long press of LV_GROUP_KEY_ENTER to trigger long press of the object #113
- [x] LV_INDEV_TYPE_BUTTON: for a hatdware buttons which press a point on a screen
## v5.0 (released on: 20.12.2017)
- [x] UTF-8 support
- [x] lv_tabview: new object type to organise content with tabs
- [x] lv_sw: new object type, switch, turn on/off by tap (a little slider)
- [x] lv_roller: new object type, a roller to select a value (like on smartphones)
- [x] lv_kb: new object type, Keyboard
- [x] lv_btnm: lv_btnm_set_tgl() to toggle last button
- [x] lv_ta: cursor types
- [x] add themes with predefined styles
- [x] partial border draw in styles
## v4.2 (released on: 17.08.2017)
- [x] Double VDB support: one for rendering, another to transfer former rendered image to frame buffer in the background (e.g. with DMA) [#15](https://github.com/littlevgl/lvgl/issues/15)
- [x] lv_group: to control without touch pad. Issue [#14](https://github.com/littlevgl/lvgl/issues/14)
- [x] lv_page: scrl def fit modification: hor:false, ver:true, and always set width to parent width
- [x] lv_btn: add lv_btn_get_..._action
- [x] lv_list: add lv_list_get_element_label/img
- [x] lv_ta: lv_ta_set_one_line to configure the Text area to one lined input field
- [x] style animations add
- [x] lv_btnm: besides 0. byte (width dsc) 1. byte: hidden (\177, 0x7F, delete)
-62
View File
@@ -1,62 +0,0 @@
# TODOs for patch versions
Patch versions (x.y.1, x.y.2) contain bugfixes without changing the API but they can apppear in minor (x.1.0, x.2.0) or major (1.0.0, 2.0.0) versions too.
The bugfixes of the still not released version are in `beta` branche.
## Contributing
Please create an issue to introduce a bug instead of adding pull request to this file.
## v5.1.1 (released on: 20.05.2018)
- [x] lv_line: set line.width ext. size to not trim parts on x = 0, y = 0 coordinates
- [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED
- [x] lv_group_create: init focus_cb
- [x] fix of 16 bit image drawing with alpha bytes
- [x] fix text opacity
- [x] lv_mbox: enable navigation with LV_GROUP_KEY_DOWN/UP too
- [x] lv_conf.h: add LV_COMPILER_VLA_SUPPORTED
- [x] lv_slider: inicator draw bugfix
- [x] lv_slider: draw greater background on negative padding if knob_in == 1
- [x] mono theme: fix typo
- [x] style animations: add opacity handling to image, text and line
- [x] lv_kb: before ok/close action don't deassign the lv_ta if there is user defined action
- [x] in lv_objx_set_... functions apply the new value only if it's different from the current
- [x] don't invalide hidden objects
- [x] lv_group_del: remove the objects from the groups too
## v5.0.3 (released on: 09.03.2018)
- [x] lv_chart: Fix the use of point_num more then 256 (Thanks to upbeat27)
- [x] lv_label: fix 'offset' with LV_ANTIALIAS (LV_LABEL_LONG_ROLL was effected)
- [x] lv_label: anim. time wasn't allyed for LV_LABEL_LONG_ROLL
- [x] lv_txt_ut8_size fiy for 4 byte characters
- [x] lv_slider: fix knob_in with not zero min value
- [x] lv_area_is_on: handled some cases wrong
- [x] lv_indev: buffered indevs (return *true* in indev_read) was handled as non-buffered
- [x] drag: don't invalidate if the object wasn't moved
## v5.0.2 (released on: 19.01.2018)
- [x] Fix dependencied (Thanks to Zaltora)
- [x] lv_group: fix memory leak (Thanks to BenQoo)
- [x] LV_INDEV_READ_PERIOD 0 build bugfix
- [x] lv_roller: lv_roller_get_selected_str: bugfix (was recursive call)
- [x] lv_obj_get_style: with NULL style check if the parent is focused and use the focused style
- [x] lv_roller: add missing action handling
- [x] Set 24 bit colors upper byte (alpha) to 0xFF
## v5.0.1 (released on: 02.01.2018)
- [x] lv_list: fixed when mouse and keyboard used together
- [x] lv_btnm: fix bottom border visibility
- [x] theme updates
- [x] line width fix width anti-aliasing
- [x] lv_conf_templ.h add more info
## v5.0 (released on: 21.12.2017)
- [x] lv_btnm: check hide code (\177) at 0. byte position too (if width is not specified)
- [x] lv_img: define *lv_img_raw_header* in *lv_draw.h* because now lv_img can't be disabled
- [x] lv_list: ignore image related things when *lv_img* is not enebled
- [x] lv_ta: fix hegiht if *one_line* and *FONT_ANTIALIAS*
- [x] lv_obj_set_style: fix to update self style too (not only children)
## v4.2 (released on: 17.08.2017)
- [x] lv_slider: don't let indicator or bar to disappear because of hpad/vpad
- [x] lv_ta: memory leak if deleted in password mode
- [x] lv_list: work without *lv_img* by ignore the image file name parameter of *lv_list_add()*
+1 -1
View File
@@ -72,7 +72,7 @@
/*Color settings*/
#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_SCREEN_TRANSP 0 /*1: Enable screen transparency. Useful for OSD or other overlapping GUIs. Requires ARGB8888 colors*/
#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma keying)*/
+20 -20
View File
@@ -91,11 +91,11 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
/*If the object is already in a group and focused then defocuse it*/
if(obj->group_p) {
if(lv_obj_is_focused(obj)) {
lv_group_focus_next(obj->group_p);
if(lv_obj_is_focused(obj)) {
lv_group_focus_next(obj->group_p);
LV_LOG_INFO("group: assign object to an other group");
}
LV_LOG_INFO("group: assign object to an other group");
}
}
obj->group_p = group;
@@ -156,7 +156,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
lv_obj_t ** i;
LL_READ(g->obj_ll, i) {
if(*i == obj) {
if(g->obj_focus == i) return; /*Don't focus the already focused object again*/
if(g->obj_focus == i) return; /*Don't focus the already focused object again*/
if(g->obj_focus != NULL) {
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_obj_invalidate(*g->obj_focus);
@@ -294,9 +294,9 @@ void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb)
*/
void lv_group_set_editing(lv_group_t * group, bool edit)
{
group->editing = edit ? 1 : 0;
lv_obj_t * focused = lv_group_get_focused(group);
lv_obj_invalidate(focused);
group->editing = edit ? 1 : 0;
lv_obj_t * focused = lv_group_get_focused(group);
lv_obj_invalidate(focused);
}
/**
@@ -306,7 +306,7 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
*/
void lv_group_set_click_focus(lv_group_t * group, bool en)
{
group->click_focus = en ? 1 : 0;
group->click_focus = en ? 1 : 0;
}
/**
@@ -320,11 +320,11 @@ lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style)
lv_style_copy(&group->style_tmp, style);
if(group->editing) {
if(group->style_mod_edit != NULL) group->style_mod_edit(&group->style_tmp);
else style_mod_edit_def(&group->style_tmp);
if(group->style_mod_edit != NULL) group->style_mod_edit(&group->style_tmp);
else style_mod_edit_def(&group->style_tmp);
} else {
if(group->style_mod != NULL) group->style_mod(&group->style_tmp);
else style_mod_def(&group->style_tmp);
if(group->style_mod != NULL) group->style_mod(&group->style_tmp);
else style_mod_def(&group->style_tmp);
}
return &group->style_tmp;
}
@@ -349,7 +349,7 @@ lv_obj_t * lv_group_get_focused(const lv_group_t * group)
*/
lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
{
if(!group) return false;
if(!group) return false;
return group->style_mod ;
}
@@ -360,7 +360,7 @@ lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
*/
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
{
if(!group) return false;
if(!group) return false;
return group->style_mod_edit;
}
@@ -371,7 +371,7 @@ lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * grou
*/
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
{
if(!group) return false;
if(!group) return false;
return group->focus_cb;
}
@@ -382,8 +382,8 @@ lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
*/
bool lv_group_get_editing(const lv_group_t * group)
{
if(!group) return false;
return group->editing ? true : false;
if(!group) return false;
return group->editing ? true : false;
}
/**
@@ -393,8 +393,8 @@ bool lv_group_get_editing(const lv_group_t * group)
*/
bool lv_group_get_click_focus(const lv_group_t * group)
{
if(!group) return false;
return group->click_focus ? true : false;
if(!group) return false;
return group->click_focus ? true : false;
}
/**********************
+3 -3
View File
@@ -53,9 +53,9 @@ typedef struct _lv_group_t
lv_group_style_mod_func_t style_mod_edit;/*A function which modifies the style of the focused object*/
lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/
lv_style_t style_tmp; /*Stores the modified style of the focused object */
uint8_t frozen :1; /*1: can't focus to new object*/
uint8_t editing :1; /*1: Edit mode, 0: Navigate mode*/
uint8_t click_focus :1; /*1: If an object in a group is clicked by an indev then it will be focused */
uint8_t frozen :1; /*1: can't focus to new object*/
uint8_t editing :1; /*1: Edit mode, 0: Navigate mode*/
uint8_t click_focus :1; /*1: If an object in a group is clicked by an indev then it will be focused */
} lv_group_t;
/**********************
+23 -30
View File
@@ -83,9 +83,9 @@ lv_indev_t * lv_indev_get_act(void)
*/
lv_hal_indev_type_t lv_indev_get_type(const lv_indev_t * indev)
{
if(indev == NULL) return LV_INDEV_TYPE_NONE;
if(indev == NULL) return LV_INDEV_TYPE_NONE;
return indev->driver.type;
return indev->driver.type;
}
/**
* Reset one or all input devices
@@ -266,7 +266,7 @@ static void indev_proc_task(void * param)
(void)param;
LV_LOG_TRACE("indev task started");
LV_LOG_TRACE("indev task started");
lv_indev_data_t data;
lv_indev_t * i;
@@ -284,7 +284,7 @@ static void indev_proc_task(void * param)
do {
/*Read the data*/
more_to_read = lv_indev_read(i, &data);
indev_proc_reset_query_handler(i); /*The active object might deleted even in the read function*/
indev_proc_reset_query_handler(i); /*The active object might deleted even in the read function*/
i->proc.state = data.state;
if(i->proc.state == LV_INDEV_STATE_PR) {
@@ -309,7 +309,7 @@ static void indev_proc_task(void * param)
indev_act = NULL; /*End of indev processing, so no act indev*/
LV_LOG_TRACE("indev task finished");
LV_LOG_TRACE("indev task finished");
}
@@ -367,14 +367,13 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
if(data->key == LV_GROUP_KEY_ENTER &&
i->proc.long_pr_sent == 0 &&
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME )
{
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
/*On enter long press leave edit mode.*/
lv_obj_t * focused = lv_group_get_focused(i->group);
if(focused) {
lv_obj_t * focused = lv_group_get_focused(i->group);
if(focused) {
focused->signal_func(focused, LV_SIGNAL_LONG_PRESS, indev_act);
i->proc.long_pr_sent = 1;
}
}
}
}
/*Release happened*/
@@ -392,19 +391,14 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
}
}
if(data->key == LV_GROUP_KEY_NEXT)
{
if(data->key == LV_GROUP_KEY_NEXT) {
lv_group_focus_next(i->group);
}
else if(data->key == LV_GROUP_KEY_PREV)
{
lv_group_focus_prev(i->group);
}
else if(data->key == LV_GROUP_KEY_ENTER)
{
if (!i->proc.long_pr_sent) {
lv_group_send_data(i->group, data->key);
}
} else if(data->key == LV_GROUP_KEY_PREV) {
lv_group_focus_prev(i->group);
} else if(data->key == LV_GROUP_KEY_ENTER) {
if(!i->proc.long_pr_sent) {
lv_group_send_data(i->group, data->key);
}
} else {
lv_group_send_data(i->group, data->key);
}
@@ -460,15 +454,14 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
if(i->proc.long_pr_sent == 0 &&
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME )
{
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
/*On enter long press leave edit mode.*/
lv_obj_t * focused = lv_group_get_focused(i->group);
bool editable = false;
if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
if (editable) {
if(editable) {
i->group->editing = i->group->editing ? 0 : 1;
if(focused) focused->signal_func(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again. Some object do something on navigate->edit change*/
LV_LOG_INFO("Edit mode changed");
@@ -488,11 +481,11 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
if(focused) focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
/*The button was released on a non-editable object. Just send enter*/
if (!editable) {
if(!editable) {
lv_group_send_data(i->group, LV_GROUP_KEY_ENTER);
}
/*An object is being edited and the button is releases. Just send enter */
else if (i->group->editing) {
else if(i->group->editing) {
if(!i->proc.long_pr_sent) lv_group_send_data(i->group, LV_GROUP_KEY_ENTER); /*Ignore long pressed enter release because it comes from mode switch*/
}
/*If the focused object is editable and now in navigate mode then enter edit mode*/
@@ -716,9 +709,9 @@ static void indev_proc_release(lv_indev_proc_t * proc)
}
if(g != NULL && parent != NULL)
if(lv_group_get_click_focus(g)) {
lv_group_focus_obj(parent);
}
if(lv_group_get_click_focus(g)) {
lv_group_focus_obj(parent);
}
}
#endif
+11 -11
View File
@@ -62,7 +62,7 @@ static lv_ll_t scr_ll; /*Linked list of screens*/
*/
void lv_init(void)
{
LV_LOG_TRACE("lv_init started");
LV_LOG_TRACE("lv_init started");
/*Initialize the lv_misc modules*/
lv_mem_init();
@@ -105,7 +105,7 @@ void lv_init(void)
#endif
LV_LOG_INFO("lv_init ready");
LV_LOG_INFO("lv_init ready");
}
/*--------------------
@@ -119,13 +119,13 @@ void lv_init(void)
* @param copy pointer to a base object, if not NULL then the new object will be copied from it
* @return pointer to the new object
*/
lv_obj_t * lv_obj_create(lv_obj_t * parent,const lv_obj_t * copy)
lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
{
lv_obj_t * new_obj = NULL;
/*Create a screen if the parent is NULL*/
if(parent == NULL) {
LV_LOG_TRACE("Screen create started");
LV_LOG_TRACE("Screen create started");
new_obj = lv_ll_ins_head(&scr_ll);
lv_mem_assert(new_obj);
@@ -181,7 +181,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent,const lv_obj_t * copy)
}
/*parent != NULL create normal obj. on a parent*/
else {
LV_LOG_TRACE("Object create started");
LV_LOG_TRACE("Object create started");
new_obj = lv_ll_ins_head(&(parent)->child_ll);
lv_mem_assert(new_obj);
@@ -1099,8 +1099,8 @@ lv_obj_t * lv_layer_sys(void)
*/
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj)
{
const lv_obj_t * par = obj;
const lv_obj_t * act_p;
const lv_obj_t * par = obj;
const lv_obj_t * act_p;
do {
act_p = par;
@@ -1377,7 +1377,7 @@ lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj)
*/
lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj)
{
const lv_obj_t * parent = obj;
const lv_obj_t * parent = obj;
while(parent) {
if(parent->opa_scale_en) return parent->opa_scale;
@@ -1514,9 +1514,9 @@ void * lv_obj_get_group(const lv_obj_t * obj)
*/
bool lv_obj_is_focused(const lv_obj_t * obj)
{
if(obj->group_p) {
if(lv_group_get_focused(obj->group_p) == obj) return true;
}
if(obj->group_p) {
if(lv_group_get_focused(obj->group_p) == obj) return true;
}
return false;
}
+25 -25
View File
@@ -180,7 +180,7 @@ static void lv_refr_task(void * param)
{
(void)param;
LV_LOG_TRACE("display refresh task started");
LV_LOG_TRACE("display refresh task started");
uint32_t start = lv_tick_get();
@@ -201,7 +201,7 @@ static void lv_refr_task(void * param)
}
}
LV_LOG_TRACE("display refresh task finished");
LV_LOG_TRACE("display refresh task finished");
}
@@ -308,25 +308,25 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
/*Round down the lines of VDB if rounding is added*/
if(round_cb) {
lv_area_t tmp;
tmp.x1 = 0;
tmp.x2 = 0;
tmp.y1 = 0;
tmp.y2 = max_row;
lv_area_t tmp;
tmp.x1 = 0;
tmp.x2 = 0;
tmp.y1 = 0;
tmp.y2 = max_row;
lv_coord_t y_tmp = max_row;
do {
tmp.y2 = y_tmp;
round_cb(&tmp);
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
lv_coord_t y_tmp = max_row;
do {
tmp.y2 = y_tmp;
round_cb(&tmp);
y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
} while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
if(y_tmp == 0) {
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
return;
} else {
max_row = tmp.y2 + 1;
}
if(y_tmp == 0) {
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
return;
} else {
max_row = tmp.y2 + 1;
}
}
/*Always use the full row*/
@@ -353,9 +353,9 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
if(y2 != row_last) {
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Calc. the next y coordinates of VDB*/
vdb_p->area.x1 = area_p->x1;
@@ -376,9 +376,9 @@ static void lv_refr_area_part_vdb(const lv_area_t * area_p)
{
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
LV_LOG_WARN("Invalid VDB pointer");
return;
}
lv_obj_t * top_p;
/*Get the new mask from the original area and the act. VDB
+37 -37
View File
@@ -217,54 +217,54 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src)
/**
* Mix two styles according to a given ratio
* @param start start style
* @param start start style
* @param end end style
* @param res store the result style here
* @param ratio the ratio of mix [0..256]; 0: `start` style; 256: `end` style
*/
void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t * res, uint16_t ratio)
{
STYLE_ATTR_MIX(body.opa, ratio);
STYLE_ATTR_MIX(body.radius, ratio);
STYLE_ATTR_MIX(body.border.width, ratio);
STYLE_ATTR_MIX(body.border.opa, ratio);
STYLE_ATTR_MIX(body.shadow.width, ratio);
STYLE_ATTR_MIX(body.padding.hor, ratio);
STYLE_ATTR_MIX(body.padding.ver, ratio);
STYLE_ATTR_MIX(body.padding.inner, ratio);
STYLE_ATTR_MIX(text.line_space, ratio);
STYLE_ATTR_MIX(text.letter_space, ratio);
STYLE_ATTR_MIX(text.opa, ratio);
STYLE_ATTR_MIX(line.width, ratio);
STYLE_ATTR_MIX(line.opa, ratio);
STYLE_ATTR_MIX(image.intense, ratio);
STYLE_ATTR_MIX(image.opa, ratio);
STYLE_ATTR_MIX(body.opa, ratio);
STYLE_ATTR_MIX(body.radius, ratio);
STYLE_ATTR_MIX(body.border.width, ratio);
STYLE_ATTR_MIX(body.border.opa, ratio);
STYLE_ATTR_MIX(body.shadow.width, ratio);
STYLE_ATTR_MIX(body.padding.hor, ratio);
STYLE_ATTR_MIX(body.padding.ver, ratio);
STYLE_ATTR_MIX(body.padding.inner, ratio);
STYLE_ATTR_MIX(text.line_space, ratio);
STYLE_ATTR_MIX(text.letter_space, ratio);
STYLE_ATTR_MIX(text.opa, ratio);
STYLE_ATTR_MIX(line.width, ratio);
STYLE_ATTR_MIX(line.opa, ratio);
STYLE_ATTR_MIX(image.intense, ratio);
STYLE_ATTR_MIX(image.opa, ratio);
lv_opa_t opa = ratio == STYLE_MIX_MAX ? LV_OPA_COVER : ratio;
lv_opa_t opa = ratio == STYLE_MIX_MAX ? LV_OPA_COVER : ratio;
res->body.main_color = lv_color_mix(end->body.main_color, start->body.main_color, opa);
res->body.grad_color = lv_color_mix(end->body.grad_color, start->body.grad_color, opa);
res->body.border.color = lv_color_mix(end->body.border.color, start->body.border.color, opa);
res->body.shadow.color = lv_color_mix(end->body.shadow.color, start->body.shadow.color, opa);
res->text.color = lv_color_mix(end->text.color, start->text.color, opa);
res->image.color = lv_color_mix(end->image.color, start->image.color, opa);
res->line.color = lv_color_mix(end->line.color, start->line.color, opa);
res->body.main_color = lv_color_mix(end->body.main_color, start->body.main_color, opa);
res->body.grad_color = lv_color_mix(end->body.grad_color, start->body.grad_color, opa);
res->body.border.color = lv_color_mix(end->body.border.color, start->body.border.color, opa);
res->body.shadow.color = lv_color_mix(end->body.shadow.color, start->body.shadow.color, opa);
res->text.color = lv_color_mix(end->text.color, start->text.color, opa);
res->image.color = lv_color_mix(end->image.color, start->image.color, opa);
res->line.color = lv_color_mix(end->line.color, start->line.color, opa);
if(ratio < (STYLE_MIX_MAX >> 1)) {
res->body.empty = start->body.empty;
res->body.border.part = start->body.border.part;
res->glass = start->glass;
res->text.font = start->text.font;
res->body.shadow.type = start->body.shadow.type;
if(ratio < (STYLE_MIX_MAX >> 1)) {
res->body.empty = start->body.empty;
res->body.border.part = start->body.border.part;
res->glass = start->glass;
res->text.font = start->text.font;
res->body.shadow.type = start->body.shadow.type;
res->line.rounded = start->line.rounded;
} else {
res->body.empty = end->body.empty;
res->body.border.part = end->body.border.part;
res->glass = end->glass;
res->text.font = end->text.font;
res->body.shadow.type = end->body.shadow.type;
} else {
res->body.empty = end->body.empty;
res->body.border.part = end->body.border.part;
res->glass = end->glass;
res->text.font = end->text.font;
res->body.shadow.type = end->body.shadow.type;
res->line.rounded = end->line.rounded;
}
}
}
#if USE_LV_ANIMATION
+1 -1
View File
@@ -152,7 +152,7 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
/**
* Mix two styles according to a given ratio
* @param start start style
* @param start start style
* @param end end style
* @param res store the result style here
* @param ratio the ratio of mix [0..256]; 0: `start` style; 256: `end` style
+11 -11
View File
@@ -21,9 +21,9 @@
* TYPEDEFS
**********************/
enum {
LV_VDB_STATE_FREE = 0, /*Not used*/
LV_VDB_STATE_ACTIVE, /*Being used to render*/
LV_VDB_STATE_FLUSH, /*Flushing pixels from it*/
LV_VDB_STATE_FREE = 0, /*Not used*/
LV_VDB_STATE_ACTIVE, /*Being used to render*/
LV_VDB_STATE_FLUSH, /*Flushing pixels from it*/
};
typedef uint8_t lv_vdb_state_t;
@@ -41,12 +41,12 @@ static volatile lv_vdb_state_t vdb_state = LV_VDB_STATE_ACTIVE;
# if LV_VDB_ADR == 0
/*If the buffer address is not specified simply allocate it*/
static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES];
static lv_vdb_t vdb = {.buf = (lv_color_t*)vdb_buf};
# else /*LV_VDB_ADR != 0*/
static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf};
# else /*LV_VDB_ADR != 0*/
/*If the buffer address is specified use that address*/
static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
# endif
#else /*LV_VDB_DOUBLE != 0*/
#else /*LV_VDB_DOUBLE != 0*/
/*Double VDB*/
static volatile lv_vdb_state_t vdb_state[2] = {LV_VDB_STATE_FREE, LV_VDB_STATE_FREE};
# if LV_VDB_ADR == 0
@@ -54,7 +54,7 @@ static volatile lv_vdb_state_t vdb_state[2] = {LV_VDB_STATE_FREE, LV_VDB_STATE_F
static uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES];
static uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES];
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}};
# else /*LV_VDB_ADR != 0*/
# else /*LV_VDB_ADR != 0*/
/*If the buffer address is specified use that address*/
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *)LV_VDB_ADR}, {.buf = (lv_color_t *)LV_VDB2_ADR}};
# endif
@@ -79,7 +79,7 @@ lv_vdb_t * lv_vdb_get(void)
* user call of 'lv_flush_ready()' in display drivers's flush function*/
while(vdb_state != LV_VDB_STATE_ACTIVE);
if(vdb.buf == (void*)LV_VDB_ADR_INV) {
if(vdb.buf == (void *)LV_VDB_ADR_INV) {
LV_LOG_ERROR("VDB address is invalid. Use `lv_vdb_set_adr` to set a valid address or use LV_VDB_ADR = 0 in lv_conf.h");
return NULL;
}
@@ -111,9 +111,9 @@ void lv_vdb_flush(void)
{
lv_vdb_t * vdb_act = lv_vdb_get();
if(!vdb_act) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
LV_LOG_WARN("Invalid VDB pointer");
return;
}
#if LV_VDB_DOUBLE == 0
vdb_state = LV_VDB_STATE_FLUSH; /*User call to 'lv_flush_ready()' will set to ACTIVE 'disp_flush'*/
#else
+4 -4
View File
@@ -38,15 +38,15 @@ void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color
void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_vfill;
void (*const 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;
void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap;
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap;
#else
void (*const 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;
void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = lv_rfill;
void (*const 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;
void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap;
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap;
#endif
/**********************
+2 -2
View File
@@ -92,8 +92,8 @@ extern void (*const px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, l
extern void (*const fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
extern void (*const 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);
extern void (*const map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa);
const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa);
/**********************
* MACROS
+2 -2
View File
@@ -372,8 +372,8 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t *
return LV_IMG_DECODER_OPEN_FAIL;
}
#else
LV_LOG_WARN("Image built-in decoder can read file because USE_LV_FILESYSTEM = 0");
return LV_IMG_DECODER_OPEN_FAIL;
LV_LOG_WARN("Image built-in decoder can read file because USE_LV_FILESYSTEM = 0");
return LV_IMG_DECODER_OPEN_FAIL;
#endif
}
+23 -23
View File
@@ -28,38 +28,38 @@ struct _lv_img_t;
typedef struct {
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c */
uint32_t cf :5; /* Color format: See `lv_img_color_format_t`*/
uint32_t always_zero :3; /*It the upper bits of the first byte. Always zero to look like a non-printable character*/
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c */
uint32_t cf :5; /* Color format: See `lv_img_color_format_t`*/
uint32_t always_zero :3; /*It the upper bits of the first byte. Always zero to look like a non-printable character*/
uint32_t reserved :2; /*Reserved to be used later*/
uint32_t reserved :2; /*Reserved to be used later*/
uint32_t w:11; /*Width of the image map*/
uint32_t h:11; /*Height of the image map*/
}lv_img_header_t;
uint32_t w:11; /*Width of the image map*/
uint32_t h:11; /*Height of the image map*/
} lv_img_header_t;
/*Image color format*/
enum {
LV_IMG_CF_UNKOWN = 0,
LV_IMG_CF_RAW, /*Contains the file as it is. Needs custom decoder function*/
LV_IMG_CF_RAW, /*Contains the file as it is. Needs custom decoder function*/
LV_IMG_CF_RAW_ALPHA, /*Contains the file as it is. The image has alpha. Needs custom decoder function*/
LV_IMG_CF_RAW_CHROMA_KEYED, /*Contains the file as it is. The image is chroma keyed. Needs custom decoder function*/
LV_IMG_CF_TRUE_COLOR, /*Color format and depth should match with LV_COLOR settings*/
LV_IMG_CF_TRUE_COLOR_ALPHA, /*Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /*Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels will be transparent*/
LV_IMG_CF_TRUE_COLOR, /*Color format and depth should match with LV_COLOR settings*/
LV_IMG_CF_TRUE_COLOR_ALPHA, /*Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /*Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels will be transparent*/
LV_IMG_CF_INDEXED_1BIT, /*Can have 2 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_2BIT, /*Can have 4 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_4BIT, /*Can have 16 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_8BIT, /*Can have 256 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_1BIT, /*Can have 2 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_2BIT, /*Can have 4 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_4BIT, /*Can have 16 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_INDEXED_8BIT, /*Can have 256 different colors in a palette (always chroma keyed)*/
LV_IMG_CF_ALPHA_1BIT, /*Can have one color and it can be drawn or not*/
LV_IMG_CF_ALPHA_2BIT, /*Can have one color but 4 different alpha value*/
LV_IMG_CF_ALPHA_4BIT, /*Can have one color but 16 different alpha value*/
LV_IMG_CF_ALPHA_8BIT, /*Can have one color but 256 different alpha value*/
LV_IMG_CF_ALPHA_1BIT, /*Can have one color and it can be drawn or not*/
LV_IMG_CF_ALPHA_2BIT, /*Can have one color but 4 different alpha value*/
LV_IMG_CF_ALPHA_4BIT, /*Can have one color but 16 different alpha value*/
LV_IMG_CF_ALPHA_8BIT, /*Can have one color but 256 different alpha value*/
};
typedef uint8_t lv_img_cf_t;
@@ -67,8 +67,8 @@ typedef uint8_t lv_img_cf_t;
* the result image converter utility*/
typedef struct
{
lv_img_header_t header;
uint32_t data_size;
lv_img_header_t header;
uint32_t data_size;
const uint8_t * data;
} lv_img_dsc_t;
@@ -144,7 +144,7 @@ lv_img_src_t lv_img_src_get_type(const void * src);
* @param close_fp clode function
*/
void lv_img_decoder_set_custom(lv_img_decoder_info_f_t info_fp, lv_img_decoder_open_f_t open_fp,
lv_img_decoder_read_line_f_t read_fp, lv_img_decoder_close_f_t close_fp);
lv_img_decoder_read_line_f_t read_fp, lv_img_decoder_close_f_t close_fp);
lv_res_t lv_img_dsc_get_info(const char * src, lv_img_header_t * header);
+11 -11
View File
@@ -80,17 +80,17 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
/*Align to middle*/
if(flag & LV_TXT_FLAG_CENTER) {
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(flag & LV_TXT_FLAG_RIGHT) {
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
pos.x += lv_area_get_width(coords) - line_width;
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
pos.x += lv_area_get_width(coords) - line_width;
}
@@ -180,16 +180,16 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_st
/*Align to middle*/
if(flag & LV_TXT_FLAG_CENTER) {
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
font, style->text.letter_space, flag);
pos.x += (lv_area_get_width(coords) - line_width) / 2;
pos.x += (lv_area_get_width(coords) - line_width) / 2;
}
/*Align to the right*/
else if(flag & LV_TXT_FLAG_RIGHT) {
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
pos.x += lv_area_get_width(coords) - line_width;
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag);
pos.x += lv_area_get_width(coords) - line_width;
}
/*Go the next line position*/
+3 -3
View File
@@ -343,7 +343,7 @@ static void line_draw_skew(line_draw_t * main_line, const lv_area_t * mask, cons
lv_draw_aa_hor_seg(main_line->p1.x + pattern[aa_last_corner].x, main_line->p1.y + pattern[aa_last_corner].y - 1,
seg_w + main_line->sx, mask, style->line.color, opa);
lv_draw_aa_hor_seg(main_line->p2.x + pattern[aa_last_corner].x , main_line->p2.y + pattern[aa_last_corner].y + 1,
lv_draw_aa_hor_seg(main_line->p2.x + pattern[aa_last_corner].x, main_line->p2.y + pattern[aa_last_corner].y + 1,
-(seg_w + main_line->sx), mask, style->line.color, opa);
}
@@ -395,7 +395,7 @@ static void line_draw_skew(line_draw_t * main_line, const lv_area_t * mask, cons
/* Fill the gaps
* When stepping in y one pixel remains empty on every corner (don't do this on the first segment ) */
if(i != 0 && pattern[i].x != pattern[i - 1].x && !first_run) {
px_fp(draw_area.x1 , draw_area.y1 - main_line->sy, mask, style->line.color, opa);
px_fp(draw_area.x1, draw_area.y1 - main_line->sy, mask, style->line.color, opa);
}
}
@@ -417,7 +417,7 @@ static void line_draw_skew(line_draw_t * main_line, const lv_area_t * mask, cons
draw_area.y1 = prev_p.y + pattern[i].y;
draw_area.x2 = draw_area.x1 + main_line->p_act.x - prev_p.x;
draw_area.y2 = draw_area.y1;
fill_fp(&draw_area, mask, style->line.color , opa);
fill_fp(&draw_area, mask, style->line.color, opa);
/* Fill the gaps
* When stepping in y one pixel remains empty on every corner */
+13 -13
View File
@@ -1064,15 +1064,15 @@ static void lv_draw_shadow(const lv_area_t * coords, const lv_area_t * mask, con
static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale)
{
/* KNOWN ISSUE
* The algorithm calculates the shadow only above the middle point of the radius (speaking about the left top corner).
* It causes an error because it doesn't consider how long the straight edge is which effects the value of bottom of the corner shadow.
* In addition the straight shadow is drawn from the middles point of the radius however
* the ends of the straight parts still should be effected by the corner shadow.
* It also causes an issue in opacity. A smaller radius means smaller average shadow opacity.
* The solution should be to start `line` from `- swidth` and handle if the straight part is short (or zero) and the value is taken from
* the other corner. `col` also should start from `- swidth`
*/
/* KNOWN ISSUE
* The algorithm calculates the shadow only above the middle point of the radius (speaking about the left top corner).
* It causes an error because it doesn't consider how long the straight edge is which effects the value of bottom of the corner shadow.
* In addition the straight shadow is drawn from the middles point of the radius however
* the ends of the straight parts still should be effected by the corner shadow.
* It also causes an issue in opacity. A smaller radius means smaller average shadow opacity.
* The solution should be to start `line` from `- swidth` and handle if the straight part is short (or zero) and the value is taken from
* the other corner. `col` also should start from `- swidth`
*/
lv_coord_t radius = style->body.radius;
@@ -1203,19 +1203,19 @@ static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask
for(d = 1; d < col; d++) {
if(point_lt.x < ofs_lt.x && point_lt.y < ofs_lt.y) {
px_fp(point_lt.x, point_lt.y , mask, style->body.shadow.color, line_2d_blur[d]);
px_fp(point_lt.x, point_lt.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
if(point_lb.x < ofs_lb.x && point_lb.y > ofs_lb.y) {
px_fp(point_lb.x, point_lb.y , mask, style->body.shadow.color, line_2d_blur[d]);
px_fp(point_lb.x, point_lb.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
if(point_rt.x > ofs_rt.x && point_rt.y < ofs_rt.y) {
px_fp(point_rt.x, point_rt.y , mask, style->body.shadow.color, line_2d_blur[d]);
px_fp(point_rt.x, point_rt.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
if(point_rb.x > ofs_rb.x && point_rb.y > ofs_rb.y) {
px_fp(point_rb.x, point_rb.y , mask, style->body.shadow.color, line_2d_blur[d]);
px_fp(point_rb.x, point_rb.y, mask, style->body.shadow.color, line_2d_blur[d]);
}
point_rb.x++;
+7 -7
View File
@@ -71,9 +71,9 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Pixel out of the mask*/
if(x < mask_p->x1 || x > mask_p->x2 ||
@@ -122,9 +122,9 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
bool union_ok;
lv_vdb_t * vdb_p = lv_vdb_get();
if(!vdb_p) {
LV_LOG_WARN("Invalid VDB pointer");
return;
}
LV_LOG_WARN("Invalid VDB pointer");
return;
}
/*Get the union of cord and mask*/
/* The mask is already truncated to the vdb size
@@ -672,7 +672,7 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
return bg_color;
}
/*Opaque background: use simple mix*/
else if (bg_opa >= LV_OPA_MAX) {
else if(bg_opa >= LV_OPA_MAX) {
return lv_color_mix(fg_color, bg_color, fg_opa);
}
/*Both colors have alpha. Expensive calculation need to be applied*/
+1 -1
View File
@@ -5373,7 +5373,7 @@ lv_font_t lv_font_dejavu_10 = {
#elif USE_LV_FONT_DEJAVU_10 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -3637,7 +3637,7 @@ lv_font_t lv_font_dejavu_10_cyrillic = {
#elif USE_LV_FONT_DEJAVU_10_CYRILLIC == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -5429,7 +5429,7 @@ lv_font_t lv_font_dejavu_10_latin_sup = {
#elif USE_LV_FONT_DEJAVU_10_LATIN_SUP == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -9173,7 +9173,7 @@ lv_font_t lv_font_dejavu_20 = {
#elif USE_LV_FONT_DEJAVU_20 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -6197,7 +6197,7 @@ lv_font_t lv_font_dejavu_20_cyrillic = {
#elif USE_LV_FONT_DEJAVU_20_CYRILLIC == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -9269,7 +9269,7 @@ lv_font_t lv_font_dejavu_20_latin_sup = {
#elif USE_LV_FONT_DEJAVU_20_LATIN_SUP == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -12973,7 +12973,7 @@ lv_font_t lv_font_dejavu_30 = {
#elif USE_LV_FONT_DEJAVU_30 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -8757,7 +8757,7 @@ lv_font_t lv_font_dejavu_30_cyrillic = {
#elif USE_LV_FONT_DEJAVU_30_CYRILLIC == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -13109,7 +13109,7 @@ lv_font_t lv_font_dejavu_30_latin_sup = {
#elif USE_LV_FONT_DEJAVU_30_LATIN_SUP == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -16773,7 +16773,7 @@ lv_font_t lv_font_dejavu_40 = {
#elif USE_LV_FONT_DEJAVU_40 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -16949,7 +16949,7 @@ lv_font_t lv_font_dejavu_40_latin_sup = {
#elif USE_LV_FONT_DEJAVU_40_LATIN_SUP == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2859,7 +2859,7 @@ lv_font_t lv_font_symbol_10 = {
#elif USE_LV_FONT_SYMBOL_10 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -4859,7 +4859,7 @@ lv_font_t lv_font_symbol_20 = {
#elif USE_LV_FONT_SYMBOL_20 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -6858,7 +6858,7 @@ lv_font_t lv_font_symbol_30 = {
#elif USE_LV_FONT_SYMBOL_30 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+1 -1
View File
@@ -8859,7 +8859,7 @@ lv_font_t lv_font_symbol_40 = {
#elif USE_LV_FONT_SYMBOL_40 == 8
.bpp = 8, /*Bit per pixel*/
#endif
.monospace = 0,
.monospace = 0,
.next_page = NULL, /*Pointer to a font extension*/
};
+4 -4
View File
@@ -154,12 +154,12 @@ void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *
if(active == NULL) return;
if(active->driver.disp_flush != NULL) {
LV_LOG_TRACE("disp flush started");
active->driver.disp_flush(x1, y1, x2, y2, color_p);
LV_LOG_TRACE("disp flush ready");
LV_LOG_TRACE("disp flush started");
active->driver.disp_flush(x1, y1, x2, y2, color_p);
LV_LOG_TRACE("disp flush ready");
} else {
LV_LOG_WARN("disp flush function registered");
LV_LOG_WARN("disp flush function registered");
}
}
+3 -3
View File
@@ -112,11 +112,11 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
if(indev->driver.read) {
data->user_data = indev->driver.user_data;
LV_LOG_TRACE("idnev read started");
LV_LOG_TRACE("idnev read started");
cont = indev->driver.read(data);
LV_LOG_TRACE("idnev read finished");
LV_LOG_TRACE("idnev read finished");
} else {
LV_LOG_WARN("indev function registered");
LV_LOG_WARN("indev function registered");
memset(data, 0, sizeof(lv_indev_data_t));
}
+26 -26
View File
@@ -62,7 +62,7 @@ void lv_anim_init(void)
*/
void lv_anim_create(lv_anim_t * anim_p)
{
LV_LOG_TRACE("animation create started")
LV_LOG_TRACE("animation create started")
/* Do not let two animations for the same 'var' with the same 'fp'*/
if(anim_p->fp != NULL) lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/
@@ -82,7 +82,7 @@ void lv_anim_create(lv_anim_t * anim_p)
* It's important if it happens in a ready callback. (see `anim_task`)*/
anim_list_changed = true;
LV_LOG_TRACE("animation created")
LV_LOG_TRACE("animation created")
}
/**
@@ -105,7 +105,7 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
if(a->var == var && (a->fp == fp || fp == NULL)) {
lv_ll_rem(&anim_ll, a);
lv_mem_free(a);
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in the linked list*/
anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in the linked list*/
del = true;
}
@@ -209,40 +209,40 @@ static void anim_task(void * param)
lv_anim_t * a;
LL_READ(anim_ll, a) {
a->has_run = 0;
a->has_run = 0;
}
uint32_t elaps = lv_tick_elaps(last_task_run);
a = lv_ll_get_head(&anim_ll);
while(a != NULL) {
/*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete happened in `anim_ready_handler`
* which could make this linked list reading corrupt because the list is changed meanwhile
*/
anim_list_changed = false;
/*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete happened in `anim_ready_handler`
* which could make this linked list reading corrupt because the list is changed meanwhile
*/
anim_list_changed = false;
if(!a->has_run) {
a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/
a->act_time += elaps;
if(a->act_time >= 0) {
if(a->act_time > a->time) a->act_time = a->time;
if(!a->has_run) {
a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/
a->act_time += elaps;
if(a->act_time >= 0) {
if(a->act_time > a->time) a->act_time = a->time;
int32_t new_value;
new_value = a->path(a);
int32_t new_value;
new_value = a->path(a);
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
/*If the time is elapsed the animation is ready*/
if(a->act_time >= a->time) {
anim_ready_handler(a);
}
}
}
/*If the time is elapsed the animation is ready*/
if(a->act_time >= a->time) {
anim_ready_handler(a);
}
}
}
/* If the linked list changed due to anim. delete then it's not safe to continue
* the reading of the list from here -> start from the head*/
if(anim_list_changed) a = lv_ll_get_head(&anim_ll);
else a = lv_ll_get_next(&anim_ll, a);
/* If the linked list changed due to anim. delete then it's not safe to continue
* the reading of the list from here -> start from the head*/
if(anim_list_changed) a = lv_ll_get_head(&anim_ll);
else a = lv_ll_get_next(&anim_ll, a);
}
last_task_run = lv_tick_get();
+1 -1
View File
@@ -56,7 +56,7 @@ typedef struct _lv_anim_t
uint8_t repeat :1; /*Repeat the animation infinitely*/
/*Animation system use these - user shouldn't set*/
uint8_t playback_now :1; /*Play back is in progress*/
uint32_t has_run :1; /*Indicates the animation has run it this round*/
uint32_t has_run :1; /*Indicates the animation has run it this round*/
} lv_anim_t;
/*Example initialization
+14 -14
View File
@@ -71,17 +71,17 @@ extern "C" {
#define LV_OPA_100 255
#define LV_OPA_COVER 255
#define LV_OPA_MIN 16 /*Opacities below this will be transparent*/
#define LV_OPA_MAX 251 /*Opacities above this will fully cover*/
#define LV_OPA_MIN 16 /*Opacities below this will be transparent*/
#define LV_OPA_MAX 251 /*Opacities above this will fully cover*/
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_SIZE 8
#define LV_COLOR_SIZE 8
#elif LV_COLOR_DEPTH == 8
#define LV_COLOR_SIZE 8
#define LV_COLOR_SIZE 8
#elif LV_COLOR_DEPTH == 16
#define LV_COLOR_SIZE 16
#define LV_COLOR_SIZE 16
#elif LV_COLOR_DEPTH == 32
#define LV_COLOR_SIZE 32
#define LV_COLOR_SIZE 32
#else
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
#endif
@@ -201,10 +201,10 @@ static inline uint8_t lv_color_to1(lv_color_t color)
(color.blue & 0x10)) {
return 1;
# else
if((color.red & 0x10) ||
(color.green_h & 0x20) ||
(color.blue & 0x10)) {
return 1;
if((color.red & 0x10) ||
(color.green_h & 0x20) ||
(color.blue & 0x10)) {
return 1;
# endif
} else {
return 0;
@@ -238,7 +238,7 @@ static inline uint8_t lv_color_to8(lv_color_t color)
# else
lv_color8_t ret;
ret.red = color.red >> 2; /* 5 - 3 = 2*/
ret.green = color.green_h; /* 6 - 3 = 3*/
ret.green = color.green_h; /* 6 - 3 = 3*/
ret.blue = color.blue >> 3; /* 5 - 2 = 3*/
return ret.full;
# endif
@@ -310,9 +310,9 @@ static inline uint32_t lv_color_to32(lv_color_t color)
return ret.full;
# else
lv_color32_t ret;
ret.red = color.red * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
ret.green = ((color.green_h << 3) + color.green_l) * 4; /*(2^8 - 1)/(2^6 - 1) = 255/63 = 4*/
ret.blue = color.blue * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
ret.red = color.red * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
ret.green = ((color.green_h << 3) + color.green_l) * 4; /*(2^8 - 1)/(2^6 - 1) = 255/63 = 4*/
ret.blue = color.blue * 8; /*(2^8 - 1)/(2^5 - 1) = 255/31 = 8*/
ret.alpha = 0xFF;
return ret.full;
# endif
+17 -17
View File
@@ -43,7 +43,7 @@
*/
void lv_font_init(void)
{
lv_font_builtin_init();
lv_font_builtin_init();
}
/**
@@ -72,20 +72,20 @@ void lv_font_add(lv_font_t * child, lv_font_t * parent)
*/
bool lv_font_is_monospace(const lv_font_t * font_p, uint32_t letter)
{
const lv_font_t * font_i = font_p;
int16_t w;
while(font_i != NULL) {
w = font_i->get_width(font_i, letter);
if(w >= 0) {
/*Glyph found*/
if(font_i->monospace) return true;
return false;
const lv_font_t * font_i = font_p;
int16_t w;
while(font_i != NULL) {
w = font_i->get_width(font_i, letter);
if(w >= 0) {
/*Glyph found*/
if(font_i->monospace) return true;
return false;
}
font_i = font_i->next_page;
}
font_i = font_i->next_page;
}
return 0;
return 0;
}
/**
@@ -120,10 +120,10 @@ uint8_t lv_font_get_width(const lv_font_t * font_p, uint32_t letter)
while(font_i != NULL) {
w = font_i->get_width(font_i, letter);
if(w >= 0) {
/*Glyph found*/
uint8_t m = font_i->monospace;
if(m) w = m;
return w;
/*Glyph found*/
uint8_t m = font_i->monospace;
if(m) w = m;
return w;
}
font_i = font_i->next_page;
+2 -2
View File
@@ -57,8 +57,8 @@ typedef struct _lv_font_struct
int16_t (*get_width)(const struct _lv_font_struct *,uint32_t); /*Get a glyph's with with a given font*/
struct _lv_font_struct * next_page; /*Pointer to a font extension*/
uint32_t h_px :8;
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
uint32_t monospace :8; /*Fix width (0: normal width)*/
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
uint32_t monospace :8; /*Fix width (0: normal width)*/
uint16_t glyph_cnt; /*Number of glyphs (letters) in the font*/
} lv_font_t;
+4 -4
View File
@@ -82,7 +82,7 @@ lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mo
}
file_p->file_d = lv_mem_alloc(file_p->drv->file_size);
lv_mem_assert(file_p->file_d);
lv_mem_assert(file_p->file_d);
if(file_p->file_d == NULL) {
file_p->drv = NULL;
return LV_FS_RES_OUT_OF_MEM; /* Out of memory */
@@ -253,7 +253,7 @@ lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos)
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
lv_fs_res_t lv_fs_trunc (lv_fs_file_t * file_p)
lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p)
{
if(file_p->drv == NULL) {
return LV_FS_RES_INV_PARAM;
@@ -295,7 +295,7 @@ lv_fs_res_t lv_fs_size(lv_fs_file_t * file_p, uint32_t * size)
* @param newname path with the new name
* @return LV_FS_RES_OK or any error from 'fs_res_t'
*/
lv_fs_res_t lv_fs_rename (const char * oldname, const char * newname)
lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname)
{
if(!oldname || !newname) return LV_FS_RES_INV_PARAM;
@@ -343,7 +343,7 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
}
rddir_p->dir_d = lv_mem_alloc(rddir_p->drv->rddir_size);
lv_mem_assert(rddir_p->dir_d);
lv_mem_assert(rddir_p->dir_d);
if(rddir_p->dir_d == NULL) {
rddir_p->dir_d = NULL;
return LV_FS_RES_OUT_OF_MEM; /* Out of memory */
+22 -22
View File
@@ -54,14 +54,14 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t n_size)
#ifdef LV_MEM_ENV64
/*Round the size up to 8*/
if(n_size & 0x7) {
n_size = n_size & (~0x7);
n_size = n_size & (~0x7);
n_size += 8;
}
#else
/*Round the size up to 4*/
if(n_size & 0x3) {
n_size = n_size & (~0x3);
n_size += 4;
n_size = n_size & (~0x3);
n_size += 4;
}
#endif
@@ -272,12 +272,12 @@ void * lv_ll_get_tail(const lv_ll_t * ll_p)
* @param n_act pointer a node
* @return pointer to the next node
*/
void * lv_ll_get_next(const lv_ll_t * ll_p,const void * n_act)
void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
{
void * next = NULL;
if(ll_p != NULL) {
const lv_ll_node_t * n_act_d = n_act;
const lv_ll_node_t * n_act_d = n_act;
memcpy(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
}
@@ -290,12 +290,12 @@ void * lv_ll_get_next(const lv_ll_t * ll_p,const void * n_act)
* @param n_act pointer a node
* @return pointer to the previous node
*/
void * lv_ll_get_prev(const lv_ll_t * ll_p,const void * n_act)
void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
{
void * prev = NULL;
if(ll_p != NULL) {
const lv_ll_node_t * n_act_d = n_act;
const lv_ll_node_t * n_act_d = n_act;
memcpy(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
}
@@ -321,20 +321,20 @@ void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
if(n_act == n_after) return; /*Can't move before itself*/
void * n_before = lv_ll_get_prev(ll_p, n_after);
if(n_act == n_before) return; /*Already before `n_after`*/
void * n_before = lv_ll_get_prev(ll_p, n_after);
if(n_act == n_before) return; /*Already before `n_after`*/
/*It's much easier to remove from the list and add again*/
lv_ll_rem(ll_p, n_act);
/*Add again by setting the prev. and next nodes*/
node_set_next(ll_p, n_before, n_act);
node_set_prev(ll_p, n_act, n_before);
node_set_prev(ll_p, n_after, n_act);
node_set_next(ll_p, n_act, n_after);
node_set_next(ll_p, n_before, n_act);
node_set_prev(ll_p, n_act, n_before);
node_set_prev(ll_p, n_after, n_act);
node_set_next(ll_p, n_act, n_after);
/*If `n_act` was moved before NULL then it become the new tail*/
if(n_after == NULL) ll_p->tail = n_act;
/*If `n_act` was moved before NULL then it become the new tail*/
if(n_after == NULL) ll_p->tail = n_act;
}
/**********************
@@ -349,11 +349,11 @@ void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
*/
static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * prev)
{
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(prev) memcpy(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
else memset(act + LL_PREV_P_OFFSET(ll_p), 0, node_p_size);
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(prev) memcpy(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
else memset(act + LL_PREV_P_OFFSET(ll_p), 0, node_p_size);
}
/**
@@ -364,10 +364,10 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
*/
static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next)
{
if(act == NULL) return; /*Can't set the next node of `NULL`*/
if(act == NULL) return; /*Can't set the next node of `NULL`*/
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(next) memcpy(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(next) memcpy(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
else memset(act + LL_NEXT_P_OFFSET(ll_p), 0, node_p_size);
}
+9 -9
View File
@@ -27,7 +27,7 @@
/**********************
* STATIC VARIABLES
**********************/
static void (*print_cb)(lv_log_level_t , const char *, uint32_t , const char *);
static void (*print_cb)(lv_log_level_t, const char *, uint32_t, const char *);
/**********************
* MACROS
@@ -42,9 +42,9 @@ static void (*print_cb)(lv_log_level_t , const char *, uint32_t , const char *)
* @param f a function pointer:
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)`
*/
void lv_log_register_print(void f(lv_log_level_t , const char *, uint32_t , const char *))
void lv_log_register_print(void f(lv_log_level_t, const char *, uint32_t, const char *))
{
print_cb = f;
print_cb = f;
}
/**
@@ -56,17 +56,17 @@ void lv_log_register_print(void f(lv_log_level_t , const char *, uint32_t , con
*/
void lv_log_add(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
{
if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/
if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/
if(level >= LV_LOG_LEVEL) {
if(level >= LV_LOG_LEVEL) {
#if LV_LOG_PRINTF
static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error"};
printf("%s: %s \t(%s #%d)\n", lvl_prefix[level], dsc, file, line);
static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error"};
printf("%s: %s \t(%s #%d)\n", lvl_prefix[level], dsc, file, line);
#else
if(print_cb) print_cb(level, file, line, dsc);
if(print_cb) print_cb(level, file, line, dsc);
#endif
}
}
}
/**********************
+5 -5
View File
@@ -49,7 +49,7 @@ typedef uint8_t lv_log_level_t;
* @param f a function pointer:
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)`
*/
void lv_log_register_print(void f(lv_log_level_t , const char *, uint32_t , const char *));
void lv_log_register_print(void f(lv_log_level_t, const char *, uint32_t, const char *));
/**
* Add a log
@@ -64,10 +64,10 @@ void lv_log_add(lv_log_level_t level, const char * file, uint32_t line, const ch
* MACROS
**********************/
#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
#else /*USE_LV_LOG*/

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