lv_meter.h

Typedefs

typedef _lv_meter_indicator_type_t lv_meter_indicator_type_t

Enums

enum _lv_meter_indicator_type_t

Values:

enumerator LV_METER_INDICATOR_TYPE_NEEDLE_IMG
enumerator LV_METER_INDICATOR_TYPE_NEEDLE_LINE
enumerator LV_METER_INDICATOR_TYPE_SCALE_LINES
enumerator LV_METER_INDICATOR_TYPE_ARC
enum lv_meter_draw_part_type_t

type field in lv_obj_draw_part_dsc_t if class_p = lv_meter_class Used in LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END

Values:

enumerator LV_METER_DRAW_PART_ARC

The arc indicator

enumerator LV_METER_DRAW_PART_NEEDLE_LINE

The needle lines

enumerator LV_METER_DRAW_PART_NEEDLE_IMG

The needle images

enumerator LV_METER_DRAW_PART_TICK

The tick lines and labels

Functions

lv_obj_t *lv_meter_create(lv_obj_t *parent)

Create a Meter object

Parameters:

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

Returns:

pointer to the created meter

void lv_meter_set_scale_ticks(lv_obj_t *obj, uint16_t cnt, uint16_t width, uint16_t len, lv_color_t color)

Set the properties of the ticks of a scale

Parameters:
  • obj -- pointer to a meter object

  • cnt -- number of tick lines

  • width -- width of tick lines

  • len -- length of tick lines

  • color -- color of tick lines

void lv_meter_set_scale_major_ticks(lv_obj_t *obj, uint16_t nth, uint16_t width, uint16_t len, lv_color_t color, int16_t label_gap)

Make some "normal" ticks major ticks and set their attributes. Texts with the current value are also added to the major ticks.

Parameters:
  • obj -- pointer to a meter object

  • nth -- make every Nth normal tick major tick. (start from the first on the left)

  • width -- width of the major ticks

  • len -- length of the major ticks

  • color -- color of the major ticks

  • label_gap -- gap between the major ticks and the labels

void lv_meter_set_scale_range(lv_obj_t *obj, int32_t min, int32_t max, uint32_t angle_range, uint32_t rotation)

Set the value and angular range of a scale.

Parameters:
  • obj -- pointer to a meter object

  • min -- the minimum value

  • max -- the maximal value

  • angle_range -- the angular range of the scale

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

lv_meter_indicator_t *lv_meter_add_needle_line(lv_obj_t *obj, uint16_t width, lv_color_t color, int16_t r_mod)

Add a needle line indicator the scale

Parameters:
  • obj -- pointer to a meter object

  • width -- width of the line

  • color -- color of the line

  • r_mod -- the radius modifier (added to the scale's radius) to get the lines length

Returns:

the new indicator or NULL on allocation failure.

lv_meter_indicator_t *lv_meter_add_needle_img(lv_obj_t *obj, const void *src, lv_coord_t pivot_x, lv_coord_t pivot_y)

Add a needle image indicator the scale

Note

the needle image should point to the right, like -O--—>

Parameters:
  • obj -- pointer to a meter object

  • src -- the image source of the indicator. path or pointer to lv_img_dsc_t

  • pivot_x -- the X pivot point of the needle

  • pivot_y -- the Y pivot point of the needle

Returns:

the new indicator or NULL on allocation failure.

lv_meter_indicator_t *lv_meter_add_arc(lv_obj_t *obj, uint16_t width, lv_color_t color, int16_t r_mod)

Add an arc indicator the scale

Parameters:
  • obj -- pointer to a meter object

  • width -- width of the arc

  • color -- color of the arc

  • r_mod -- the radius modifier (added to the scale's radius) to get the outer radius of the arc

Returns:

the new indicator or NULL on allocation failure.

lv_meter_indicator_t *lv_meter_add_scale_lines(lv_obj_t *obj, lv_color_t color_start, lv_color_t color_end, bool local, int16_t width_mod)

Add a scale line indicator the scale. It will modify the ticks.

Parameters:
  • obj -- pointer to a meter object

  • color_start -- the start color

  • color_end -- the end color

  • local -- tell how to map start and end color. true: the indicator's start and end_value; false: the scale's min max value

  • width_mod -- add this the affected tick's width

Returns:

the new indicator or NULL on allocation failure.

void lv_meter_set_indicator_value(lv_obj_t *obj, lv_meter_indicator_t *indic, int32_t value)

Set the value of the indicator. It will set start and and value to the same value

Parameters:
  • obj -- pointer to a meter object

  • indic -- pointer to an indicator

  • value -- the new value

void lv_meter_set_indicator_start_value(lv_obj_t *obj, lv_meter_indicator_t *indic, int32_t value)

Set the start value of the indicator.

Parameters:
  • obj -- pointer to a meter object

  • indic -- pointer to an indicator

  • value -- the new value

void lv_meter_set_indicator_end_value(lv_obj_t *obj, lv_meter_indicator_t *indic, int32_t value)

Set the start value of the indicator.

Parameters:
  • obj -- pointer to a meter object

  • indic -- pointer to an indicator

  • value -- the new value

Variables

const lv_obj_class_t lv_meter_class
struct lv_meter_indicator_t

Public Members

lv_meter_indicator_type_t type
lv_opa_t opa
int32_t start_value
int32_t end_value
const void *src
lv_point_t pivot
struct lv_meter_indicator_t::[anonymous]::[anonymous] needle_img
uint16_t width
int16_t r_mod
lv_color_t color
struct lv_meter_indicator_t::[anonymous]::[anonymous] needle_line
struct lv_meter_indicator_t::[anonymous]::[anonymous] arc
int16_t width_mod
lv_color_t color_start
lv_color_t color_end
uint8_t local_grad
struct lv_meter_indicator_t::[anonymous]::[anonymous] scale_lines
union lv_meter_indicator_t::[anonymous] type_data
struct lv_meter_t

Public Members

lv_obj_t obj
lv_color_t tick_color
uint16_t tick_cnt
uint16_t tick_length
uint16_t tick_width
lv_color_t tick_major_color
uint16_t tick_major_nth
uint16_t tick_major_length
uint16_t tick_major_width
int16_t label_gap
int16_t label_color
int32_t min
int32_t max
int16_t r_mod
uint16_t angle_range
int16_t rotation
struct lv_meter_t::[anonymous] scale
lv_ll_t indicator_ll