From ec0caa569b356f186e87c13e50550ca1b807dde6 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 4 Sep 2022 18:16:20 +0200 Subject: eve support when i2s is running --- fw/fe310/eos/eve/widget/togglew.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'fw/fe310/eos/eve/widget/togglew.c') diff --git a/fw/fe310/eos/eve/widget/togglew.c b/fw/fe310/eos/eve/widget/togglew.c index fbebacb..c68e191 100644 --- a/fw/fe310/eos/eve/widget/togglew.c +++ b/fw/fe310/eos/eve/widget/togglew.c @@ -13,11 +13,10 @@ void eve_togglew_init(EVEToggleWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, char *labels) { EVEWidget *_widget = &widget->w; - memset(widget, 0, sizeof(EVEPageWidget)); + memset(widget, 0, sizeof(EVEToggleWidget)); eve_widget_init(_widget, EVE_WIDGET_TYPE_TOGGLE, g, page, eve_togglew_draw, eve_togglew_touch, NULL); widget->font = font; widget->labels = labels; - if (_widget->g.w == 0) _widget->g.w = 3 * eve_font_h(widget->font); if (_widget->g.h == 0) _widget->g.h = eve_font_h(widget->font); } @@ -41,8 +40,7 @@ uint8_t eve_togglew_draw(EVEWidget *_widget, uint8_t tag0) { } _widget->tagN = tag0; - eve_cmd(CMD_TOGGLE, "hhhhhhs", _widget->g.x, _widget->g.y, _widget->g.w, widget->font->id, 0, widget->state ? 65535 : 0, widget->labels); - + eve_cmd(CMD_TOGGLE, "hhhhhhs", _widget->g.x - EVE_TOGGLEW_MARGIN, _widget->g.y, _widget->g.w, widget->font->id, 0, widget->state ? 65535 : 0, widget->labels); return _widget->tagN; } @@ -56,3 +54,15 @@ int eve_togglew_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { return 0; } + +void eve_togglew_set(EVEToggleWidget *widget) { + widget->state = 1; +} + +void eve_togglew_clr(EVEToggleWidget *widget) { + widget->state = 0; +} + +uint8_t eve_togglew_get(EVEToggleWidget *widget) { + return widget->state; +} \ No newline at end of file -- cgit v1.2.3