BigW Consortium Gitlab

Commit dc17c3d4 by Gabor

code formatting

parent 87a9c371
...@@ -25,16 +25,12 @@ ...@@ -25,16 +25,12 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode); static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode);
static void lv_btns_init(void);
static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p); static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p);
static void lv_btns_init(void);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
/*-----------------
* Style definition
*-----------------*/
static lv_btns_t lv_btns_def; static lv_btns_t lv_btns_def;
static lv_btns_t lv_btns_transp; static lv_btns_t lv_btns_transp;
static lv_btns_t lv_btns_border; static lv_btns_t lv_btns_border;
...@@ -366,6 +362,22 @@ static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod ...@@ -366,6 +362,22 @@ static bool lv_btn_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
} }
/** /**
* Load the corresponding style according to the state to 'rects' in 'lv_btns_t'
* @param obj_dp pointer to a button object
*/
static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p)
{
lv_btn_state_t state = lv_btn_get_state(obj_dp);
lv_btns_t * btns_p = lv_obj_get_style(obj_dp);
/*Load the style*/
memcpy(rects_p, &btns_p->rects, sizeof(lv_rects_t));
rects_p->objs.color = btns_p->mcolor[state];
rects_p->gcolor = btns_p->gcolor[state];
rects_p->bcolor = btns_p->bcolor[state];
}
/**
* Initialize the button styles * Initialize the button styles
*/ */
static void lv_btns_init(void) static void lv_btns_init(void)
...@@ -422,20 +434,4 @@ static void lv_btns_init(void) ...@@ -422,20 +434,4 @@ static void lv_btns_init(void)
lv_btns_border.rects.vpad = 5 * LV_STYLE_MULT; lv_btns_border.rects.vpad = 5 * LV_STYLE_MULT;
} }
/**
* Load the corresponding style according to the state to 'rects' in 'lv_btns_t'
* @param obj_dp pointer to a button object
*/
static void lv_btn_style_load(lv_obj_t * obj_dp, lv_rects_t * rects_p)
{
lv_btn_state_t state = lv_btn_get_state(obj_dp);
lv_btns_t * btns_p = lv_obj_get_style(obj_dp);
/*Load the style*/
memcpy(rects_p, &btns_p->rects, sizeof(lv_rects_t));
rects_p->objs.color = btns_p->mcolor[state];
rects_p->gcolor = btns_p->gcolor[state];
rects_p->bcolor = btns_p->bcolor[state];
}
#endif #endif
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
#if 0 /*Not necessary*/ #if 0 /*Not necessary*/
static bool lv_btnm_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode); static bool lv_btnm_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode);
#endif #endif
static void lv_btnms_init(void);
static uint8_t lv_btnm_get_width_unit(const char * btn_str); static uint8_t lv_btnm_get_width_unit(const char * btn_str);
static void lv_btnm_create_btns(lv_obj_t * obj_dp, const char ** map_p); static void lv_btnm_create_btns(lv_obj_t * obj_dp, const char ** map_p);
static bool lv_btnm_btn_release_action(lv_obj_t * obj_dp, lv_dispi_t * dispi_p); static bool lv_btnm_btn_release_action(lv_obj_t * obj_dp, lv_dispi_t * dispi_p);
static void lv_btnms_init(void);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
...@@ -223,6 +223,27 @@ void lv_btnm_set_cb(lv_obj_t * obj_dp, lv_btnm_callback_t cb) ...@@ -223,6 +223,27 @@ void lv_btnm_set_cb(lv_obj_t * obj_dp, lv_btnm_callback_t cb)
*====================*/ *====================*/
/** /**
* Get the current map of a button matrix
* @param obj_dp pointer to a button matrix object
* @return the current map
*/
const char ** lv_btnm_get_map(lv_obj_t * obj_dp)
{
return LV_EA(obj_dp, lv_btnm_ext_t)->map_p;
}
/**
* Get a the callback function of the buttons on a button matrix
* @param obj_dp: pointer to button matrix object
* @return pointer to the callback function
*/
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * obj_dp)
{
return LV_EA(obj_dp, lv_btnm_ext_t)->cb;
}
/**
* Return with a pointer to a built-in style and/or copy it to a variable * Return with a pointer to a built-in style and/or copy it to a variable
* @param style a style name from lv_btnms_builtin_t enum * @param style a style name from lv_btnms_builtin_t enum
* @param copy_p copy the style to this variable. (NULL if unused) * @param copy_p copy the style to this variable. (NULL if unused)
...@@ -256,26 +277,6 @@ lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy_p) ...@@ -256,26 +277,6 @@ lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy_p)
return style_p; return style_p;
} }
/**
* Get the current map of a button matrix
* @param obj_dp pointer to a button matrix object
* @return the current map
*/
const char ** lv_btnm_get_map(lv_obj_t * obj_dp)
{
return LV_EA(obj_dp, lv_btnm_ext_t)->map_p;
}
/**
* Get a the callback function of the buttons on a button matrix
* @param obj_dp: pointer to button matrix object
* @return pointer to the callback function
*/
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * obj_dp)
{
return LV_EA(obj_dp, lv_btnm_ext_t)->cb;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "lv_conf.h" #include "lv_conf.h"
#if USE_LV_CHART != 0 #if USE_LV_CHART != 0
#include <lvgl/lv_objx/lv_chart.h> #include "lv_chart.h"
#include "lvgl/lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
/********************* /*********************
* DEFINES * DEFINES
...@@ -39,8 +39,8 @@ static void lv_chart_draw_cols(lv_obj_t* obj_dp, const area_t * mask_p); ...@@ -39,8 +39,8 @@ static void lv_chart_draw_cols(lv_obj_t* obj_dp, const area_t * mask_p);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_design_f_t ancestor_design_fp;
static lv_charts_t lv_charts_def; static lv_charts_t lv_charts_def;
static lv_design_f_t ancestor_design_fp;
/********************** /**********************
* MACROS * MACROS
......
...@@ -172,6 +172,17 @@ void lv_led_tgl(lv_obj_t * obj_dp) ...@@ -172,6 +172,17 @@ void lv_led_tgl(lv_obj_t * obj_dp)
*====================*/ *====================*/
/** /**
* Get the brightness of a LEd object
* @param obj_dp pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_bright(lv_obj_t * obj_dp)
{
lv_led_ext_t * ext_dp = lv_obj_get_ext(obj_dp);
return ext_dp->bright;
}
/**
* Return with a pointer to a built-in style and/or copy it to a variable * Return with a pointer to a built-in style and/or copy it to a variable
* @param style a style name from lv_leds_builtin_t enum * @param style a style name from lv_leds_builtin_t enum
* @param copy_p copy the style to this variable. (NULL if unused) * @param copy_p copy the style to this variable. (NULL if unused)
...@@ -209,22 +220,10 @@ lv_leds_t * lv_leds_get(lv_leds_builtin_t style, lv_leds_t * copy_p) ...@@ -209,22 +220,10 @@ lv_leds_t * lv_leds_get(lv_leds_builtin_t style, lv_leds_t * copy_p)
return style_p; return style_p;
} }
/**
* Get the brightness of a LEd object
* @param obj_dp pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_bright(lv_obj_t * obj_dp)
{
lv_led_ext_t * ext_dp = lv_obj_get_ext(obj_dp);
return ext_dp->bright;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
/** /**
* Handle the drawing related tasks of the leds * Handle the drawing related tasks of the leds
* @param obj_dp pointer to an object * @param obj_dp pointer to an object
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static bool lv_templ_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode); static bool lv_templ_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode);
static void lv_temps_init(void);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
...@@ -127,6 +128,14 @@ bool lv_templ_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param) ...@@ -127,6 +128,14 @@ bool lv_templ_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param)
*/ */
lv_templs_t * lv_templs_get(lv_templs_builtin_t style, lv_templs_t * copy_p) lv_templs_t * lv_templs_get(lv_templs_builtin_t style, lv_templs_t * copy_p)
{ {
static bool style_inited = false;
/*Make the style initialization if it is not done yet*/
if(style_inited == false) {
lv_temps_init();
style_inited = true;
}
lv_templs_t *style_p; lv_templs_t *style_p;
switch(style) { switch(style) {
...@@ -174,4 +183,12 @@ static bool lv_templ_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_m ...@@ -174,4 +183,12 @@ static bool lv_templ_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_m
} }
/**
* Initialize the template styles
*/
static void lv_temps_init(void)
{
/*Default style*/
}
#endif #endif
...@@ -34,10 +34,9 @@ static void lv_pages_init(void);; ...@@ -34,10 +34,9 @@ static void lv_pages_init(void);;
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_design_f_t ancestor_design_f;
static lv_pages_t lv_pages_def; static lv_pages_t lv_pages_def;
static lv_pages_t lv_pages_transp; static lv_pages_t lv_pages_transp;
static lv_design_f_t ancestor_design_f;
/********************** /**********************
* MACROS * MACROS
...@@ -273,6 +272,10 @@ static bool lv_scrolling_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param) ...@@ -273,6 +272,10 @@ static bool lv_scrolling_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param)
return obj_valid; return obj_valid;
} }
/*=====================
* Setter functions
*====================*/
/** /**
* Glue the object to the page. After it the page can be moved (dragged) with this object too. * Glue the object to the page. After it the page can be moved (dragged) with this object too.
* @param obj_dp pointer to an object on a page * @param obj_dp pointer to an object on a page
...@@ -284,6 +287,11 @@ void lv_page_glue_obj(lv_obj_t* obj_dp, bool en) ...@@ -284,6 +287,11 @@ void lv_page_glue_obj(lv_obj_t* obj_dp, bool en)
lv_obj_set_drag(obj_dp, en); lv_obj_set_drag(obj_dp, en);
} }
/*=====================
* Getter functions
*====================*/
/** /**
* Return with a pointer to a built-in style and/or copy it to a variable * Return with a pointer to a built-in style and/or copy it to a variable
* @param style a style name from lv_pages_builtin_t enum * @param style a style name from lv_pages_builtin_t enum
...@@ -321,17 +329,6 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * to_copy) ...@@ -321,17 +329,6 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * to_copy)
return style_p; return style_p;
} }
/*=====================
* Setter functions
*====================*/
/*=====================
* Getter functions
*====================*/
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
......
...@@ -34,7 +34,7 @@ static void lv_pbs_init(void); ...@@ -34,7 +34,7 @@ static void lv_pbs_init(void);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static bool (*ancestor_design_fp)(lv_obj_t*, const area_t *, lv_design_mode_t); static lv_design_f_t ancestor_design_fp;
static lv_pbs_t lv_pbs_def; static lv_pbs_t lv_pbs_def;
/********************** /**********************
......
...@@ -438,7 +438,16 @@ static bool lv_ta_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode ...@@ -438,7 +438,16 @@ static bool lv_ta_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode
return true; return true;
} }
/**
* An extended label design. Calls the normal label design function and it draws a cursor.
* @param obj_dp pointer to a text area object
* @param mask_p the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW_MAIN: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @return return true/false, depends on 'mode'
*/
static bool lv_ta_label_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode) static bool lv_ta_label_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mode_t mode)
{ {
if(mode == LV_DESIGN_COVER_CHK) { if(mode == LV_DESIGN_COVER_CHK) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment