lv_scale.h

API reference for lv_scale.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_scale_private.h

Functions

lv_scale_set_mode

Set scale mode. See lv_scale_mode_t.

 
void lv_scale_set_mode(lv_obj_t *obj, lv_scale_mode_t mode)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
modelv_scale_mode_tthe new scale mode

lv_scale_set_total_tick_count

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

 
void lv_scale_set_total_tick_count(lv_obj_t *obj, uint32_t total_tick_count)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
total_tick_countuint32_tNew total tick count

lv_scale_set_major_tick_every

Sets how often major ticks are drawn.

 
void lv_scale_set_major_tick_every(lv_obj_t *obj, uint32_t major_tick_every)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
major_tick_everyuint32_tthe new count for major tick drawing

lv_scale_set_label_show

Sets label visibility.

 
void lv_scale_set_label_show(lv_obj_t *obj, bool show_label)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
show_labelbooltrue/false to enable tick label

lv_scale_set_range

Set minimum and maximum values on Scale.

 
void lv_scale_set_range(lv_obj_t *obj, int32_t min, int32_t max)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
minint32_tminimum value of Scale
maxint32_tmaximum value of Scale

lv_scale_set_min_value

Set minimum values on Scale.

 
void lv_scale_set_min_value(lv_obj_t *obj, int32_t min)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
minint32_tminimum value of Scale

lv_scale_set_max_value

Set maximum values on Scale.

 
void lv_scale_set_max_value(lv_obj_t *obj, int32_t max)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
maxint32_t

lv_scale_set_angle_range

Set angle between the low end and the high end of the Scale. (Applies only to round Scales.)

 
void lv_scale_set_angle_range(lv_obj_t *obj, uint32_t angle_range)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
angle_rangeuint32_t

lv_scale_set_rotation

Set angular offset from the 3-o'clock position of the low end of the Scale. (Applies only to round Scales.)

 
void lv_scale_set_rotation(lv_obj_t *obj, int32_t rotation)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
rotationint32_tclockwise angular offset (in degrees) from the 3-o'clock position of the low end of the scale; negative and >360 values are first normalized to range [0..360]. Examples:
- 0 = 3 o'clock (right side)
- 30 = 4 o'clock
- 60 = 5 o'clock
- 90 = 6 o'clock
- 135 = midway between 7 and 8 o'clock (default)
- 180 = 9 o'clock
- 270 = 12 o'clock
- 300 = 1 o'clock
- 330 = 2 o'clock
- -30 = 2 o'clock
- 390 = 4 o'clock

lv_scale_set_line_needle_value

