1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/src/lv_objx/lv_lmeter.h

155 lines
3.6 KiB
C
Raw Normal View History

2017-04-21 17:11:47 +02:00
/**
* @file lv_lmeter.h
2018-06-19 09:49:58 +02:00
*
2017-04-21 17:11:47 +02:00
*/
#ifndef LV_LMETER_H
#define LV_LMETER_H
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2017-04-21 17:11:47 +02:00
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LMETER != 0
2017-04-21 17:11:47 +02:00
2017-11-30 11:35:33 +01:00
#include "../lv_core/lv_obj.h"
2017-04-21 17:11:47 +02:00
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of line meter*/
typedef struct
{
2019-04-04 07:15:40 +02:00
/*No inherited ext.*/ /*Ext. of ancestor*/
2017-04-21 17:11:47 +02:00
/*New data for this type */
2019-04-04 07:15:40 +02:00
uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/
uint16_t angle_ofs;
2019-12-02 12:20:01 +01:00
uint16_t line_cnt; /*Count of lines */
int16_t cur_value;
int16_t min_value;
int16_t max_value;
2018-06-19 09:49:58 +02:00
} lv_lmeter_ext_t;
2017-04-21 17:11:47 +02:00
/*Styles*/
enum {
2020-01-01 21:44:16 +01:00
LV_LMETER_PART_MAIN,
};
2020-01-01 21:44:16 +01:00
typedef uint8_t lv_lmeter_part_t;
2017-04-21 17:11:47 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a line meter objects
* @param par pointer to an object, it will be the parent of the new line meter
2019-04-04 07:15:40 +02:00
* @param copy pointer to a line meter object, if not NULL then the new object will be copied from
* it
2017-04-21 17:11:47 +02:00
* @return pointer to the created line meter
*/
lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy);
2017-04-21 17:11:47 +02:00
2017-11-11 14:23:05 +01:00
/*=====================
* Setter functions
*====================*/
2017-04-21 17:11:47 +02:00
/**
* Set a new value on the line meter
* @param lmeter pointer to a line meter object
* @param value new value
*/
2019-04-04 07:15:40 +02:00
void lv_lmeter_set_value(lv_obj_t * lmeter, int16_t value);
/**
* Set minimum and the maximum values of a line meter
* @param lmeter pointer to he line meter object
* @param min minimum value
* @param max maximum value
*/
2019-04-04 07:15:40 +02:00
void lv_lmeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max);
2017-04-21 17:11:47 +02:00
/**
* Set the scale settings of a line meter
* @param lmeter pointer to a line meter object
* @param angle angle of the scale (0..360)
2017-11-11 14:23:05 +01:00
* @param line_cnt number of lines
2017-04-21 17:11:47 +02:00
*/
2019-12-02 12:20:01 +01:00
void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt);
2017-11-11 14:23:05 +01:00
2019-11-12 13:07:26 +01:00
/**
* Set the set an offset for the line meter's angles to rotate it.
2019-11-12 13:07:26 +01:00
* @param lmeter pointer to a line meter object
* @param angle angle offset (0..360), rotates clockwise
2019-11-12 13:07:26 +01:00
*/
void lv_lmeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle);
2019-11-12 13:07:26 +01:00
2017-11-11 14:23:05 +01:00
/*=====================
* Getter functions
*====================*/
2017-04-21 17:11:47 +02:00
/**
* Get the value of a line meter
* @param lmeter pointer to a line meter object
* @return the value of the line meter
*/
2019-04-04 07:15:40 +02:00
int16_t lv_lmeter_get_value(const lv_obj_t * lmeter);
/**
* Get the minimum value of a line meter
* @param lmeter pointer to a line meter object
* @return the minimum value of the line meter
*/
int16_t lv_lmeter_get_min_value(const lv_obj_t * lmeter);
/**
* Get the maximum value of a line meter
* @param lmeter pointer to a line meter object
* @return the maximum value of the line meter
*/
int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter);
2017-04-21 17:11:47 +02:00
/**
* Get the scale number of a line meter
* @param lmeter pointer to a line meter object
* @return number of the scale units
*/
2019-12-05 06:44:11 +01:00
uint16_t lv_lmeter_get_line_count(const lv_obj_t * lmeter);
2017-04-21 17:11:47 +02:00
/**
* Get the scale angle of a line meter
* @param lmeter pointer to a line meter object
* @return angle of the scale
*/
uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter);
/**
* get the set an offset for the line meter.
* @param lmeter pointer to a line meter object
* @return angle offset (0..360)
*/
uint16_t lv_lmeter_get_angle_offset(lv_obj_t * lmeter);
2020-01-01 21:44:16 +01:00
void lv_lmeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uint8_t part);
2017-04-21 17:11:47 +02:00
/**********************
* MACROS
**********************/
2019-04-04 07:15:40 +02:00
#endif /*LV_USE_LMETER*/
2017-04-21 17:11:47 +02:00
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
} /* extern "C" */
2017-04-21 17:11:47 +02:00
#endif
2017-07-09 15:32:49 +02:00
2019-04-04 07:15:40 +02:00
#endif /*LV_LMETER_H*/