lv_scale.h

Defines

LV_SCALE_TOTAL_TICK_COUNT_DEFAULT

Default value of total minor ticks.

LV_SCALE_MAJOR_TICK_EVERY_DEFAULT

Default value of major tick every nth ticks.

LV_SCALE_LABEL_ENABLED_DEFAULT

Default value of scale label enabled.

Typedefs

typedef uint32_t lv_scale_mode_t

Enums

enum [anonymous]

Scale mode

Values:

enumerator LV_SCALE_MODE_HORIZONTAL_TOP
enumerator LV_SCALE_MODE_HORIZONTAL_BOTTOM
enumerator LV_SCALE_MODE_VERTICAL_LEFT
enumerator LV_SCALE_MODE_VERTICAL_RIGHT
enumerator LV_SCALE_MODE_ROUND_INNER
enumerator LV_SCALE_MODE_ROUND_OUTER
enumerator _LV_SCALE_MODE_LAST

Functions

lv_obj_t *lv_scale_create(lv_obj_t *parent)

Create an scale object

Parameters:

parent -- pointer to an object, it will be the parent of the new scale

Returns:

pointer to the created scale

void lv_scale_set_mode(lv_obj_t *obj, lv_scale_mode_t mode)

Set scale mode. See lv_scale_mode_t

Parameters:
  • obj -- pointer the scale object

  • mode -- the new scale mode

void lv_scale_set_total_tick_count(lv_obj_t *obj, uint32_t total_tick_count)

Set scale total tick count (including minor and major ticks)

Parameters:
  • obj -- pointer the scale object

  • total_tick_count -- New total tick count

void lv_scale_set_major_tick_every(lv_obj_t *obj, uint32_t major_tick_every)

Sets how often the major tick will be drawn

Parameters:
  • obj -- pointer the scale object

  • major_tick_every -- the new count for major tick drawing

void lv_scale_set_label_show(lv_obj_t *obj, bool show_label)

Sets label visibility

Parameters:
  • obj -- pointer the scale object

  • show_label -- true/false to enable tick label

void lv_scale_set_range(lv_obj_t *obj, int32_t min, int32_t max)

Set the minimal and maximal values on a scale

Parameters:
  • obj -- pointer to a scale object

  • min -- minimum value of the scale

  • max -- maximum value of the scale

void lv_scale_set_angle_range(lv_obj_t *obj, uint32_t angle_range)

Set properties specific to round scale

Parameters:
  • obj -- pointer to a scale object

  • angle_range -- the angular range of the scale

void lv_scale_set_rotation(lv_obj_t *obj, int32_t rotation)

Set properties specific to round scale

Parameters:
  • obj -- pointer to a scale object

  • rotation -- the angular offset from the 3 o'clock position (clock-wise)

void lv_scale_set_line_needle_value(lv_obj_t *obj, lv_obj_t *needle_line, int32_t needle_length, int32_t value)

Point the needle to the corresponding value through the line

Parameters:
  • obj -- pointer to a scale object

  • needle_line -- needle_line of the scale. The line points will be allocated and managed by the scale unless the line point array was previously set using lv_line_set_points_mutable.

  • needle_length -- length of the needle needle_length>0 needle_length=needle_length; needle_length<0 needle_length=radius-|needle_length|;

  • value -- needle to point to the corresponding value

void lv_scale_set_image_needle_value(lv_obj_t *obj, lv_obj_t *needle_img, int32_t value)

Point the needle to the corresponding value through the image, image must point to the right. E.g. -O---&#8212;>

Parameters:
  • obj -- pointer to a scale object

  • needle_img -- needle_img of the scale

  • value -- needle to point to the corresponding value

void lv_scale_set_text_src(lv_obj_t *obj, const char *txt_src[])

Set custom text source for major ticks labels

Parameters:
  • obj -- pointer to a scale object

  • txt_src -- pointer to an array of strings which will be display at major ticks

void lv_scale_set_post_draw(lv_obj_t *obj, bool en)

Draw the scale after all the children are drawn

Parameters:
  • obj -- pointer to a scale object

  • en -- true: enable post draw

lv_scale_section_t *lv_scale_add_section(lv_obj_t *obj)

Add a section to the given scale

Parameters:

obj -- pointer to a scale object

Returns:

pointer to the new section

void lv_scale_section_set_range(lv_scale_section_t *section, int32_t minor_range, int32_t major_range)

Set the range for the given scale section

Parameters:
  • section -- pointer to a scale section object

  • minor_range -- section new minor range

  • major_range -- section new major range

void lv_scale_section_set_style(lv_scale_section_t *section, uint32_t part, lv_style_t *section_part_style)

Set the style of the part for the given scale section

Parameters:
  • section -- pointer to a scale section object

  • part -- the part for the section, e.g. LV_PART_INDICATOR

  • section_part_style -- Pointer to the section part style

lv_scale_mode_t lv_scale_get_mode(lv_obj_t *obj)

Get scale mode. See lv_scale_mode_t

Parameters:

obj -- pointer the scale object

Returns:

Scale mode

int32_t lv_scale_get_total_tick_count(lv_obj_t *obj)

Get scale total tick count (including minor and major ticks)

Parameters:

obj -- pointer the scale object

Returns:

Scale total tick count

int32_t lv_scale_get_major_tick_every(lv_obj_t *obj)

Gets how often the major tick will be drawn

Parameters:

obj -- pointer the scale object

Returns:

Scale major tick every count

bool lv_scale_get_label_show(lv_obj_t *obj)

Gets label visibility

Parameters:

obj -- pointer the scale object

Returns:

true if tick label is enabled, false otherwise

uint32_t lv_scale_get_angle_range(lv_obj_t *obj)

Get angle range of a round scale

Parameters:

obj -- pointer to a scale object

Returns:

Scale angle_range

int32_t lv_scale_get_range_min_value(lv_obj_t *obj)

Get the min range for the given scale section

Parameters:

obj -- pointer to a scale section object

Returns:

section minor range

int32_t lv_scale_get_range_max_value(lv_obj_t *obj)

Get the max range for the given scale section

Parameters:

obj -- pointer to a scale section object

Returns:

section max range

Variables

const lv_obj_class_t lv_scale_class
struct lv_scale_section_t

Public Members

lv_style_t *main_style
lv_style_t *indicator_style
lv_style_t *items_style
int32_t minor_range
int32_t major_range
uint32_t first_tick_idx_in_section
uint32_t last_tick_idx_in_section
uint32_t first_tick_idx_is_major
uint32_t last_tick_idx_is_major
int32_t first_tick_in_section_width
int32_t last_tick_in_section_width
lv_point_t first_tick_in_section
lv_point_t last_tick_in_section
struct lv_scale_t

Public Members

lv_obj_t obj
lv_ll_t section_ll

Linked list for the sections (stores lv_scale_section_t)

const char **txt_src
lv_scale_mode_t mode
int32_t range_min
int32_t range_max
uint32_t total_tick_count
uint32_t major_tick_every
uint32_t label_enabled
uint32_t post_draw
uint32_t angle_range
int32_t rotation
int32_t custom_label_cnt
int32_t last_tick_width
int32_t first_tick_width