Point line needle to specified value.

 
void lv_scale_set_line_needle_value(lv_obj_t *obj, lv_obj_t *needle_line, int32_t needle_length, int32_t value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
needle_linelv_obj_t *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_lengthint32_tlength of the needle
- needle_length>0: needle_length=needle_length;
- needle_length<0: needle_length=radius-|needle_length|;
valueint32_tScale value needle will point to

lv_scale_set_image_needle_value

Point image needle to specified value; image must point to the right. E.g. -O---—>

 
void lv_scale_set_image_needle_value(lv_obj_t *obj, lv_obj_t *needle_img, int32_t value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
needle_imglv_obj_t *pointer to needle's Image
valueint32_tScale value needle will point to

lv_scale_set_text_src

Set custom text source for major ticks labels.

 
void lv_scale_set_text_src(lv_obj_t *obj, const char *txt_src[])
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
txt_srcconst char *pointer to an array of strings which will be display at major ticks; last element must be a NULL pointer.

lv_scale_set_post_draw

Draw Scale after all its children are drawn.

 
void lv_scale_set_post_draw(lv_obj_t *obj, bool en)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
enbooltrue: enable post draw

lv_scale_set_draw_ticks_on_top

Draw Scale ticks on top of all other parts.

 
void lv_scale_set_draw_ticks_on_top(lv_obj_t *obj, bool en)
Parameters
NameTypeDescription
objlv_obj_t *pointer to Scale Widget
enbooltrue: enable draw ticks on top of all parts

lv_scale_section_set_range

DEPRECATED, use lv_scale_set_section_range instead. Set range for specified Scale Section

 
void lv_scale_section_set_range(lv_scale_section_t *section, int32_t min, int32_t max)
Parameters
NameTypeDescription
sectionlv_scale_section_t *pointer to Section
minint32_t
maxint32_t

lv_scale_set_section_range

Set the range of a scale section

 
void lv_scale_set_section_range(lv_obj_t *scale, lv_scale_section_t *section, int32_t min, int32_t max)
Parameters
NameTypeDescription
scalelv_obj_t *pointer to scale
sectionlv_scale_section_t *pointer to section
minint32_t
maxint32_t

lv_scale_set_section_min_value

Set the minimum value of a scale section

 
void lv_scale_set_section_min_value(lv_obj_t *scale, lv_scale_section_t *section, int32_t min)
Parameters
NameTypeDescription
scalelv_obj_t *pointer to scale
sectionlv_scale_section_t *pointer to section
minint32_tthe section's new minimum value

lv_scale_set_section_max_value

Set the maximum value of a scale section

 
void lv_scale_set_section_max_value(lv_obj_t *scale, lv_scale_section_t *section, int32_t max)
Parameters
NameTypeDescription
scalelv_obj_t *pointer to scale
sectionlv_scale_section_t *pointer to section
maxint32_tthe section's new maximum value

lv_scale_section_set_style

DEPRECATED, use lv_scale_set_section_style_main/indicator/items instead. Set style for specified part of Section.

 
void lv_scale_section_set_style(lv_scale_section_t *section, lv_part_t part, lv_style_t *section_part_style)
Parameters
NameTypeDescription
sectionlv_scale_section_t *pointer to Section
partlv_part_tthe part of the Scale the style will apply to, e.g. LV_PART_INDICATOR
section_part_stylelv_style_t *pointer to style to apply

lv_scale_set_section_style_main

Set the style of the line on a section.

 
void lv_scale_set_section_style_main(lv_obj_t *scale, lv_scale_section_t *section, const lv_style_t *style)
Parameters
NameTypeDescription
scalelv_obj_t *pointer to scale
sectionlv_scale_section_t *pointer to section
styleconst lv_style_t *point to a style

lv_scale_set_section_style_indicator

Set the style of the major ticks and label on a section.

 
void lv_scale_set_section_style_indicator(lv_obj_t *scale, lv_scale_section_t *section, const lv_style_t *style)
Parameters
NameTypeDescription
scalelv_obj_t *pointer to scale
sectionlv_scale_section_t *pointer to section
styleconst lv_style_t *point to a style

lv_scale_set_section_style_items

Set the style of the minor ticks on a section.

 
void lv_scale_set_section_style_items(lv_obj_t *scale, lv_scale_section_t *section, const lv_style_t *style)
Parameters
NameTypeDescription
scalelv_obj_t *pointer to scale
sectionlv_scale_section_t *pointer to section
styleconst lv_style_t *point to a style

Enums

lv_scale_mode_t

Scale mode

NameValue
LV_SCALE_MODE_HORIZONTAL_TOP0x00U
LV_SCALE_MODE_HORIZONTAL_BOTTOM0x01U
LV_SCALE_MODE_VERTICAL_LEFT0x02U
LV_SCALE_MODE_VERTICAL_RIGHT0x04U
LV_SCALE_MODE_ROUND_INNER0x08U
LV_SCALE_MODE_ROUND_OUTER0x10U
LV_SCALE_MODE_LAST
Used by 1 function
  • lv_scale_set_mode — param mode

_lv_property_scale_id_t

NameValue
LV_PROPERTY_SCALE_MODE(LV_PROPERTY_SCALE_START + ((int) 0 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_TOTAL_TICK_COUNT(LV_PROPERTY_SCALE_START + ((int) 1 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_MAJOR_TICK_EVERY(LV_PROPERTY_SCALE_START + ((int) 2 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_LABEL_SHOW(LV_PROPERTY_SCALE_START + ((int) 3 )) | (( 11 ) << 28 )
LV_PROPERTY_SCALE_ANGLE_RANGE(LV_PROPERTY_SCALE_START + ((int) 4 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_ROTATION(LV_PROPERTY_SCALE_START + ((int) 5 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_RANGE_MIN_VALUE(LV_PROPERTY_SCALE_START + ((int) 6 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_RANGE_MAX_VALUE(LV_PROPERTY_SCALE_START + ((int) 7 )) | (( 1 ) << 28 )
LV_PROPERTY_SCALE_END

Macros

LV_SCALE_TOTAL_TICK_COUNT_DEFAULT

 
#define LV_SCALE_TOTAL_TICK_COUNT_DEFAULT (11U)

Default value of total minor ticks.

LV_SCALE_MAJOR_TICK_EVERY_DEFAULT

 
#define LV_SCALE_MAJOR_TICK_EVERY_DEFAULT (5U)

Default value of major tick every nth ticks.

LV_SCALE_LABEL_ENABLED_DEFAULT

 
#define LV_SCALE_LABEL_ENABLED_DEFAULT (1U)

Default value of scale label enabled.

LV_SCALE_LABEL_ROTATE_MATCH_TICKS

 
#define LV_SCALE_LABEL_ROTATE_MATCH_TICKS 0x100000

LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT

 
#define LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT 0x80000

LV_SCALE_ROTATION_ANGLE_MASK

 
#define LV_SCALE_ROTATION_ANGLE_MASK 0x7FFFF

Variables

lv_scale_class

 
const lv_obj_class_t lv_scale_class

Dependencies

How is this guide?

Last updated on

On this page