2017-01-09 18:08:57 +01:00
|
|
|
/**
|
|
|
|
* @file lv_gauge.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*Search an replace: gauge -> object normal name with lower case (e.g. button, label etc.)
|
|
|
|
* gauge -> object short name with lower case(e.g. btn, label etc)
|
|
|
|
* GAUGE -> object short name with upper case (e.g. BTN, LABEL etc.)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_GAUGE_H
|
|
|
|
#define LV_GAUGE_H
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_conf.h"
|
|
|
|
#if USE_LV_GAUGE != 0
|
|
|
|
|
|
|
|
#include "../lv_obj/lv_obj.h"
|
|
|
|
#include "lv_rect.h"
|
|
|
|
#include "lv_label.h"
|
|
|
|
#include "lv_line.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
2017-01-10 08:36:12 +01:00
|
|
|
#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/
|
2017-01-09 18:08:57 +01:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/*Style of gauge*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
lv_rects_t rects; /*Style of ancestor*/
|
|
|
|
/*New style element for this type */
|
2017-01-10 20:38:14 +01:00
|
|
|
color_t mcolor_critical; /*Top color at critical.*/
|
|
|
|
color_t gcolor_critical; /*Bottom color at critical*/
|
2017-01-10 08:36:12 +01:00
|
|
|
/*Scale settings*/
|
|
|
|
uint16_t scale_angle; /*Angle of the scale in deg. (~220)*/
|
2017-01-10 20:38:14 +01:00
|
|
|
lv_labels_t scale_labels; /*Style of the scale labels*/
|
2017-01-10 08:36:12 +01:00
|
|
|
cord_t scale_pad; /*Padding of scale labels from the edge*/
|
|
|
|
uint8_t scale_label_num; /*Number of scale labels (~6)*/
|
|
|
|
/*Needle settings*/
|
|
|
|
lv_lines_t needle_lines; /*Style of neddles*/
|
|
|
|
color_t needle_color[LV_GAUGE_MAX_NEEDLE]; /*Color of needles*/
|
|
|
|
color_t needle_mid_color; /*Color of middle where the needles start*/
|
|
|
|
cord_t needle_mid_r; /*Radius of the needle middle area*/
|
|
|
|
opa_t needle_opa; /*Opacity of the needles*/
|
2017-01-10 20:38:14 +01:00
|
|
|
/*Value text settings*/
|
|
|
|
lv_labels_t value_labels; /*Style of the value label*/
|
2017-01-09 18:08:57 +01:00
|
|
|
}lv_gauges_t;
|
|
|
|
|
|
|
|
/*Built-in styles of gauge*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LV_GAUGES_DEF,
|
|
|
|
}lv_gauges_builtin_t;
|
|
|
|
|
|
|
|
/*Data of gauge*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
lv_rect_ext_t rect; /*Ext. of ancestor*/
|
|
|
|
/*New data for this type */
|
|
|
|
int16_t min;
|
|
|
|
int16_t max;
|
2017-01-10 08:36:12 +01:00
|
|
|
int16_t * values;
|
2017-01-10 21:03:59 +01:00
|
|
|
char * txt;
|
2017-01-10 08:36:12 +01:00
|
|
|
uint8_t needle_num;
|
2017-01-10 20:38:14 +01:00
|
|
|
uint8_t low_critical :1; /*0: the higher value is more critical, 1: the lower value is more critical*/
|
2017-01-09 18:08:57 +01:00
|
|
|
}lv_gauge_ext_t;
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
|
|
|
|
bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
|
|
|
|
lv_gauges_t * lv_gauges_get(lv_gauges_builtin_t style, lv_gauges_t * copy);
|
|
|
|
|
2017-01-10 21:03:59 +01:00
|
|
|
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle, int16_t value);
|
2017-01-10 08:36:12 +01:00
|
|
|
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num);
|
2017-01-10 20:38:14 +01:00
|
|
|
void lv_gauge_set_range(lv_obj_t * gauge, int16_t min, int16_t max);
|
2017-01-10 21:03:59 +01:00
|
|
|
void lv_gauge_set_text(lv_obj_t * gauge, const char * txt);
|
2017-01-10 20:38:14 +01:00
|
|
|
void lv_gauge_set_low_critical(lv_obj_t * gauge, bool low);
|
2017-01-10 08:36:12 +01:00
|
|
|
|
|
|
|
uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge);
|
|
|
|
int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle);
|
2017-01-10 21:03:59 +01:00
|
|
|
const char * lv_gauge_get_text(lv_obj_t * gauge);
|
2017-01-10 20:38:14 +01:00
|
|
|
bool lv_gauge_get_low_critical(lv_obj_t * gauge);
|
2017-01-09 18:08:57 +01:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|