feat(scale): add the lv_scale widget (#4196)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Carlos Diaz
2023-08-31 07:09:40 -06:00
committed by GitHub
parent ca54d127c2
commit 5c1fc63647
18 changed files with 1855 additions and 0 deletions

View File

@@ -845,6 +845,9 @@ menu "LVGL configuration"
int "Number of extra 'pages' when the controller is infinite."
default 7
depends on LV_USE_ROLLER
config LV_USE_SCALE
bool "Scale."
default y if !LV_CONF_MINIMAL
config LV_USE_SLIDER
bool "Slider. Requires: lv_bar."
select LV_USE_BAR

View File

@@ -61,6 +61,7 @@ widgets = {
"meter": "Meter",
"msgbox": "Message box",
"roller": "Roller",
"scale":"Scale",
"slider": "Slider",
"span": "Span",
"spinbox": "Spinbox",

BIN
docs/misc/scale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -30,6 +30,7 @@ Widgets
meter
msgbox
roller
scale
slider
span
spinbox

67
docs/widgets/scale.rst Normal file
View File

@@ -0,0 +1,67 @@
Scale (lv_scale)
===============
Overview
********
Scale allows you to have a linear scale with ranges and sections with custom styling.
Parts and Styles
****************
The scale widget is divided in the following three parts:
- :cpp:enumerator: `LV_PART_MAIN` Main line. See blue line in the example image.
- :cpp:enumerator: `LV_PART_ITEMS` Minor ticks. See red minor ticks in the example image.
- :cpp:enumerator: `LV_PART_INDICATOR` Major ticks and its labels (if enabled). See pink labels and green major ticks in the example image.
![](/misc/scale.png "Scale example")
Usage
*****
Set ranges
----------
The minor and major range (values of each tick) are configured with :cpp:expr: `lv_scale_set_range(scale, minor_range, major_range)`.
Configure ticks
---------------
Set the number of total ticks with :cpp:expr: `lv_scale_set_total_tick_count(scale, total_tick_count)` and then configure the major tick being every Nth ticks with :cpp:expr: `lv_scale_set_major_tick_every(scale, nth_tick)`.
Labels on major ticks can be configured with :cpp:expr: `lv_scale_set_label_show(scale, show_label)`, set `show_label` to true if labels should be drawn, :cpp:expr: `false` to hide them. If instead of a numerical value in the major ticks a text is required they can be set with :cpp:expr: `lv_scale_set_text_src(scale, custom_labels)` using NULL as the last element, i.e. :cpp:expr: `static char * custom_labels[3] = {"One", "Two", NULL};`
Sections
--------
A section is the space between a minor and a major range. They can be created with :cpp:expr: `lv_scale_add_section(scale)` and it handles back an :cpp:expr: `lv_scale_section_t` pointer.
The range of the section is configured with :cpp:expr: `lv_scale_section_set_range(section, minor_range, major_range)`. The style of each of the three parts of the scale section can be set with :cpp:expr: `lv_scale_section_set_style(section, PART, style_pointer)`, where `PART` can be :cpp:enumarator: `LV_PART_MAIN`, :cpp:enumarator: `LV_PART_ITEMS` or :cpp:enumarator: `LV_PART_INDICATOR`, :cpp:expr: `style_pointer` should point to a global or static :cpp:expr: `lv_style_t` variable.
For labels the following properties can be configured:
:cpp:expr: `lv_style_set_text_font`, :cpp:expr: `lv_style_set_text_color`, :cpp:expr: `lv_style_set_text_letter_space`, :cpp:expr: `lv_style_set_text_opa`.
For lines (main line, major and minor ticks) the following properties can be configured:
:cpp:expr: `lv_style_set_line_color`, :cpp:expr: `lv_style_set_line_width`.
Events
******
No events supported by this widget.
Keys
****
No keys supported by this widget.
Example
*******
.. include:: ../../../examples/widgets/scale/index.rst
API
***
.. doxygenfile:: lv_scale.h
:project: lvgl

View File

@@ -115,6 +115,12 @@ void lv_example_roller_1(void);
void lv_example_roller_2(void);
//void lv_example_roller_3(void);
void lv_example_scale_1(void);
void lv_example_scale_2(void);
void lv_example_scale_3(void);
void lv_example_scale_4(void);
void lv_example_scale_5(void);
void lv_example_slider_1(void);
void lv_example_slider_2(void);
void lv_example_slider_3(void);

View File

@@ -0,0 +1,6 @@
Scale with customized section style
""""""""""""""""
.. lv_example:: widgets/scale/lv_example_scale_1
:language: c

View File

@@ -0,0 +1,24 @@
#include "../../lv_examples.h"
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
/**
* A simple horizontal scale
*/
void lv_example_scale_1(void)
{
lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, lv_pct(80), 100);
lv_scale_set_mode(scale, LV_SCALE_MODE_HORIZONTAL_BOTTOM);
lv_obj_center(scale);
lv_scale_set_label_show(scale, true);
lv_scale_set_total_tick_count(scale, 30);
lv_scale_set_major_tick_every(scale, 5);
lv_scale_set_major_tick_length(scale, 10);
lv_scale_set_minor_tick_length(scale, 5);
lv_scale_set_range(scale, 10, 40);
}
#endif

View File

@@ -0,0 +1,83 @@
#include "../../lv_examples.h"
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
/**
* An vertical scale with section and custom styling
*/
void lv_example_scale_2(void)
{
lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, 60, 200);
lv_scale_set_label_show(scale, true);
lv_scale_set_mode(scale, LV_SCALE_MODE_VERTICAL_RIGHT);
lv_obj_center(scale);
lv_scale_set_total_tick_count(scale, 20);
lv_scale_set_major_tick_every(scale, 5);
lv_scale_set_major_tick_length(scale, 10);
lv_scale_set_minor_tick_length(scale, 5);
lv_scale_set_range(scale, 0, 100);
static char * custom_labels[] = {"0 °C", "25 °C", "50 °C", "75 °C", "100 °C", NULL};
lv_scale_set_text_src(scale, custom_labels);
static lv_style_t indicator_style;
lv_style_init(&indicator_style);
/* Label style properties */
lv_style_set_text_font(&indicator_style, &lv_font_montserrat_14);
lv_style_set_text_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
/* Major tick properties */
lv_style_set_line_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
lv_style_set_width(&indicator_style, 10U); /*Tick length*/
lv_style_set_line_width(&indicator_style, 2U); /*Tick width*/
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
static lv_style_t minor_ticks_style;
lv_style_init(&minor_ticks_style);
lv_style_set_line_color(&minor_ticks_style, lv_palette_lighten(LV_PALETTE_BLUE, 2));
lv_style_set_width(&minor_ticks_style, 5U); /*Tick length*/
lv_style_set_line_width(&minor_ticks_style, 2U); /*Tick width*/
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
static lv_style_t main_line_style;
lv_style_init(&main_line_style);
/* Main line properties */
lv_style_set_line_color(&main_line_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
lv_style_set_line_width(&main_line_style, 2U); // Tick width
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
/* Add a section */
static lv_style_t section_minor_tick_style;
static lv_style_t section_label_style;
static lv_style_t section_main_line_style;
lv_style_init(&section_label_style);
lv_style_init(&section_minor_tick_style);
lv_style_init(&section_main_line_style);
/* Label style properties */
lv_style_set_text_font(&section_label_style, &lv_font_montserrat_14);
lv_style_set_text_color(&section_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
lv_style_set_line_color(&section_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
lv_style_set_line_width(&section_label_style, 5U); /*Tick width*/
lv_style_set_line_color(&section_minor_tick_style, lv_palette_lighten(LV_PALETTE_RED, 2));
lv_style_set_line_width(&section_minor_tick_style, 4U); /*Tick width*/
/* Main line properties */
lv_style_set_line_color(&section_main_line_style, lv_palette_darken(LV_PALETTE_RED, 3));
lv_style_set_line_width(&section_main_line_style, 4U); /*Tick width*/
/* Configure section styles */
lv_scale_section_t * section = lv_scale_add_section(scale);
lv_scale_section_set_range(section, 80, 100);
lv_scale_section_set_style(section, LV_PART_INDICATOR, &section_label_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &section_minor_tick_style);
lv_scale_section_set_style(section, LV_PART_MAIN, &section_main_line_style);
}
#endif

View File

@@ -0,0 +1,27 @@
#include "../../lv_examples.h"
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
/**
* A simple round scale
*/
void lv_example_scale_3(void)
{
lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, 150, 150);
lv_scale_set_mode(scale, LV_SCALE_MODE_ROUND_INNER);
lv_obj_set_style_bg_opa(scale, LV_OPA_COVER, 0);
lv_obj_set_style_bg_color(scale, lv_palette_lighten(LV_PALETTE_RED, 5), 0);
lv_obj_set_style_radius(scale, LV_RADIUS_CIRCLE, 0);
lv_obj_center(scale);
lv_scale_set_label_show(scale, true);
lv_scale_set_total_tick_count(scale, 30);
lv_scale_set_major_tick_every(scale, 5);
lv_scale_set_major_tick_length(scale, 10);
lv_scale_set_minor_tick_length(scale, 5);
lv_scale_set_range(scale, 10, 40);
}
#endif

View File

@@ -0,0 +1,83 @@
#include "../../lv_examples.h"
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
/**
* A round scale with section and custom styling
*/
void lv_example_scale_4(void)
{
lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, 150, 150);
lv_scale_set_label_show(scale, true);
lv_scale_set_mode(scale, LV_SCALE_MODE_ROUND_OUTTER);
lv_obj_center(scale);
lv_scale_set_total_tick_count(scale, 20);
lv_scale_set_major_tick_every(scale, 5);
lv_scale_set_major_tick_length(scale, 10);
lv_scale_set_minor_tick_length(scale, 5);
lv_scale_set_range(scale, 0, 100);
static char * custom_labels[] = {"0 °C", "25 °C", "50 °C", "75 °C", "100 °C", NULL};
lv_scale_set_text_src(scale, custom_labels);
static lv_style_t indicator_style;
lv_style_init(&indicator_style);
/* Label style properties */
lv_style_set_text_font(&indicator_style, &lv_font_montserrat_14);
lv_style_set_text_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
/* Major tick properties */
lv_style_set_line_color(&indicator_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
lv_style_set_width(&indicator_style, 10U); /*Tick length*/
lv_style_set_line_width(&indicator_style, 2U); /*Tick width*/
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
static lv_style_t minor_ticks_style;
lv_style_init(&minor_ticks_style);
lv_style_set_line_color(&minor_ticks_style, lv_palette_lighten(LV_PALETTE_BLUE, 2));
lv_style_set_width(&minor_ticks_style, 5U); /*Tick length*/
lv_style_set_line_width(&minor_ticks_style, 2U); /*Tick width*/
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
static lv_style_t main_line_style;
lv_style_init(&main_line_style);
/* Main line properties */
lv_style_set_arc_color(&main_line_style, lv_palette_darken(LV_PALETTE_BLUE, 3));
lv_style_set_arc_width(&main_line_style, 2U); /*Tick width*/
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
/* Add a section */
static lv_style_t section_minor_tick_style;
static lv_style_t section_label_style;
static lv_style_t section_main_line_style;
lv_style_init(&section_label_style);
lv_style_init(&section_minor_tick_style);
lv_style_init(&section_main_line_style);
/* Label style properties */
lv_style_set_text_font(&section_label_style, &lv_font_montserrat_14);
lv_style_set_text_color(&section_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
lv_style_set_line_color(&section_label_style, lv_palette_darken(LV_PALETTE_RED, 3));
lv_style_set_line_width(&section_label_style, 5U); /*Tick width*/
lv_style_set_line_color(&section_minor_tick_style, lv_palette_lighten(LV_PALETTE_RED, 2));
lv_style_set_line_width(&section_minor_tick_style, 4U); /*Tick width*/
/* Main line properties */
lv_style_set_arc_color(&section_main_line_style, lv_palette_darken(LV_PALETTE_RED, 3));
lv_style_set_arc_width(&section_main_line_style, 4U); /*Tick width*/
/* Configure section styles */
lv_scale_section_t * section = lv_scale_add_section(scale);
lv_scale_section_set_range(section, 80, 100);
lv_scale_section_set_style(section, LV_PART_INDICATOR, &section_label_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &section_minor_tick_style);
lv_scale_section_set_style(section, LV_PART_MAIN, &section_main_line_style);
}
#endif

View File

@@ -0,0 +1,78 @@
#include "../../lv_examples.h"
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
/**
* An scale with section and custom styling
*/
void lv_example_scale_5(void)
{
lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, lv_disp_get_hor_res(NULL) / 2, lv_disp_get_ver_res(NULL) / 2);
lv_scale_set_label_show(scale, true);
lv_scale_set_total_tick_count(scale, 10);
lv_scale_set_major_tick_every(scale, 5);
lv_scale_set_major_tick_length(scale, 10);
lv_scale_set_minor_tick_length(scale, 5);
lv_scale_set_range(scale, 25, 35);
static char * custom_labels[3] = {"One", "Two", NULL};
lv_scale_set_text_src(scale, custom_labels);
static lv_style_t indicator_style;
lv_style_init(&indicator_style);
/* Label style properties */
lv_style_set_text_font(&indicator_style, &lv_font_montserrat_14);
lv_style_set_text_color(&indicator_style, lv_color_hex(0xff00ff));
/* Major tick properties */
lv_style_set_line_color(&indicator_style, lv_color_hex(0x00ff00));
lv_style_set_width(&indicator_style, 10U); // Tick length
lv_style_set_line_width(&indicator_style, 2U); // Tick width
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
static lv_style_t minor_ticks_style;
lv_style_init(&minor_ticks_style);
lv_style_set_line_color(&minor_ticks_style, lv_color_hex(0xff0000));
lv_style_set_width(&minor_ticks_style, 5U); // Tick length
lv_style_set_line_width(&minor_ticks_style, 2U); // Tick width
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
static lv_style_t main_line_style;
lv_style_init(&main_line_style);
/* Main line properties */
lv_style_set_line_color(&main_line_style, lv_color_hex(0x0000ff));
lv_style_set_line_width(&main_line_style, 2U); // Tick width
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
lv_obj_center(scale);
/* Add a section */
static lv_style_t section_minor_tick_style;
static lv_style_t section_label_style;
lv_style_init(&section_label_style);
lv_style_init(&section_minor_tick_style);
/* Label style properties */
lv_style_set_text_font(&section_label_style, &lv_font_montserrat_14);
lv_style_set_text_color(&section_label_style, lv_color_hex(0xff0000));
lv_style_set_text_letter_space(&section_label_style, 10);
lv_style_set_text_opa(&section_label_style, LV_OPA_50);
lv_style_set_line_color(&section_label_style, lv_color_hex(0xff0000));
// lv_style_set_width(&section_label_style, 20U); // Tick length
lv_style_set_line_width(&section_label_style, 5U); // Tick width
lv_style_set_line_color(&section_minor_tick_style, lv_color_hex(0x0000ff));
// lv_style_set_width(&section_label_style, 20U); // Tick length
lv_style_set_line_width(&section_minor_tick_style, 4U); // Tick width
/* Configure section styles */
lv_scale_section_t * section = lv_scale_add_section(scale);
lv_scale_section_set_range(section, 25, 30);
lv_scale_section_set_style(section, LV_PART_INDICATOR, &section_label_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &section_minor_tick_style);
}
#endif

View File

@@ -471,6 +471,8 @@
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
#define LV_USE_SCALE 1
#define LV_USE_SLIDER 1 /*Requires: lv_bar*/
#define LV_USE_SPAN 1

1
lvgl.h
View File

@@ -67,6 +67,7 @@ extern "C" {
#include "src/widgets/meter/lv_meter.h"
#include "src/widgets/msgbox/lv_msgbox.h"
#include "src/widgets/roller/lv_roller.h"
#include "src/widgets/scale/lv_scale.h"
#include "src/widgets/slider/lv_slider.h"
#include "src/widgets/span/lv_span.h"
#include "src/widgets/spinbox/lv_spinbox.h"

View File

@@ -1537,6 +1537,18 @@
#endif
#endif
#ifndef LV_USE_SCALE
#ifdef _LV_KCONFIG_PRESENT
#ifdef CONFIG_LV_USE_SCALE
#define LV_USE_SCALE CONFIG_LV_USE_SCALE
#else
#define LV_USE_SCALE 0
#endif
#else
#define LV_USE_SCALE 1
#endif
#endif
#ifndef LV_USE_SLIDER
#ifdef _LV_KCONFIG_PRESENT
#ifdef CONFIG_LV_USE_SLIDER

View File

@@ -147,6 +147,10 @@ typedef struct {
#if LV_USE_LED
lv_style_t led;
#endif
#if LV_USE_SCALE
lv_style_t scale;
#endif
} my_theme_styles_t;
typedef enum {
@@ -639,6 +643,14 @@ static void style_init(struct _my_theme_t * theme)
lv_style_set_shadow_color(&theme->styles.led, lv_color_white());
lv_style_set_shadow_spread(&theme->styles.led, lv_disp_dpx(theme->base.disp, 5));
#endif
#if LV_USE_SCALE
style_init_reset(&theme->styles.scale);
lv_style_set_line_color(&theme->styles.scale, lv_color_black());
lv_style_set_line_width(&theme->styles.scale, 2U);
lv_style_set_arc_color(&theme->styles.scale, lv_color_black());
lv_style_set_arc_width(&theme->styles.scale, 2U);
#endif
}
/**********************
@@ -1165,6 +1177,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
lv_obj_add_style(obj, &theme->styles.led, 0);
}
#endif
#if LV_USE_SCALE
else if(lv_obj_check_type(obj, &lv_scale_class)) {
lv_obj_add_style(obj, &theme->styles.scale, LV_PART_MAIN);
lv_obj_add_style(obj, &theme->styles.scale, LV_PART_INDICATOR);
lv_obj_add_style(obj, &theme->styles.scale, LV_PART_ITEMS);
}
#endif
}
/**********************

1227
src/widgets/scale/lv_scale.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,214 @@
/**
* @file lv_scale.h
*
*/
#ifndef LV_SCALE_H
#define LV_SCALE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_SCALE != 0
#include "../../core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**Default value of total minor ticks. */
#define LV_SCALE_TOTAL_TICK_COUNT_DEFAULT (10U)
LV_EXPORT_CONST_INT(LV_SCALE_TOTAL_TICK_COUNT_DEFAULT);
/**Default value of major tick every nth ticks. */
#define LV_SCALE_MAJOR_TICK_EVERY_DEFAULT (5U)
LV_EXPORT_CONST_INT(LV_SCALE_MAJOR_TICK_EVERY_DEFAULT);
/**Default value of scale label enabled. */
#define LV_SCALE_LABEL_ENABLED_DEFAULT (1U)
LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ENABLED_DEFAULT);
/**********************
* TYPEDEFS
**********************/
/**
* Scale mode
*/
enum {
LV_SCALE_MODE_HORIZONTAL_TOP = 0x00U,
LV_SCALE_MODE_HORIZONTAL_BOTTOM = 0x01U,
LV_SCALE_MODE_VERTICAL_LEFT = 0x02U,
LV_SCALE_MODE_VERTICAL_RIGHT = 0x04U,
LV_SCALE_MODE_ROUND_INNER = 0x08U,
LV_SCALE_MODE_ROUND_OUTTER = 0x10U,
_LV_SCALE_MODE_LAST
};
typedef uint8_t lv_scale_mode_t;
typedef struct {
lv_style_t * main_style;
lv_style_t * indicator_style;
lv_style_t * items_style;
lv_coord_t minor_range;
lv_coord_t major_range;
uint8_t first_tick_idx_in_section;
uint8_t last_tick_idx_in_section;
uint8_t first_tick_idx_is_major;
uint8_t last_tick_idx_is_major;
lv_coord_t first_tick_in_section_width;
lv_coord_t last_tick_in_section_width;
lv_point_t first_tick_in_section;
lv_point_t last_tick_in_section;
} lv_scale_section_t;
typedef struct {
lv_obj_t obj;
lv_ll_t section_ll; /**< Linked list for the sections (stores lv_scale_section_t)*/
char ** txt_src;
lv_coord_t major_len;
lv_coord_t minor_len;
lv_coord_t range_min;
lv_coord_t range_max;
uint32_t total_tick_count : 15;
uint32_t major_tick_every : 15;
lv_scale_mode_t mode;
uint32_t label_enabled : 1;
lv_coord_t last_tick_width;
lv_coord_t first_tick_width;
/* Round scale */
uint16_t angle_range;
int16_t rotation;
} lv_scale_t;
extern const lv_obj_class_t lv_scale_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an scale object
* @param parent pointer to an object, it will be the parent of the new scale
* @return pointer to the created scale
*/
lv_obj_t * lv_scale_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set scale mode. See @ref lv_scale_mode_t
* @param obj pointer the scale object
* @param mode New scale mode
*/
void lv_scale_set_mode(lv_obj_t * obj, lv_scale_mode_t mode);
/**
* Set scale total tick count (including minor and major ticks)
* @param obj pointer the scale object
* @param total_tick_count New total tick count
*/
void lv_scale_set_total_tick_count(lv_obj_t * obj, lv_coord_t total_tick_count);
/**
* Sets how often the major tick will be drawn
* @param obj pointer the scale object
* @param major_tick_every New count for major tick drawing
*/
void lv_scale_set_major_tick_every(lv_obj_t * obj, lv_coord_t major_tick_every);
/**
* Sets label visibility
* @param obj pointer the scale object
* @param show_label Show axis label
*/
void lv_scale_set_label_show(lv_obj_t * obj, bool show_label);
/**
* Sets major tick length
* @param obj pointer the scale object
* @param major_len Major tick length
*/
void lv_scale_set_major_tick_length(lv_obj_t * obj, lv_coord_t major_len);
/**
* Sets major tick length
* @param obj pointer the scale object
* @param minor_len Minor tick length
*/
void lv_scale_set_minor_tick_length(lv_obj_t * obj, lv_coord_t minor_len);
/**
* Set the minimal and maximal values on a scale
* @param obj pointer to a scale object
* @param min minimum value of the scale
* @param max maximum value of the scale
*/
void lv_scale_set_range(lv_obj_t * obj, lv_coord_t min, lv_coord_t max);
/**
* Set properties specific to round scale
* @param obj pointer to a scale object
* @param angle_range the angular range of the scale
* @param rotation the angular offset from the 3 o'clock position (clock-wise)
*/
void lv_scale_set_round_props(lv_obj_t * obj, uint16_t angle_range, int16_t rotation);
/**
* Set custom text source for major ticks labels
* @param obj pointer to a scale object
* @param txt_src pointer to an array of strings which will be display at major ticks
*/
void lv_scale_set_text_src(lv_obj_t * obj, char * txt_src[]);
/**
* Add a section to the given scale
* @param obj pointer to a scale object
* @return pointer to the new section
*/
lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj);
/**
* Set the range for the given scale section
* @param obj pointer to a scale section object
* @param minor_range section new minor range
* @param major_range section new major range
*/
void lv_scale_section_set_range(lv_scale_section_t * section, lv_coord_t minor_range, lv_coord_t major_range);
/**
* Set the style of the part for the given scale section
* @param obj pointer to a scale section object
* @param part Section part
* @param section_part_style Pointer to the section part style
*/
void lv_scale_section_set_style(lv_scale_section_t * section, uint32_t part, lv_style_t * section_part_style);
/*=====================
* Getter functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_SCALE*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SCALE_H*/