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.

LV_SCALE_LABEL_ROTATE_MATCH_TICKS
LV_SCALE_LABEL_ROTATE_KEEP_UPRIGHT
LV_SCALE_ROTATION_ANGLE_MASK

Enums

enum lv_scale_mode_t

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 created Scale Widget

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 to Scale Widget

  • 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 to Scale Widget

  • 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 major ticks are drawn.

Parameters:
  • obj – pointer to Scale Widget

  • 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 to Scale Widget

  • show_label – true/false to enable tick label

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

Set minimum and maximum values on Scale.

Parameters:
  • obj – pointer to Scale Widget

  • min – minimum value of Scale

  • max – maximum value of Scale

void lv_scale_set_angle_range(lv_obj_t *obj, uint32_t angle_range)

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

Parameters:
  • obj – pointer to Scale Widget

  • max_angle – angle in degrees from Scale minimum where top end of Scale will be drawn

void lv_scale_set_rotation(lv_obj_t *obj, int32_t rotation)

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

Parameters:
  • obj – pointer to Scale Widget

  • rotation – clockwise 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

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

Point line needle to specified value.

Parameters:
  • obj – pointer to Scale Widget

  • 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 – Scale value needle will point to

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

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

Parameters:
  • obj – pointer to Scale Widget

  • needle_img – pointer to needle's Image

  • value – Scale value needle will point to

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 Scale Widget

  • txt_src – pointer to an array of strings which will be display at major ticks; last element must be a NULL pointer.

void lv_scale_set_post_draw(lv_obj_t *obj, bool en)

Draw Scale after all its children are drawn.

Parameters:
  • obj – pointer to Scale Widget

  • en – true: enable post draw

void lv_scale_set_draw_ticks_on_top(lv_obj_t *obj, bool en)

Draw Scale ticks on top of all other parts.

Parameters:
  • obj – pointer to Scale Widget

  • en – true: enable draw ticks on top of all parts

lv_scale_section_t *lv_scale_add_section(lv_obj_t *obj)

Add a Section to specified Scale. Section will not be drawn until a valid range is set for it using lv_scale_section_set_range().

Parameters:

obj – pointer to Scale Widget

Returns:

pointer to new Section

void lv_scale_section_set_range(lv_scale_section_t *section, int32_t min, int32_t max)

Set range for specified Scale Section

Parameters:
  • section – pointer to Section

  • range_min – Section new minimum value

  • range_max – Section new maximum value

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

Set style for specified part of Section.

Parameters:
  • section – pointer to Section

  • part – the part of the Scale the style will apply to, e.g. LV_PART_INDICATOR

  • section_part_style – pointer to style to apply

lv_scale_mode_t lv_scale_get_mode(lv_obj_t *obj)

Get scale mode. See lv_scale_mode_t

Parameters:

obj – pointer to Scale Widget

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 to Scale Widget

Returns:

Scale total tick count

int32_t lv_scale_get_major_tick_every(lv_obj_t *obj)

Get how often the major tick will be drawn

Parameters:

obj – pointer to Scale Widget

Returns:

Scale major tick every count

lv_scale_mode_t lv_scale_get_rotation(lv_obj_t *obj)

Get angular location of low end of Scale.

Parameters:

obj – pointer to Scale Widget

Returns:

Scale major tick every count

bool lv_scale_get_label_show(lv_obj_t *obj)

Gets label visibility

Parameters:

obj – pointer to Scale Widget

Returns:

true if tick label is enabled, false otherwise

uint32_t lv_scale_get_angle_range(lv_obj_t *obj)

Get Scale's range in degrees

Parameters:

obj – pointer to Scale Widget

Returns:

Scale's angle_range

int32_t lv_scale_get_range_min_value(lv_obj_t *obj)

Get minimum value for Scale

Parameters:

obj – pointer to Scale Widget

Returns:

Scale's minimum value

int32_t lv_scale_get_range_max_value(lv_obj_t *obj)

Get maximum value for Scale

Parameters:

obj – pointer to Scale Widget

Returns:

Scale's maximum value

Variables

const lv_obj_class_t lv_scale_class