1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix add missing LV_ASSERT_OBJ checks (#2575)

* feat(led): Add missing LV_ASSERT_OBJ checks

* feat(calendar): Add missing LV_ASSERT_OBJ checks

* feat(chart): Add missing LV_ASSERT_OBJ checks

* feat(colorwheel): Add missing LV_ASSERT_OBJ checks

* feat(animimg): Add missing LV_ASSERT_OBJ checks

* feat(keyboard): Add missing LV_ASSERT_OBJ checks

* feat(meter): Add missing LV_ASSERT_OBJ checks

* feat(msgbox): Add missing LV_ASSERT_OBJ checks

* feat(span): Add missing LV_ASSERT_OBJ checks

* feat(spinbox): Add missing LV_ASSERT_OBJ checks

* feat(tabview): Add missing LV_ASSERT_OBJ checks
This commit is contained in:
Carlos Diaz 2021-09-23 12:53:16 -05:00 committed by GitHub
parent 13b89a8434
commit 40364453b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 107 additions and 1 deletions

View File

@ -27,6 +27,8 @@
*********************/
#define LV_OBJX_NAME "lv_animimg"
#define MY_CLASS &lv_animimg_class
/**********************
* TYPEDEFS
**********************/
@ -64,6 +66,7 @@ lv_obj_t * lv_animimg_create(lv_obj_t * parent)
void lv_animimg_set_src(lv_obj_t * obj, lv_img_dsc_t * dsc[], uint8_t num)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_animimg_t * animimg = (lv_animimg_t *)obj;
animimg->dsc = dsc;
animimg->pic_count = num;
@ -72,6 +75,7 @@ void lv_animimg_set_src(lv_obj_t * obj, lv_img_dsc_t * dsc[], uint8_t num)
void lv_animimg_start(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_animimg_t * animimg = (lv_animimg_t *)obj;
lv_anim_start(&animimg->anim);
}
@ -82,6 +86,7 @@ void lv_animimg_start(lv_obj_t * obj)
void lv_animimg_set_duration(lv_obj_t * obj, uint32_t duration)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_animimg_t * animimg = (lv_animimg_t *)obj;
lv_anim_set_time(&animimg->anim, duration);
lv_anim_set_playback_delay(&animimg->anim, duration);
@ -89,6 +94,7 @@ void lv_animimg_set_duration(lv_obj_t * obj, uint32_t duration)
void lv_animimg_set_repeat_count(lv_obj_t * obj, uint16_t count)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_animimg_t * animimg = (lv_animimg_t *)obj;
lv_anim_set_repeat_count(&animimg->anim, count);
}

View File

