Uploading the first files

This commit is contained in:
carterCE10 committed 2026-07-20 15:08:43 -04:00
commit eab3a5dd48
356 files changed
+78694

No files matched your search

@@ -0,0 +1,103 @@
/**
* @file lv_animimg.h
*
*/
#ifndef LV_ANIM_IMG_H
#define LV_ANIM_IMG_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_ANIMIMG != 0
/*Testing of dependencies*/
#if LV_USE_IMG == 0
#error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1)"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
extern const lv_obj_class_t lv_animimg_class;
/*Data of image*/
typedef struct {
lv_img_t img;
lv_anim_t anim;
/*picture sequence */
lv_img_dsc_t ** dsc;
int8_t pic_count;
} lv_animimg_t;
/*Image parts*/
enum {
LV_ANIM_IMG_PART_MAIN,
};
typedef uint8_t lv_animimg_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an animation image objects
* @param parent pointer to an object, it will be the parent of the new button
* @return pointer to the created animation image object
*/
lv_obj_t * lv_animimg_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set the image animation images source.
* @param img pointer to an animation image object
* @param dsc pointer to a series images
* @param num images' number
*/
void lv_animimg_set_src(lv_obj_t * img, lv_img_dsc_t * dsc[], uint8_t num);
/**
* Startup the image animation.
* @param obj pointer to an animation image object
*/
void lv_animimg_start(lv_obj_t * obj);
/**
* Set the image animation duration time. unit:ms
* @param img pointer to an animation image object
*/
void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration);
/**
* Set the image animation reapeatly play times.
* @param img pointer to an animation image object
* @param count the number of times to repeat the animation
*/
void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count);
/*=====================
* Getter functions
*====================*/
#endif /*LV_USE_ANIMIMG*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_ANIM_IMG_H*/
@@ -0,0 +1,164 @@
/**
* @file lv_calendar.h
*
*/
#ifndef LV_CALENDAR_H
#define LV_CALENDAR_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/widgets/lv_btnmatrix.h"
#if LV_USE_CALENDAR
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Represents a date on the calendar object (platform-agnostic).
*/
typedef struct {
uint16_t year;
int8_t month; /** 1..12*/
int8_t day; /** 1..31*/
} lv_calendar_date_t;
/*Data of calendar*/
typedef struct {
lv_obj_t obj;
lv_obj_t * btnm;
/*New data for this type*/
lv_calendar_date_t today; /*Date of today*/
lv_calendar_date_t showed_date; /*Currently visible month (day is ignored)*/
lv_calendar_date_t *
highlighted_dates; /*Apply different style on these days (pointer to an array defined by the user)*/
uint16_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/
const char * map[8 * 7];
char nums [7 * 6][4];
} lv_calendar_t;
extern const lv_obj_class_t lv_calendar_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_obj_t * lv_calendar_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set the today's date
* @param obj pointer to a calendar object
* @param year today's year
* @param month today's month [1..12]
* @param day today's day [1..31]
*/
void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day);
/**
* Set the currently showed
* @param obj pointer to a calendar object
* @param year today's year
* @param month today's month [1..12]
*/
void lv_calendar_set_showed_date(lv_obj_t * obj, uint32_t year, uint32_t month);
/**
* Set the highlighted dates
* @param obj pointer to a calendar object
* @param highlighted pointer to an `lv_calendar_date_t` array containing the dates.
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
* @param date_num number of dates in the array
*/
void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], uint16_t date_num);
/**
* Set the name of the days
* @param obj pointer to a calendar object
* @param day_names pointer to an array with the names.
* E.g. `const char * days[7] = {"Sun", "Mon", ...}`
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
*/
void lv_calendar_set_day_names(lv_obj_t * obj, const char ** day_names);
/*=====================
* Getter functions
*====================*/
/**
* Get the button matrix object of the calendar.
* It shows the dates and day names.
* @param obj pointer to a calendar object
* @return pointer to a the button matrix
*/
lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t * obj);
/**
* Get the today's date
* @param calendar pointer to a calendar object
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
*/
const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar);
/**
* Get the currently showed
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
*/
const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
/**
* Get the highlighted dates
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` array containing the dates.
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar);
/**
* Get the number of the highlighted dates
* @param calendar pointer to a calendar object
* @return number of highlighted days
*/
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar);
/**
* Get the currently pressed day
* @param calendar pointer to a calendar object
* @param date store the pressed date here
* @return LV_RES_OK: there is a valid pressed date; LV_RES_INV: there is no pressed data
*/
lv_res_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_H*/
@@ -0,0 +1,49 @@
/**
* @file lv_calendar_header_arrow.h
*
*/
#ifndef LV_CALENDAR_HEADER_ARROW_H
#define LV_CALENDAR_HEADER_ARROW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/core/lv_obj.h"
#if LV_USE_CALENDAR_HEADER_ARROW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
extern const lv_obj_class_t lv_calendar_header_arrow_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a calendar header with drop-drowns to select the year and month
* @param parent pointer to a calendar object.
* @return the created header
*/
lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR_HEADER_ARROW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_HEADER_ARROW_H*/
@@ -0,0 +1,49 @@
/**
* @file lv_calendar_header_dropdown.h
*
*/
#ifndef LV_CALENDAR_HEADER_DROPDOWN_H
#define LV_CALENDAR_HEADER_DROPDOWN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/core/lv_obj.h"
#if LV_USE_CALENDAR_HEADER_DROPDOWN
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
extern const lv_obj_class_t lv_calendar_header_dropdown_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a calendar header with drop-drowns to select the year and month
* @param parent pointer to a calendar object.
* @return the created header
*/
lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CALENDAR_HEADER_ARROW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CALENDAR_HEADER_DROPDOWN_H*/
@@ -0,0 +1,460 @@
/**
* @file lv_chart.h
*
*/
#ifndef LV_CHART_H
#define LV_CHART_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_CHART != 0
/*********************
* DEFINES
*********************/
/**Default value of points. Can be used to not draw a point*/
#if LV_USE_LARGE_COORD
#define LV_CHART_POINT_NONE (INT32_MAX)
#else
#define LV_CHART_POINT_NONE (INT16_MAX)
#endif
LV_EXPORT_CONST_INT(LV_CHART_POINT_NONE);
/**********************
* TYPEDEFS
**********************/
/**
* Chart types
*/
enum {
LV_CHART_TYPE_NONE, /**< Don't draw the series*/
LV_CHART_TYPE_LINE, /**< Connect the points with lines*/
LV_CHART_TYPE_BAR, /**< Draw columns*/
LV_CHART_TYPE_SCATTER, /**< Draw points and lines in 2D (x,y coordinates)*/
};
typedef uint8_t lv_chart_type_t;
/**
* Chart update mode for `lv_chart_set_next`
*/
enum {
LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one the right*/
LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/
};
typedef uint8_t lv_chart_update_mode_t;
/**
* Enumeration of the axis'
*/
enum {
LV_CHART_AXIS_PRIMARY_Y = 0x00,
LV_CHART_AXIS_SECONDARY_Y = 0x01,
LV_CHART_AXIS_PRIMARY_X = 0x02,
LV_CHART_AXIS_SECONDARY_X = 0x04,
_LV_CHART_AXIS_LAST
};
typedef uint8_t lv_chart_axis_t;
/**
* Descriptor a chart series
*/
typedef struct {
lv_coord_t * x_points;
lv_coord_t * y_points;
lv_color_t color;
uint16_t start_point;
uint8_t hidden : 1;
uint8_t x_ext_buf_assigned : 1;
uint8_t y_ext_buf_assigned : 1;
uint8_t x_axis_sec : 1;
uint8_t y_axis_sec : 1;
} lv_chart_series_t;
typedef struct {
lv_point_t pos;
lv_coord_t point_id;
lv_color_t color;
lv_chart_series_t * ser;
lv_dir_t dir;
uint8_t pos_set: 1; /*1: pos is set; 0: point_id is set*/
} lv_chart_cursor_t;
typedef struct {
lv_coord_t major_len;
lv_coord_t minor_len;
lv_coord_t draw_size;
uint32_t minor_cnt : 15;
uint32_t major_cnt : 15;
uint32_t label_en : 1;
} lv_chart_tick_dsc_t;
typedef struct {
lv_obj_t obj;
lv_ll_t series_ll; /**< Linked list for the series (stores lv_chart_series_t)*/
lv_ll_t cursor_ll; /**< Linked list for the cursors (stores lv_chart_cursor_t)*/
lv_chart_tick_dsc_t tick[4];
lv_coord_t ymin[2];
lv_coord_t ymax[2];
lv_coord_t xmin[2];
lv_coord_t xmax[2];
lv_coord_t pressed_point_id;
uint16_t hdiv_cnt; /**< Number of horizontal division lines*/
uint16_t vdiv_cnt; /**< Number of vertical division lines*/
uint16_t point_cnt; /**< Point number in a data line*/
uint16_t zoom_x;
uint16_t zoom_y;
lv_chart_type_t type : 3; /**< Line or column chart*/
lv_chart_update_mode_t update_mode : 1;
} lv_chart_t;
extern const lv_obj_class_t lv_chart_class;
/**
* `type` field in `lv_obj_draw_part_dsc_t` if `class_p = lv_chart_class`
* Used in `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END`
*/
typedef enum {
LV_CHART_DRAW_PART_DIV_LINE_INIT, /**< Used before/after drawn the div lines*/
LV_CHART_DRAW_PART_DIV_LINE_HOR, /**< Used for each horizontal division lines*/
LV_CHART_DRAW_PART_DIV_LINE_VER, /**< Used for each vertical division lines*/
LV_CHART_DRAW_PART_LINE_AND_POINT, /**< Used on line and scatter charts for lines and points*/
LV_CHART_DRAW_PART_BAR, /**< Used on bar charts for the rectangles*/
LV_CHART_DRAW_PART_CURSOR, /**< Used on cursor lines and points*/
LV_CHART_DRAW_PART_TICK_LABEL, /**< Used on tick lines and labels*/
} lv_chart_draw_part_type_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a chart object
* @param parent pointer to an object, it will be the parent of the new chart
* @return pointer to the created chart
*/
lv_obj_t * lv_chart_create(lv_obj_t * parent);
/**
* Set a new type for a chart
* @param obj pointer to a chart object
* @param type new type of the chart (from 'lv_chart_type_t' enum)
*/
void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type);
/**
* Set the number of points on a data line on a chart
* @param obj pointer to a chart object
* @param cnt new number of points on the data lines
*/
void lv_chart_set_point_count(lv_obj_t * obj, uint16_t cnt);
/**
* Set the minimal and maximal y values on an axis
* @param obj pointer to a chart object
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
* @param min minimum value of the y axis
* @param max maximum value of the y axis
*/
void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t min, lv_coord_t max);
/**
* Set update mode of the chart object. Affects
* @param obj pointer to a chart object
* @param mode the update mode
*/
void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode);
/**
* Set the number of horizontal and vertical division lines
* @param obj pointer to a chart object
* @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines
*/
void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv);
/**
* Zoom into the chart in X direction
* @param obj pointer to a chart object
* @param zoom_x zoom in x direction. LV_ZOOM_NONE or 256 for no zoom, 512 double zoom
*/
void lv_chart_set_zoom_x(lv_obj_t * obj, uint16_t zoom_x);
/**
* Zoom into the chart in Y direction
* @param obj pointer to a chart object
* @param zoom_y zoom in y direction. LV_ZOOM_NONE or 256 for no zoom, 512 double zoom
*/
void lv_chart_set_zoom_y(lv_obj_t * obj, uint16_t zoom_y);
/**
* Get X zoom of a chart
* @param obj pointer to a chart object
* @return the X zoom value
*/
uint16_t lv_chart_get_zoom_x(const lv_obj_t * obj);
/**
* Get Y zoom of a chart
* @param obj pointer to a chart object
* @return the Y zoom value
*/
uint16_t lv_chart_get_zoom_y(const lv_obj_t * obj);
/**
* Set the number of tick lines on an axis
* @param obj pointer to a chart object
* @param axis an axis which ticks count should be set
* @param major_len length of major ticks
* @param minor_len length of minor ticks
* @param major_cnt number of major ticks on the axis
* @param minor_cnt number of minor ticks between two major ticks
* @param label_en true: enable label drawing on major ticks
* @param draw_size extra size required to draw the tick and labels
* (start with 20 px and increase if the ticks/labels are clipped)
*/
void lv_chart_set_axis_tick(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t major_len, lv_coord_t minor_len,
lv_coord_t major_cnt, lv_coord_t minor_cnt, bool label_en, lv_coord_t draw_size);
/**
* Get the type of a chart
* @param obj pointer to chart object
* @return type of the chart (from 'lv_chart_t' enum)
*/
lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj);
/**
* Get the data point number per data line on chart
* @param chart pointer to chart object
* @return point number on each data line
*/
uint16_t lv_chart_get_point_count(const lv_obj_t * obj);
/**
* Get the current index of the x-axis start point in the data array
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @return the index of the current x start point in the data array
*/
uint16_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser);
/**
* Get the position of a point to the chart.
* @param chart pointer to a chart object
* @param ser pointer to series
* @param id the index.
* @param p_out store the result position here
*/
void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_point_t * p_out);
/**
* Refresh a chart if its data line has changed
* @param chart pointer to chart object
*/
void lv_chart_refresh(lv_obj_t * obj);
/*======================
* Series
*=====================*/
/**
* Allocate and add a data series to the chart
* @param obj pointer to a chart object
* @param color color of the data series
* @param axis the y axis to which the series should be attached (::LV_CHART_AXIS_PRIMARY_Y or ::LV_CHART_AXIS_SECONDARY_Y)
* @return pointer to the allocated data series
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_chart_axis_t axis);
/**
* Deallocate and remove a data series from a chart
* @param chart pointer to a chart object
* @param series pointer to a data series on 'chart'
*/
void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series);
/**
* Hide/Unhide a single series of a chart.
* @param obj pointer to a chart object.
* @param series pointer to a series object
* @param hide true: hide the series
*/
void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide);
/**
* Change the color of a series
* @param obj pointer to a chart object.
* @param series pointer to a series object
* @param color the new color of the series
*/
void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color);
/**
* Set the index of the x-axis start point in the data array.
* This point will be considers the first (left) point and the other points will be drawn after it.
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the data array
*/
void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id);
/**
* Get the next series.
* @param chart pointer to a chart
* @param ser the previous series or NULL to get the first
* @return the next series or NULL if there is no more.
*/
lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * chart, const lv_chart_series_t * ser);
/*=====================
* Cursor
*====================*/
/**
* Add a cursor with a given color
* @param obj pointer to chart object
* @param color color of the cursor
* @param dir direction of the cursor. `LV_DIR_RIGHT/LEFT/TOP/DOWN/HOR/VER/ALL`. OR-ed values are possible
* @return pointer to the created cursor
*/
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_dir_t dir);
/**
* Set the coordinate of the cursor with respect to the paddings
* @param obj pointer to a chart object
* @param cursor pointer to the cursor
* @param pos the new coordinate of cursor relative to the chart
*/
void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos);
/**
* Stick the cursor to a point
* @param obj pointer to a chart object
* @param cursor pointer to the cursor
* @param ser pointer to a series
* @param point_id the point's index or `LV_CHART_POINT_NONE` to not assign to any points.
*/
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser,
uint16_t point_id);
/**
* Get the coordinate of the cursor with respect to the paddings
* @param obj pointer to a chart object
* @param cursor pointer to cursor
* @return coordinate of the cursor as lv_point_t
*/
lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor);
/*=====================
* Set/Get value(s)
*====================*/
/**
* Initialize all data points of a series with a value
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param value the new value for all points. `LV_CHART_POINT_NONE` can be used to hide the points.
*/
void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value);
/**
* Set the next point's Y value according to the update mode policy.
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param value the new value of the next data
*/
void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value);
/**
* Set the next point's X and Y value according to the update mode policy.
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param x_value the new X value of the next data
* @param y_value the new Y value of the next data
*/
void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t x_value, lv_coord_t y_value);
/**
* Set an individual point's y value of a chart's series directly based on its index
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the array
* @param value value to assign to array point
*/
void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t value);
/**
* Set an individual point's x and y value of a chart's series directly based on its index
* Can be used only with `LV_CHART_TYPE_SCATTER`.
* @param obj pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the array
* @param x_value the new X value of the next data
* @param y_value the new Y value of the next data
*/
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t x_value,
lv_coord_t y_value);
/**
* Set an external array for the y data points to use for the chart
* NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size.
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param array external array of points for chart
*/
void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]);
/**
* Set an external array for the x data points to use for the chart
* NOTE: It is the users responsibility to make sure the `point_cnt` matches the external array size.
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param array external array of points for chart
*/
void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]);
/**
* Get the array of y values of a series
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @return the array of values with 'point_count' elements
*/
lv_coord_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser);
/**
* Get the array of x values of a series
* @param obj pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @return the array of values with 'point_count' elements
*/
lv_coord_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser);
/**
* Get the index of the currently pressed point. It's the same for every series.
* @param obj pointer to a chart object
* @return the index of the point [0 .. point count] or LV_CHART_POINT_ID_NONE if no point is being pressed
*/
uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CHART*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_CHART_H*/
@@ -0,0 +1,142 @@
/**
* @file lv_colorwheel.h
*
*/
#ifndef LV_COLORWHEEL_H
#define LV_COLORWHEEL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_COLORWHEEL
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
enum {
LV_COLORWHEEL_MODE_HUE,
LV_COLORWHEEL_MODE_SATURATION,
LV_COLORWHEEL_MODE_VALUE
};
typedef uint8_t lv_colorwheel_mode_t;
/*Data of color picker*/
typedef struct {
lv_obj_t obj;
lv_color_hsv_t hsv;
struct {
lv_point_t pos;
uint8_t recolor : 1;
} knob;
uint32_t last_click_time;
uint32_t last_change_time;
lv_point_t last_press_point;
lv_colorwheel_mode_t mode : 2;
uint8_t mode_fixed : 1;
} lv_colorwheel_t;
extern const lv_obj_class_t lv_colorwheel_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a color picker object with disc shape
* @param parent pointer to an object, it will be the parent of the new color picker
* @param knob_recolor true: set the knob's color to the current color
* @return pointer to the created color picker
*/
lv_obj_t * lv_colorwheel_create(lv_obj_t * parent, bool knob_recolor);
/*=====================
* Setter functions
*====================*/
/**
* Set the current hsv of a color wheel.
* @param colorwheel pointer to color wheel object
* @param color current selected hsv
* @return true if changed, otherwise false
*/
bool lv_colorwheel_set_hsv(lv_obj_t * obj, lv_color_hsv_t hsv);
/**
* Set the current color of a color wheel.
* @param colorwheel pointer to color wheel object
* @param color current selected color
* @return true if changed, otherwise false
*/
bool lv_colorwheel_set_rgb(lv_obj_t * obj, lv_color_t color);
/**
* Set the current color mode.
* @param colorwheel pointer to color wheel object
* @param mode color mode (hue/sat/val)
*/
void lv_colorwheel_set_mode(lv_obj_t * obj, lv_colorwheel_mode_t mode);
/**
* Set if the color mode is changed on long press on center
* @param colorwheel pointer to color wheel object
* @param fixed color mode cannot be changed on long press
*/
void lv_colorwheel_set_mode_fixed(lv_obj_t * obj, bool fixed);
/*=====================
* Getter functions
*====================*/
/**
* Get the current selected hsv of a color wheel.
* @param colorwheel pointer to color wheel object
* @return current selected hsv
*/
lv_color_hsv_t lv_colorwheel_get_hsv(lv_obj_t * obj);
/**
* Get the current selected color of a color wheel.
* @param colorwheel pointer to color wheel object
* @return color current selected color
*/
lv_color_t lv_colorwheel_get_rgb(lv_obj_t * obj);
/**
* Get the current color mode.
* @param colorwheel pointer to color wheel object
* @return color mode (hue/sat/val)
*/
lv_colorwheel_mode_t lv_colorwheel_get_color_mode(lv_obj_t * obj);
/**
* Get if the color mode is changed on long press on center
* @param colorwheel pointer to color wheel object
* @return mode cannot be changed on long press
*/
bool lv_colorwheel_get_color_mode_fixed(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_COLORWHEEL*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_COLORWHEEL_H*/
@@ -0,0 +1,131 @@
/**
* @file lv_imgbtn.h
*
*/
#ifndef LV_IMGBTN_H
#define LV_IMGBTN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_IMGBTN != 0
/*********************
* DEFINES
*********************/
typedef enum {
LV_IMGBTN_STATE_RELEASED,
LV_IMGBTN_STATE_PRESSED,
LV_IMGBTN_STATE_DISABLED,
LV_IMGBTN_STATE_CHECKED_RELEASED,
LV_IMGBTN_STATE_CHECKED_PRESSED,
LV_IMGBTN_STATE_CHECKED_DISABLED,
_LV_IMGBTN_STATE_NUM,
} lv_imgbtn_state_t;
/**********************
* TYPEDEFS
**********************/
/*Data of image button*/
typedef struct {
lv_obj_t obj;
const void * img_src_mid[_LV_IMGBTN_STATE_NUM]; /*Store center images to each state*/
const void * img_src_left[_LV_IMGBTN_STATE_NUM]; /*Store left side images to each state*/
const void * img_src_right[_LV_IMGBTN_STATE_NUM]; /*Store right side images to each state*/
lv_img_cf_t act_cf; /*Color format of the currently active image*/
} lv_imgbtn_t;
extern const lv_obj_class_t lv_imgbtn_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an image button object
* @param parent pointer to an object, it will be the parent of the new image button
* @return pointer to the created image button
*/
lv_obj_t * lv_imgbtn_create(lv_obj_t * parent);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set images for a state of the image button
* @param imgbtn pointer to an image button object
* @param state for which state set the new image
* @param src_left pointer to an image source for the left side of the button (a C array or path to
* a file)
* @param src_mid pointer to an image source for the middle of the button (ideally 1px wide) (a C
* array or path to a file)
* @param src_right pointer to an image source for the right side of the button (a C array or path
* to a file)
*/
void lv_imgbtn_set_src(lv_obj_t * imgbtn, lv_imgbtn_state_t state, const void * src_left, const void * src_mid,
const void * src_right);
/**
* Use this function instead of `lv_obj_add/clear_state` to set a state manually
* @param imgbtn pointer to an image button object
* @param state the new state
*/
void lv_imgbtn_set_state(lv_obj_t * imgbtn, lv_imgbtn_state_t state);
/*=====================
* Getter functions
*====================*/
/**
* Get the left image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the left image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_left(lv_obj_t * imgbtn, lv_imgbtn_state_t state);
/**
* Get the middle image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the middle image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_middle(lv_obj_t * imgbtn, lv_imgbtn_state_t state);
/**
* Get the right image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the left image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_right(lv_obj_t * imgbtn, lv_imgbtn_state_t state);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_IMGBTN*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_IMGBTN_H*/
@@ -0,0 +1,187 @@
/**
* @file lv_keyboard.h
*
*/
#ifndef LV_KEYBOARD_H
#define LV_KEYBOARD_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/widgets/lv_btnmatrix.h"
#if LV_USE_KEYBOARD
/*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0
#error "lv_kb: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_TEXTAREA == 0
#error "lv_kb: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
#endif
/*********************
* DEFINES
*********************/
#define LV_KEYBOARD_CTRL_BTN_FLAGS (LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CLICK_TRIG | LV_BTNMATRIX_CTRL_CHECKED)
/**********************
* TYPEDEFS
**********************/
/** Current keyboard mode.*/
enum {
LV_KEYBOARD_MODE_TEXT_LOWER,
LV_KEYBOARD_MODE_TEXT_UPPER,
LV_KEYBOARD_MODE_SPECIAL,
LV_KEYBOARD_MODE_NUMBER,
LV_KEYBOARD_MODE_USER_1,
LV_KEYBOARD_MODE_USER_2,
LV_KEYBOARD_MODE_USER_3,
LV_KEYBOARD_MODE_USER_4,
};
typedef uint8_t lv_keyboard_mode_t;
/*Data of keyboard*/
typedef struct {
lv_btnmatrix_t btnm;
lv_obj_t * ta; /*Pointer to the assigned text area*/
lv_keyboard_mode_t mode; /*Key map type*/
uint8_t popovers : 1; /*Show button titles in popovers on press*/
} lv_keyboard_t;
extern const lv_obj_class_t lv_keyboard_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Keyboard object
* @param parent pointer to an object, it will be the parent of the new keyboard
* @return pointer to the created keyboard
*/
lv_obj_t * lv_keyboard_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @param ta pointer to a Text Area object to write there
*/
void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @param mode the mode from 'lv_keyboard_mode_t'
*/
void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode);
/**
* Show the button title in a popover when pressed.
* @param kb pointer to a Keyboard object
* @param en whether "popovers" mode is enabled
*/
void lv_keyboard_set_popovers(lv_obj_t * kb, bool en);
/**
* Set a new map for the keyboard
* @param kb pointer to a Keyboard object
* @param mode keyboard map to alter 'lv_keyboard_mode_t'
* @param map pointer to a string array to describe the map.
* See 'lv_btnmatrix_set_map()' for more info.
*/
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[],
const lv_btnmatrix_ctrl_t ctrl_map[]);
/*=====================
* Getter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @return pointer to the assigned Text Area object
*/
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @return the current mode from 'lv_keyboard_mode_t'
*/
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb);
/**
* Tell whether "popovers" mode is enabled or not.
* @param kb pointer to a Keyboard object
* @return true: "popovers" mode is enabled; false: disabled
*/
bool lv_btnmatrix_get_popovers(const lv_obj_t * obj);
/**
* Get the current map of a keyboard
* @param kb pointer to a keyboard object
* @return the current map
*/
static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb)
{
return lv_btnmatrix_get_map(kb);
}
/**
* Get the index of the lastly "activated" button by the user (pressed, released, focused etc)
* Useful in the `event_cb` to get the text of the button, check if hidden etc.
* @param obj pointer to button matrix object
* @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)
*/
static inline uint16_t lv_keyboard_get_selected_btn(const lv_obj_t * obj)
{
return lv_btnmatrix_get_selected_btn(obj);
}
/**
* Get the button's text
* @param obj pointer to button matrix object
* @param btn_id the index a button not counting new line characters.
* @return text of btn_index` button
*/
static inline const char * lv_keyboard_get_btn_text(const lv_obj_t * obj, uint16_t btn_id)
{
return lv_btnmatrix_get_btn_text(obj, btn_id);
}
/*=====================
* Other functions
*====================*/
/**
* Default keyboard event to add characters to the Text area and change the map.
* If a custom `event_cb` is added to the keyboard this function can be called from it to handle the
* button clicks
* @param kb pointer to a keyboard
* @param event the triggering event
*/
void lv_keyboard_def_event_cb(lv_event_t * e);
/**********************
* MACROS
**********************/
#endif /*LV_USE_KEYBOARD*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_KEYBOARD_H*/
+116
View File
@@ -0,0 +1,116 @@
/**
* @file lv_led.h
*
*/
#ifndef LV_LED_H
#define LV_LED_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_LED
/*********************
* DEFINES
*********************/
/** Brightness when the LED if OFF */
#ifndef LV_LED_BRIGHT_MIN
# define LV_LED_BRIGHT_MIN 80
#endif
/** Brightness when the LED if ON */
#ifndef LV_LED_BRIGHT_MAX
# define LV_LED_BRIGHT_MAX 255
#endif
/**********************
* TYPEDEFS
**********************/
/*Data of led*/
typedef struct {
lv_obj_t obj;
lv_color_t color;
uint8_t bright; /**< Current brightness of the LED (0..255)*/
} lv_led_t;
extern const lv_obj_class_t lv_led_class;
/**
* `type` field in `lv_obj_draw_part_dsc_t` if `class_p = lv_led_class`
* Used in `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END`
*/
typedef enum {
LV_LED_DRAW_PART_RECTANGLE, /**< The main rectangle*/
} lv_led_draw_part_type_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a led object
* @param parent pointer to an object, it will be the parent of the new led
* @return pointer to the created led
*/
lv_obj_t * lv_led_create(lv_obj_t * parent);
/**
* Set the color of the LED
* @param led pointer to a LED object
* @param color the color of the LED
*/
void lv_led_set_color(lv_obj_t * led, lv_color_t color);
/**
* Set the brightness of a LED object
* @param led pointer to a LED object
* @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light)
*/
void lv_led_set_brightness(lv_obj_t * led, uint8_t bright);
/**
* Light on a LED
* @param led pointer to a LED object
*/
void lv_led_on(lv_obj_t * led);
/**
* Light off a LED
* @param led pointer to a LED object
*/
void lv_led_off(lv_obj_t * led);
/**
* Toggle the state of a LED
* @param led pointer to a LED object
*/
void lv_led_toggle(lv_obj_t * led);
/**
* Get the brightness of a LEd object
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_brightness(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LED*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LED_H*/
@@ -0,0 +1,54 @@
/**
* @file lv_win.h
*
*/
#ifndef LV_LIST_H
#define LV_LIST_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/core/lv_obj.h"
#include "liblvgl/extra/layouts/flex/lv_flex.h"
#if LV_USE_LIST
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
extern const lv_obj_class_t lv_list_class;
extern const lv_obj_class_t lv_list_text_class;
extern const lv_obj_class_t lv_list_btn_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_obj_t * lv_list_create(lv_obj_t * parent);
lv_obj_t * lv_list_add_text(lv_obj_t * list, const char * txt);
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * icon, const char * txt);
const char * lv_list_get_btn_text(lv_obj_t * list, lv_obj_t * btn);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LIST*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LIST_H*/
@@ -0,0 +1,56 @@
/**
* @file lv_widgets.h
*
*/
#ifndef LV_WIDGETS_H
#define LV_WIDGETS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "animimg/lv_animimg.h"
#include "calendar/lv_calendar.h"
#include "calendar/lv_calendar_header_arrow.h"
#include "calendar/lv_calendar_header_dropdown.h"
#include "chart/lv_chart.h"
#include "keyboard/lv_keyboard.h"
#include "list/lv_list.h"
#include "menu/lv_menu.h"
#include "msgbox/lv_msgbox.h"
#include "meter/lv_meter.h"
#include "spinbox/lv_spinbox.h"
#include "spinner/lv_spinner.h"
#include "tabview/lv_tabview.h"
#include "tileview/lv_tileview.h"
#include "win/lv_win.h"
#include "colorwheel/lv_colorwheel.h"
#include "led/lv_led.h"
#include "imgbtn/lv_imgbtn.h"
#include "span/lv_span.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WIDGETS_H*/
@@ -0,0 +1,233 @@
/**
* @file lv_menu.h
*
*/
#ifndef LV_MENU_H
#define LV_MENU_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/core/lv_obj.h"
#if LV_USE_MENU
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
enum {
LV_MENU_HEADER_TOP_FIXED, /* Header is positioned at the top */
LV_MENU_HEADER_TOP_UNFIXED, /* Header is positioned at the top and can be scrolled out of view*/
LV_MENU_HEADER_BOTTOM_FIXED /* Header is positioned at the bottom */
};
typedef uint8_t lv_menu_mode_header_t;
enum {
LV_MENU_ROOT_BACK_BTN_DISABLED,
LV_MENU_ROOT_BACK_BTN_ENABLED
};
typedef uint8_t lv_menu_mode_root_back_btn_t;
typedef struct lv_menu_load_page_event_data_t {
lv_obj_t * menu;
lv_obj_t * page;
} lv_menu_load_page_event_data_t;
typedef struct {
lv_obj_t * page;
} lv_menu_history_t;
typedef struct {
lv_obj_t obj;
lv_obj_t * storage; /* a pointer to obj that is the parent of all pages not displayed */
lv_obj_t * main;
lv_obj_t * main_page;
lv_obj_t * main_header;
lv_obj_t *
main_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'main_header' */
lv_obj_t * main_header_title;
lv_obj_t * sidebar;
lv_obj_t * sidebar_page;
lv_obj_t * sidebar_header;
lv_obj_t *
sidebar_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'sidebar_header' */
lv_obj_t * sidebar_header_title;
lv_obj_t * selected_tab;
lv_ll_t history_ll;
uint8_t cur_depth;
uint8_t prev_depth;
uint8_t sidebar_generated : 1;
lv_menu_mode_header_t mode_header : 2;
lv_menu_mode_root_back_btn_t mode_root_back_btn : 1;
} lv_menu_t;
typedef struct {
lv_obj_t obj;
char * title;
} lv_menu_page_t;
extern const lv_obj_class_t lv_menu_class;
extern const lv_obj_class_t lv_menu_page_class;
extern const lv_obj_class_t lv_menu_cont_class;
extern const lv_obj_class_t lv_menu_section_class;
extern const lv_obj_class_t lv_menu_separator_class;
extern const lv_obj_class_t lv_menu_sidebar_cont_class;
extern const lv_obj_class_t lv_menu_main_cont_class;
extern const lv_obj_class_t lv_menu_sidebar_header_cont_class;
extern const lv_obj_class_t lv_menu_main_header_cont_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a menu object
* @param parent pointer to an object, it will be the parent of the new menu
* @return pointer to the created menu
*/
lv_obj_t * lv_menu_create(lv_obj_t * parent);
/**
* Create a menu page object
* @param parent pointer to menu object
* @param title pointer to text for title in header (NULL to not display title)
* @return pointer to the created menu page
*/
lv_obj_t * lv_menu_page_create(lv_obj_t * parent, char * title);
/**
* Create a menu cont object
* @param parent pointer to an object, it will be the parent of the new menu cont object
* @return pointer to the created menu cont
*/
lv_obj_t * lv_menu_cont_create(lv_obj_t * parent);
/**
* Create a menu section object
* @param parent pointer to an object, it will be the parent of the new menu section object
* @return pointer to the created menu section
*/
lv_obj_t * lv_menu_section_create(lv_obj_t * parent);
/**
* Create a menu separator object
* @param parent pointer to an object, it will be the parent of the new menu separator object
* @return pointer to the created menu separator
*/
lv_obj_t * lv_menu_separator_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set menu page to display in main
* @param obj pointer to the menu
* @param page pointer to the menu page to set (NULL to clear main and clear menu history)
*/
void lv_menu_set_page(lv_obj_t * obj, lv_obj_t * page);
/**
* Set menu page to display in sidebar
* @param obj pointer to the menu
* @param page pointer to the menu page to set (NULL to clear sidebar)
*/
void lv_menu_set_sidebar_page(lv_obj_t * obj, lv_obj_t * page);
/**
* Set the how the header should behave and its position
* @param obj pointer to a menu
* @param mode_header
*/
void lv_menu_set_mode_header(lv_obj_t * obj, lv_menu_mode_header_t mode_header);
/**
* Set whether back button should appear at root
* @param obj pointer to a menu
* @param mode_root_back_btn
*/
void lv_menu_set_mode_root_back_btn(lv_obj_t * obj, lv_menu_mode_root_back_btn_t mode_root_back_btn);
/**
* Add menu to the menu item
* @param menu pointer to the menu
* @param obj pointer to the obj
* @param page pointer to the page to load when obj is clicked
*/
void lv_menu_set_load_page_event(lv_obj_t * menu, lv_obj_t * obj, lv_obj_t * page);
/*=====================
* Getter functions
*====================*/
/**
* Get a pointer to menu page that is currently displayed in main
* @param obj pointer to the menu
* @return pointer to current page
*/
lv_obj_t * lv_menu_get_cur_main_page(lv_obj_t * obj);
/**
* Get a pointer to menu page that is currently displayed in sidebar
* @param obj pointer to the menu
* @return pointer to current page
*/
lv_obj_t * lv_menu_get_cur_sidebar_page(lv_obj_t * obj);
/**
* Get a pointer to main header obj
* @param obj pointer to the menu
* @return pointer to main header obj
*/
lv_obj_t * lv_menu_get_main_header(lv_obj_t * obj);
/**
* Get a pointer to main header back btn obj
* @param obj pointer to the menu
* @return pointer to main header back btn obj
*/
lv_obj_t * lv_menu_get_main_header_back_btn(lv_obj_t * obj);
/**
* Get a pointer to sidebar header obj
* @param obj pointer to the menu
* @return pointer to sidebar header obj
*/
lv_obj_t * lv_menu_get_sidebar_header(lv_obj_t * obj);
/**
* Get a pointer to sidebar header obj
* @param obj pointer to the menu
* @return pointer to sidebar header back btn obj
*/
lv_obj_t * lv_menu_get_sidebar_header_back_btn(lv_obj_t * obj);
/**
* Check if an obj is a root back btn
* @param menu pointer to the menu
* @return true if it is a root back btn
*/
bool lv_menu_back_btn_is_root(lv_obj_t * menu, lv_obj_t * obj);
/**
* Clear menu history
* @param obj pointer to the menu
*/
void lv_menu_clear_history(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MENU*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MENU_H*/
@@ -0,0 +1,267 @@
/**
* @file lv_meter.h
*
*/
#ifndef LV_METER_H
#define LV_METER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_METER != 0
/*Testing of dependencies*/
#if LV_DRAW_COMPLEX == 0
#error "lv_meter: Complex drawing is required. Enable it in lv_conf.h (LV_DRAW_COMPLEX 1)"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
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;
} lv_meter_scale_t;
enum {
LV_METER_INDICATOR_TYPE_NEEDLE_IMG,
LV_METER_INDICATOR_TYPE_NEEDLE_LINE,
LV_METER_INDICATOR_TYPE_SCALE_LINES,
LV_METER_INDICATOR_TYPE_ARC,
};
typedef uint8_t lv_meter_indicator_type_t;
typedef struct {
lv_meter_scale_t * scale;
lv_meter_indicator_type_t type;
lv_opa_t opa;
int32_t start_value;
int32_t end_value;
union {
struct {
const void * src;
lv_point_t pivot;
} needle_img;
struct {
uint16_t width;
int16_t r_mod;
lv_color_t color;
} needle_line;
struct {
uint16_t width;
const void * src;
lv_color_t color;
int16_t r_mod;
} arc;
struct {
int16_t width_mod;
lv_color_t color_start;
lv_color_t color_end;
uint8_t local_grad : 1;
} scale_lines;
} type_data;
} lv_meter_indicator_t;
/*Data of line meter*/
typedef struct {
lv_obj_t obj;
lv_ll_t scale_ll;
lv_ll_t indicator_ll;
} lv_meter_t;
extern const lv_obj_class_t lv_meter_class;
/**
* `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`
*/
typedef enum {
LV_METER_DRAW_PART_ARC, /**< The arc indicator*/
LV_METER_DRAW_PART_NEEDLE_LINE, /**< The needle lines*/
LV_METER_DRAW_PART_NEEDLE_IMG, /**< The needle images*/
LV_METER_DRAW_PART_TICK, /**< The tick lines and labels*/
} lv_meter_draw_part_type_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Meter object
* @param parent pointer to an object, it will be the parent of the new bar.
* @return pointer to the created meter
*/
lv_obj_t * lv_meter_create(lv_obj_t * parent);
/*=====================
* Add scale
*====================*/
/**
* Add a new scale to the meter.
* @param obj pointer to a meter object
* @return the new scale
* @note Indicators can be attached to scales.
*/
lv_meter_scale_t * lv_meter_add_scale(lv_obj_t * obj);
/**
* Set the properties of the ticks of a scale
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param cnt number of tick lines
* @param width width of tick lines
* @param len length of tick lines
* @param color color of tick lines
*/
void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t cnt, uint16_t width, uint16_t len,
lv_color_t color);
/**
* Make some "normal" ticks major ticks and set their attributes.
* Texts with the current value are also added to the major ticks.
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param nth make every Nth normal tick major tick. (start from the first on the left)
* @param width width of the major ticks
* @param len length of the major ticks
* @param color color of the major ticks
* @param label_gap gap between the major ticks and the labels
*/
void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t nth, uint16_t width,
uint16_t len, lv_color_t color, int16_t label_gap);
/**
* Set the value and angular range of a scale.
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param min the minimum value
* @param max the maximal value
* @param angle_range the angular range of the scale
* @param rotation the angular offset from the 3 o'clock position (clock-wise)
*/
void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t min, int32_t max, uint32_t angle_range,
uint32_t rotation);
/*=====================
* Add indicator
*====================*/
/**
* Add a needle line indicator the scale
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param width width of the line
* @param color color of the line
* @param r_mod the radius modifier (added to the scale's radius) to get the lines length
* @return the new indicator
*/
lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width,
lv_color_t color, int16_t r_mod);
/**
* Add a needle image indicator the scale
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param src the image source of the indicator. path or pointer to ::lv_img_dsc_t
* @param pivot_x the X pivot point of the needle
* @param pivot_y the Y pivot point of the needle
* @return the new indicator
* @note the needle image should point to the right, like -O----->
*/
lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src,
lv_coord_t pivot_x, lv_coord_t pivot_y);
/**
* Add an arc indicator the scale
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param width width of the arc
* @param color color of the arc
* @param r_mod the radius modifier (added to the scale's radius) to get the outer radius of the arc
* @return the new indicator
*/
lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color,
int16_t r_mod);
/**
* Add a scale line indicator the scale. It will modify the ticks.
* @param obj pointer to a meter object
* @param scale pointer to scale (added to `meter`)
* @param color_start the start color
* @param color_end the end color
* @param local tell how to map start and end color. true: the indicator's start and end_value; false: the scale's min max value
* @param width_mod add this the affected tick's width
* @return the new indicator
*/
lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start,
lv_color_t color_end, bool local, int16_t width_mod);
/*=====================
* Set indicator value
*====================*/
/**
* Set the value of the indicator. It will set start and and value to the same value
* @param obj pointer to a meter object
* @param indic pointer to an indicator
* @param value the new value
*/
void lv_meter_set_indicator_value(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value);
/**
* Set the start value of the indicator.
* @param obj pointer to a meter object
* @param indic pointer to an indicator
* @param 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.
* @param obj pointer to a meter object
* @param indic pointer to an indicator
* @param value the new value
*/
void lv_meter_set_indicator_end_value(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value);
/**********************
* MACROS
**********************/
#endif /*LV_USE_METER*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_METER_H*/
@@ -0,0 +1,99 @@
/**
* @file lv_mbox.h
*
*/
#ifndef LV_MSGBOX_H
#define LV_MSGBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_MSGBOX
/*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0
#error "lv_mbox: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_mbox: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_obj_t obj;
lv_obj_t * title;
lv_obj_t * close_btn;
lv_obj_t * content;
lv_obj_t * text;
lv_obj_t * btns;
} lv_msgbox_t;
extern const lv_obj_class_t lv_msgbox_class;
extern const lv_obj_class_t lv_msgbox_content_class;
extern const lv_obj_class_t lv_msgbox_backdrop_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a message box object
* @param parent pointer to parent or NULL to create a full screen modal message box
* @param title the title of the message box
* @param txt the text of the message box
* @param btn_txts the buttons as an array of texts terminated by an "" element. E.g. {"btn1", "btn2", ""}
* @param add_close_btn true: add a close button
* @return pointer to the message box object
*/
lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[],
bool add_close_btn);
lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj);
lv_obj_t * lv_msgbox_get_close_btn(lv_obj_t * obj);
lv_obj_t * lv_msgbox_get_text(lv_obj_t * obj);
lv_obj_t * lv_msgbox_get_content(lv_obj_t * obj);
lv_obj_t * lv_msgbox_get_btns(lv_obj_t * obj);
/**
* Get the index of the selected button
* @param mbox message box object
* @return index of the button (LV_BTNMATRIX_BTN_NONE: if unset)
*/
uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox);
const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox);
void lv_msgbox_close(lv_obj_t * mbox);
void lv_msgbox_close_async(lv_obj_t * mbox);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MSGBOX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_MSGBOX_H*/
@@ -0,0 +1,245 @@
/**
* @file lv_span.h
*
*/
#ifndef LV_SPAN_H
#define LV_SPAN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_SPAN != 0
/*********************
* DEFINES
*********************/
#ifndef LV_SPAN_SNIPPET_STACK_SIZE
#define LV_SPAN_SNIPPET_STACK_SIZE 64
#endif
/**********************
* TYPEDEFS
**********************/
enum {
LV_SPAN_OVERFLOW_CLIP,
LV_SPAN_OVERFLOW_ELLIPSIS,
};
typedef uint8_t lv_span_overflow_t;
enum {
LV_SPAN_MODE_FIXED, /**< fixed the obj size*/
LV_SPAN_MODE_EXPAND, /**< Expand the object size to the text size*/
LV_SPAN_MODE_BREAK, /**< Keep width, break the too long lines and expand height*/
};
typedef uint8_t lv_span_mode_t;
typedef struct {
char * txt; /* a pointer to display text */
lv_obj_t * spangroup; /* a pointer to spangroup */
lv_style_t style; /* display text style */
uint8_t static_flag : 1;/* the text is static flag */
} lv_span_t;
/** Data of label*/
typedef struct {
lv_obj_t obj;
int32_t lines;
lv_coord_t indent; /* first line indent */
lv_coord_t cache_w; /* the cache automatically calculates the width */
lv_coord_t cache_h; /* similar cache_w */
lv_ll_t child_ll;
uint8_t mode : 2; /* details see lv_span_mode_t */
uint8_t overflow : 1; /* details see lv_span_overflow_t */
uint8_t refresh : 1; /* the spangroup need refresh cache_w and cache_h */
} lv_spangroup_t;
extern const lv_obj_class_t lv_spangroup_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a spangroup object
* @param par pointer to an object, it will be the parent of the new spangroup
* @return pointer to the created spangroup
*/
lv_obj_t * lv_spangroup_create(lv_obj_t * par);
/**
* Create a span string descriptor and add to spangroup.
* @param obj pointer to a spangroup object.
* @return pointer to the created span.
*/
lv_span_t * lv_spangroup_new_span(lv_obj_t * obj);
/**
* Remove the span from the spangroup and free memory.
* @param obj pointer to a spangroup object.
* @param span pointer to a span.
*/
void lv_spangroup_del_span(lv_obj_t * obj, lv_span_t * span);
/*=====================
* Setter functions
*====================*/
/**
* Set a new text for a span. Memory will be allocated to store the text by the span.
* @param span pointer to a span.
* @param text pointer to a text.
*/
void lv_span_set_text(lv_span_t * span, const char * text);
/**
* Set a static text. It will not be saved by the span so the 'text' variable
* has to be 'alive' while the span exist.
* @param span pointer to a span.
* @param text pointer to a text.
*/
void lv_span_set_text_static(lv_span_t * span, const char * text);
/**
* Set the align of the spangroup.
* @param obj pointer to a spangroup object.
* @param align see lv_text_align_t for details.
*/
void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align);
/**
* Set the overflow of the spangroup.
* @param obj pointer to a spangroup object.
* @param overflow see lv_span_overflow_t for details.
*/
void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow);
/**
* Set the indent of the spangroup.
* @param obj pointer to a spangroup object.
* @param indent The first line indentation
*/
void lv_spangroup_set_indent(lv_obj_t * obj, lv_coord_t indent);
/**
* Set the mode of the spangroup.
* @param obj pointer to a spangroup object.
* @param mode see lv_span_mode_t for details.
*/
void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode);
/**
* Set lines of the spangroup.
* @param obj pointer to a spangroup object.
* @param lines max lines that can be displayed in LV_SPAN_MODE_BREAK mode. < 0 means no limit.
*/
void lv_spangroup_set_lines(lv_obj_t * obj, int32_t lines);
/*=====================
* Getter functions
*====================*/
/**
* Get a spangroup child by its index.
*
* @param obj The spangroup object
* @param id the index of the child.
* 0: the oldest (firstly created) child
* 1: the second oldest
* child count-1: the youngest
* -1: the youngest
* -2: the second youngest
* @return The child span at index `id`, or NULL if the ID does not exist
*/
lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id);
/**
*
* @param obj The spangroup object to get the child count of.
* @return The span count of the spangroup.
*/
uint32_t lv_spangroup_get_child_cnt(const lv_obj_t * obj);
/**
* get the align of the spangroup.
* @param obj pointer to a spangroup object.
* @return the align value.
*/
lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj);
/**
* get the overflow of the spangroup.
* @param obj pointer to a spangroup object.
* @return the overflow value.
*/
lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj);
/**
* get the indent of the spangroup.
* @param obj pointer to a spangroup object.
* @return the indent value.
*/
lv_coord_t lv_spangroup_get_indent(lv_obj_t * obj);
/**
* get the mode of the spangroup.
* @param obj pointer to a spangroup object.
*/
lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj);
/**
* get lines of the spangroup.
* @param obj pointer to a spangroup object.
* @return the lines value.
*/
int32_t lv_spangroup_get_lines(lv_obj_t * obj);
/**
* get max line height of all span in the spangroup.
* @param obj pointer to a spangroup object.
*/
lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t * obj);
/**
* get the text content width when all span of spangroup on a line.
* @param obj pointer to a spangroup object.
* @param max_width if text content width >= max_width, return max_width
* to reduce computation, if max_width == 0, returns the text content width.
* @return text content width or max_width.
*/
uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width);
/**
* get the text content height with width fixed.
* @param obj pointer to a spangroup object.
*/
lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width);
/*=====================
* Other functions
*====================*/
/**
* update the mode of the spangroup.
* @param obj pointer to a spangroup object.
*/
void lv_spangroup_refr_mode(lv_obj_t * obj);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPAN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_SPAN_H*/
@@ -0,0 +1,182 @@
/**
* @file lv_spinbox.h
*
*/
#ifndef LV_SPINBOX_H
#define LV_SPINBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_SPINBOX
/*Testing of dependencies*/
#if LV_USE_TEXTAREA == 0
#error "lv_spinbox: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
#endif
/*********************
* DEFINES
*********************/
#define LV_SPINBOX_MAX_DIGIT_COUNT 10
/**********************
* TYPEDEFS
**********************/
/*Data of spinbox*/
typedef struct {
lv_textarea_t ta; /*Ext. of ancestor*/
/*New data for this type*/
int32_t value;
int32_t range_max;
int32_t range_min;
int32_t step;
uint16_t digit_count : 4;
uint16_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/
uint16_t rollover : 1; // Set to true for rollover functionality
uint16_t digit_step_dir : 2; // the direction the digit will step on encoder button press when editing
} lv_spinbox_t;
extern const lv_obj_class_t lv_spinbox_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Spinbox object
* @param parent pointer to an object, it will be the parent of the new spinbox
* @return pointer to the created spinbox
*/
lv_obj_t * lv_spinbox_create(lv_obj_t * parent);
/*=====================
* Setter functions
*====================*/
/**
* Set spinbox value
* @param obj pointer to spinbox
* @param i value to be set
*/
void lv_spinbox_set_value(lv_obj_t * obj, int32_t i);
/**
* Set spinbox rollover function
* @param obj pointer to spinbox
* @param b true or false to enable or disable (default)
*/
void lv_spinbox_set_rollover(lv_obj_t * obj, bool b);
/**
* Set spinbox digit format (digit count and decimal format)
* @param obj pointer to spinbox
* @param digit_count number of digit excluding the decimal separator and the sign
* @param separator_position number of digit before the decimal point. If 0, decimal point is not
* shown
*/
void lv_spinbox_set_digit_format(lv_obj_t * obj, uint8_t digit_count, uint8_t separator_position);
/**
* Set spinbox step
* @param obj pointer to spinbox
* @param step steps on increment/decrement. Can be 1, 10, 100, 1000, etc the digit that will change.
*/
void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step);
/**
* Set spinbox value range
* @param obj pointer to spinbox
* @param range_min maximum value, inclusive
* @param range_max minimum value, inclusive
*/
void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max);
/**
* Set cursor position to a specific digit for edition
* @param obj pointer to spinbox
* @param pos selected position in spinbox
*/
void lv_spinbox_set_cursor_pos(lv_obj_t * obj, uint8_t pos);
/**
* Set direction of digit step when clicking an encoder button while in editing mode
* @param obj pointer to spinbox
* @param direction the direction (LV_DIR_RIGHT or LV_DIR_LEFT)
*/
void lv_spinbox_set_digit_step_direction(lv_obj_t * obj, lv_dir_t direction);
/*=====================
* Getter functions
*====================*/
/**
* Get spinbox rollover function status
* @param obj pointer to spinbox
*/
bool lv_spinbox_get_rollover(lv_obj_t * obj);
/**
* Get the spinbox numeral value (user has to convert to float according to its digit format)
* @param obj pointer to spinbox
* @return value integer value of the spinbox
*/
int32_t lv_spinbox_get_value(lv_obj_t * obj);
/**
* Get the spinbox step value (user has to convert to float according to its digit format)
* @param obj pointer to spinbox
* @return value integer step value of the spinbox
*/
int32_t lv_spinbox_get_step(lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**
* Select next lower digit for edition by dividing the step by 10
* @param obj pointer to spinbox
*/
void lv_spinbox_step_next(lv_obj_t * obj);
/**
* Select next higher digit for edition by multiplying the step by 10
* @param obj pointer to spinbox
*/
void lv_spinbox_step_prev(lv_obj_t * obj);
/**
* Increment spinbox value by one step
* @param obj pointer to spinbox
*/
void lv_spinbox_increment(lv_obj_t * obj);
/**
* Decrement spinbox value by one step
* @param obj pointer to spinbox
*/
void lv_spinbox_decrement(lv_obj_t * obj);
/**********************
* MACROS
**********************/
/* It was ambiguous in MicroPython. See https://github.com/lvgl/lvgl/issues/3301
* TODO remove in v9*/
#define lv_spinbox_set_pos lv_spinbox_set_cursor_pos
#endif /*LV_USE_SPINBOX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SPINBOX_H*/
@@ -0,0 +1,50 @@
/**
* @file lv_spinner.h
*
*/
#ifndef LV_SPINNER_H
#define LV_SPINNER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_SPINNER
/*Testing of dependencies*/
#if LV_USE_ARC == 0
#error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) "
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
extern const lv_obj_class_t lv_spinner_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_obj_t * lv_spinner_create(lv_obj_t * parent, uint32_t time, uint32_t arc_length);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPINNER*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_SPINNER_H*/
@@ -0,0 +1,65 @@
/**
* @file lv_templ.h
*
*/
#ifndef LV_TABVIEW_H
#define LV_TABVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
#if LV_USE_TABVIEW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_obj_t obj;
char ** map;
uint16_t tab_cnt;
uint16_t tab_cur;
lv_dir_t tab_pos;
} lv_tabview_t;
extern const lv_obj_class_t lv_tabview_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, lv_coord_t tab_size);
lv_obj_t * lv_tabview_add_tab(lv_obj_t * tv, const char * name);
void lv_tabview_rename_tab(lv_obj_t * obj, uint32_t tab_id, const char * new_name);
lv_obj_t * lv_tabview_get_content(lv_obj_t * tv);
lv_obj_t * lv_tabview_get_tab_btns(lv_obj_t * tv);
void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en);
uint16_t lv_tabview_get_tab_act(lv_obj_t * tv);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABVIEW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TABVIEW_H*/
@@ -0,0 +1,72 @@
/**
* @file lv_tileview.h
*
*/
#ifndef LV_TILEVIEW_H
#define LV_TILEVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/core/lv_obj.h"
#if LV_USE_TILEVIEW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_obj_t obj;
lv_obj_t * tile_act;
} lv_tileview_t;
typedef struct {
lv_obj_t obj;
lv_dir_t dir;
} lv_tileview_tile_t;
extern const lv_obj_class_t lv_tileview_class;
extern const lv_obj_class_t lv_tileview_tile_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Tileview object
* @param parent pointer to an object, it will be the parent of the new tileview
* @return pointer to the created tileview
*/
lv_obj_t * lv_tileview_create(lv_obj_t * parent);
lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, lv_dir_t dir);
void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en);
void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en);
lv_obj_t * lv_tileview_get_tile_act(lv_obj_t * obj);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_TILEVIEW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_TILEVIEW_H*/
@@ -0,0 +1,51 @@
/**
* @file lv_win.h
*
*/
#ifndef LV_WIN_H
#define LV_WIN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "liblvgl/lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_obj_t obj;
} lv_win_t;
extern const lv_obj_class_t lv_win_class;
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_obj_t * lv_win_create(lv_obj_t * parent, lv_coord_t header_height);
lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt);
lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * icon, lv_coord_t btn_w);
lv_obj_t * lv_win_get_header(lv_obj_t * win);
lv_obj_t * lv_win_get_content(lv_obj_t * win);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WIN_H*/