@ -10,12 +10,16 @@
#include "../../../lvgl.h"
#if LV_USE_CALENDAR
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
#define LV_CALENDAR_CTRL_TODAY LV_BTNMATRIX_CTRL_CUSTOM_1
#define LV_CALENDAR_CTRL_HIGHLIGHT LV_BTNMATRIX_CTRL_CUSTOM_2
#define MY_CLASS &lv_calendar_class
/**********************
* TYPEDEFS
**********************/
@ -68,7 +72,9 @@ lv_obj_t * lv_calendar_create(lv_obj_t * parent)
void lv_calendar_set_day_names(lv_obj_t * obj, const char * day_names[])
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
uint32_t i;
for(i = 0; i < 7; i++) {
calendar->map[i] = day_names[i];
@ -77,7 +83,9 @@ void lv_calendar_set_day_names(lv_obj_t * obj, const char * day_names[])
void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
calendar->today.year = year;
calendar->today.month = month;
calendar->today.day = day;
@ -89,7 +97,9 @@ void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highli
{
LV_ASSERT_NULL(highlighted);
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
calendar->highlighted_dates = highlighted;
calendar->highlighted_dates_num = date_num;
@ -98,7 +108,9 @@ void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highli
void lv_calendar_set_showed_date(lv_obj_t * obj, uint32_t year, uint32_t month)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
calendar->showed_date.year = year;
calendar->showed_date.month = month;
calendar->showed_date.day = 1;
@ -155,7 +167,9 @@ void lv_calendar_set_showed_date(lv_obj_t * obj, uint32_t year, uint32_t month)
*/
const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
const lv_calendar_t * calendar = (lv_calendar_t *)obj;
return &calendar->today;
}
@ -166,7 +180,9 @@ const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * obj)
*/
const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
const lv_calendar_t * calendar = (lv_calendar_t *)obj;
return &calendar->showed_date;
}
@ -177,19 +193,25 @@ const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * obj)
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
return calendar->highlighted_dates;
}
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
return calendar->highlighted_dates_num;
}
lv_res_t lv_calendar_get_pressed_date(const lv_obj_t * obj, lv_calendar_date_t * date)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_calendar_t * calendar = (lv_calendar_t *)obj;
uint16_t d = lv_btnmatrix_get_selected_btn(obj);
if(d == LV_BTNMATRIX_BTN_NONE) {
date->year = 0;

View File

@ -9,6 +9,8 @@
#include "lv_chart.h"
#if LV_USE_CHART != 0
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
@ -268,6 +270,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint1
{
LV_ASSERT_NULL(obj);
LV_ASSERT_NULL(ser);
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_chart_t * chart = (lv_chart_t *)obj;
if(id >= chart->point_cnt) {

View File

@ -10,6 +10,8 @@
#include "lv_colorwheel.h"
#if LV_USE_COLORWHEEL
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
@ -98,6 +100,7 @@ bool lv_colorwheel_set_hsv(lv_obj_t * obj, lv_color_hsv_t hsv)
if(hsv.s > 100) hsv.s = 100;
if(hsv.v > 100) hsv.v = 100;
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
if(colorwheel->hsv.h == hsv.h && colorwheel->hsv.s == hsv.s && colorwheel->hsv.v == hsv.v) return false;
@ -132,6 +135,7 @@ bool lv_colorwheel_set_rgb(lv_obj_t * obj, lv_color_t color)
*/
void lv_colorwheel_set_mode(lv_obj_t * obj, lv_colorwheel_mode_t mode)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
colorwheel->mode = mode;
@ -146,6 +150,7 @@ void lv_colorwheel_set_mode(lv_obj_t * obj, lv_colorwheel_mode_t mode)
*/
void lv_colorwheel_set_mode_fixed(lv_obj_t * obj, bool fixed)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
colorwheel->mode_fixed = fixed;
@ -163,6 +168,7 @@ void lv_colorwheel_set_mode_fixed(lv_obj_t * obj, bool fixed)
*/
lv_color_hsv_t lv_colorwheel_get_hsv(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
return colorwheel->hsv;
@ -175,6 +181,7 @@ lv_color_hsv_t lv_colorwheel_get_hsv(lv_obj_t * obj)
*/
lv_color_t lv_colorwheel_get_rgb(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
return lv_color_hsv_to_rgb(colorwheel->hsv.h, colorwheel->hsv.s, colorwheel->hsv.v);
@ -187,6 +194,7 @@ lv_color_t lv_colorwheel_get_rgb(lv_obj_t * obj)
*/
lv_colorwheel_mode_t lv_colorwheel_get_color_mode(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
return colorwheel->mode;
@ -199,6 +207,7 @@ lv_colorwheel_mode_t lv_colorwheel_get_color_mode(lv_obj_t * obj)
*/
bool lv_colorwheel_get_color_mode_fixed(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_colorwheel_t * colorwheel = (lv_colorwheel_t *)obj;
return colorwheel->mode_fixed;

View File

@ -11,10 +11,12 @@
#if LV_USE_KEYBOARD
#include "../../../widgets/lv_textarea.h"
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
#define MY_CLASS &lv_keyboard_class
/**********************
* TYPEDEFS
@ -142,6 +144,7 @@ void lv_keyboard_set_textarea(lv_obj_t * obj, lv_obj_t * ta)
LV_ASSERT_OBJ(ta, &lv_textarea_class);
}
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_keyboard_t * keyboard = (lv_keyboard_t *)obj;
/*Hide the cursor of the old Text area if cursor management is enabled*/
@ -164,6 +167,7 @@ void lv_keyboard_set_textarea(lv_obj_t * obj, lv_obj_t * ta)
*/
void lv_keyboard_set_mode(lv_obj_t * obj, lv_keyboard_mode_t mode)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_keyboard_t * keyboard = (lv_keyboard_t *)obj;
if(keyboard->mode == mode) return;
@ -198,6 +202,7 @@ void lv_keyboard_set_map(lv_obj_t * obj, lv_keyboard_mode_t mode, const char * m
*/
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_keyboard_t * keyboard = (lv_keyboard_t *)obj;
return keyboard->ta;
}
@ -209,6 +214,7 @@ lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * obj)
*/
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_keyboard_t * keyboard = (lv_keyboard_t *)obj;
return keyboard->mode;
}
@ -228,6 +234,7 @@ void lv_keyboard_def_event_cb(lv_event_t * e)
{
lv_obj_t * obj = lv_event_get_target(e);
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_keyboard_t * keyboard = (lv_keyboard_t *)obj;
uint16_t btn_id = lv_btnmatrix_get_selected_btn(obj);
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;

View File

@ -9,6 +9,8 @@
#include "lv_led.h"
#if LV_USE_LED
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
@ -68,6 +70,8 @@ lv_obj_t * lv_led_create(lv_obj_t * parent)
*/
void lv_led_set_color(lv_obj_t * obj, lv_color_t color)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_led_t * led = (lv_led_t *)obj;
led->color = color;
lv_obj_invalidate(obj);
@ -80,6 +84,8 @@ void lv_led_set_color(lv_obj_t * obj, lv_color_t color)
*/
void lv_led_set_brightness(lv_obj_t * obj, uint8_t bright)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_led_t * led = (lv_led_t *)obj;
if(led->bright == bright) return;
@ -131,6 +137,8 @@ void lv_led_toggle(lv_obj_t * obj)
*/
uint8_t lv_led_get_brightness(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_led_t * led = (lv_led_t *)obj;
return led->bright;
}

View File

@ -9,6 +9,8 @@
#include "lv_meter.h"
#if LV_USE_METER != 0
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
@ -63,6 +65,7 @@ lv_obj_t * lv_meter_create(lv_obj_t * parent)
lv_meter_scale_t * lv_meter_add_scale(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_meter_t * meter = (lv_meter_t *)obj;
lv_meter_scale_t * scale = _lv_ll_ins_head(&meter->scale_ll);
@ -119,6 +122,7 @@ void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t
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)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_meter_t * meter = (lv_meter_t *)obj;
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
LV_ASSERT_MALLOC(indic);
@ -138,6 +142,7 @@ lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t
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)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_meter_t * meter = (lv_meter_t *)obj;
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
LV_ASSERT_MALLOC(indic);
@ -157,6 +162,7 @@ lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t
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)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_meter_t * meter = (lv_meter_t *)obj;
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
LV_ASSERT_MALLOC(indic);
@ -176,6 +182,7 @@ lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale
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)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_meter_t * meter = (lv_meter_t *)obj;
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
LV_ASSERT_MALLOC(indic);
@ -272,6 +279,7 @@ static void lv_meter_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
static void lv_meter_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
{
LV_UNUSED(class_p);
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_meter_t * meter = (lv_meter_t *)obj;
_lv_ll_clear(&meter->indicator_ll);
_lv_ll_clear(&meter->scale_ll);

View File

@ -9,11 +9,13 @@
#include "lv_msgbox.h"
#if LV_USE_MSGBOX
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
#define LV_MSGBOX_FLAG_AUTO_PARENT LV_OBJ_FLAG_WIDGET_1 /*Mark that the parent was automatically created*/
#define MY_CLASS &lv_msgbox_class
/**********************
* TYPEDEFS
@ -135,30 +137,35 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char *
lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_msgbox_t * mbox = (lv_msgbox_t *)obj;
return mbox->title;
}
lv_obj_t * lv_msgbox_get_close_btn(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_msgbox_t * mbox = (lv_msgbox_t *)obj;
return mbox->close_btn;
}
lv_obj_t * lv_msgbox_get_text(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_msgbox_t * mbox = (lv_msgbox_t *)obj;
return mbox->text;
}
lv_obj_t * lv_msgbox_get_content(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_msgbox_t * mbox = (lv_msgbox_t *)obj;
return mbox->content;
}
lv_obj_t * lv_msgbox_get_btns(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_msgbox_t * mbox = (lv_msgbox_t *)obj;
return mbox->btns;
}

View File

@ -10,6 +10,8 @@
#if LV_USE_SPAN != 0
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
@ -107,6 +109,7 @@ lv_span_t * lv_spangroup_new_span(lv_obj_t * obj)
return NULL;
}
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
lv_span_t * span = _lv_ll_ins_tail(&spans->child_ll);
LV_ASSERT_MALLOC(span);
@ -132,6 +135,7 @@ void lv_spangroup_del_span(lv_obj_t * obj, lv_span_t * span)
return;
}
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
lv_span_t * cur_span;
_LV_LL_READ(&spans->child_ll, cur_span) {
@ -214,6 +218,7 @@ void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align)
*/
void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
if(spans->overflow == overflow) return;
@ -228,6 +233,7 @@ void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow)
*/
void lv_spangroup_set_indent(lv_obj_t * obj, lv_coord_t indent)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
if(spans->indent == indent) return;
@ -243,6 +249,7 @@ void lv_spangroup_set_indent(lv_obj_t * obj, lv_coord_t indent)
*/
void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
spans->mode = mode;
lv_spangroup_refr_mode(obj);
@ -270,6 +277,7 @@ lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id)
return NULL;
}
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
lv_ll_t * linked_list = &spans->child_ll;
@ -313,6 +321,7 @@ uint32_t lv_spangroup_get_child_cnt(const lv_obj_t * obj)
return 0;
}
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
return _lv_ll_get_len(&(spans->child_ll));
}
@ -334,6 +343,7 @@ lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj)
*/
lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
return spans->overflow;
}
@ -345,6 +355,7 @@ lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj)
*/
lv_coord_t lv_spangroup_get_indent(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
return spans->indent;
}
@ -356,6 +367,7 @@ lv_coord_t lv_spangroup_get_indent(lv_obj_t * obj)
*/
lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
return spans->mode;
}
@ -366,6 +378,7 @@ lv_span_mode_t lv_spangroup_get_mode(lv_obj_t * obj)
*/
void lv_spangroup_refr_mode(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
if(spans->mode == LV_SPAN_MODE_EXPAND) {
@ -403,6 +416,7 @@ void lv_spangroup_refr_mode(lv_obj_t * obj)
*/
lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
lv_coord_t max_line_h = 0;
@ -424,6 +438,7 @@ lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t * obj)
*/
lv_coord_t lv_spangroup_get_expand_width(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
if(_lv_ll_get_head(&spans->child_ll) == NULL) {
@ -456,6 +471,7 @@ lv_coord_t lv_spangroup_get_expand_width(lv_obj_t * obj)
*/
lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spangroup_t * spans = (lv_spangroup_t *)obj;
if(_lv_ll_get_head(&spans->child_ll) == NULL || width <= 0) {
return 0;

View File

@ -9,6 +9,8 @@
#include "lv_spinbox.h"
#if LV_USE_SPINBOX
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
@ -63,6 +65,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * parent)
*/
void lv_spinbox_set_value(lv_obj_t * obj, int32_t i)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
if(i > spinbox->range_max) i = spinbox->range_max;
@ -80,6 +83,7 @@ void lv_spinbox_set_value(lv_obj_t * obj, int32_t i)
*/
void lv_spinbox_set_rollover(lv_obj_t * obj, bool b)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
spinbox->rollover = b;
@ -94,6 +98,7 @@ void lv_spinbox_set_rollover(lv_obj_t * obj, bool b)
*/
void lv_spinbox_set_digit_format(lv_obj_t * obj, uint8_t digit_count, uint8_t separator_position)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
if(digit_count > LV_SPINBOX_MAX_DIGIT_COUNT) digit_count = LV_SPINBOX_MAX_DIGIT_COUNT;
@ -120,6 +125,7 @@ void lv_spinbox_set_digit_format(lv_obj_t * obj, uint8_t digit_count, uint8_t se
*/
void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
spinbox->step = step;
@ -134,6 +140,7 @@ void lv_spinbox_set_step(lv_obj_t * obj, uint32_t step)
*/
void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
spinbox->range_max = range_max;
@ -152,7 +159,7 @@ void lv_spinbox_set_range(lv_obj_t * obj, int32_t range_min, int32_t range_max)
*/
void lv_spinbox_set_pos(lv_obj_t * obj, uint8_t pos)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
int32_t step_limit;
step_limit = LV_MAX(spinbox->range_max, (spinbox->range_min < 0 ? (-spinbox->range_min) : spinbox->range_min));
@ -173,6 +180,7 @@ void lv_spinbox_set_pos(lv_obj_t * obj, uint8_t pos)
*/
int32_t lv_spinbox_get_value(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
return spinbox->value;
@ -184,6 +192,7 @@ int32_t lv_spinbox_get_value(lv_obj_t * obj)
*/
int32_t lv_spinbox_get_step(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
return spinbox->step;
@ -199,6 +208,7 @@ int32_t lv_spinbox_get_step(lv_obj_t * obj)
*/
void lv_spinbox_step_next(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
int32_t new_step = spinbox->step / 10;
@ -216,6 +226,7 @@ void lv_spinbox_step_next(lv_obj_t * obj)
*/
void lv_spinbox_step_prev(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
int32_t step_limit;
step_limit = LV_MAX(spinbox->range_max, (spinbox->range_min < 0 ? (-spinbox->range_min) : spinbox->range_min));
@ -231,6 +242,7 @@ void lv_spinbox_step_prev(lv_obj_t * obj)
*/
bool lv_spinbox_get_rollover(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
return spinbox->rollover;
@ -242,6 +254,7 @@ bool lv_spinbox_get_rollover(lv_obj_t * obj)
*/
void lv_spinbox_increment(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
if(spinbox->value + spinbox->step <= spinbox->range_max) {
@ -267,6 +280,7 @@ void lv_spinbox_increment(lv_obj_t * obj)
*/
void lv_spinbox_decrement(lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
if(spinbox->value - spinbox->step >= spinbox->range_min) {

View File

@ -9,9 +9,12 @@
#include "lv_tabview.h"
#if LV_USE_TABVIEW
#include "../../../misc/lv_assert.h"
/*********************
* DEFINES
*********************/
#define MY_CLASS &lv_tabview_class
/**********************
* TYPEDEFS
@ -63,6 +66,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, lv_coord_t tab
lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_tabview_t * tabview = (lv_tabview_t *)obj;
lv_obj_t * cont = lv_tabview_get_content(obj);
@ -119,6 +123,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name)
void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_tabview_t * tabview = (lv_tabview_t *)obj;
if(id >= tabview->tab_cnt) {
@ -147,6 +152,7 @@ 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 * obj)
{
LV_ASSERT_OBJ(obj, MY_CLASS);
lv_tabview_t * tabview = (lv_tabview_t *)obj;
return tabview->tab_cur;
}