diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-09-04 18:16:20 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-09-04 18:16:20 +0200 |
commit | ec0caa569b356f186e87c13e50550ca1b807dde6 (patch) | |
tree | ab07671a8aed9c573fe20d2d100be0ab1c5e68a7 | |
parent | 7f8e473ac12191ca4449de96033e2acda07dc4c4 (diff) |
eve support when i2s is running
-rw-r--r-- | fw/fe310/eos/eve/eve.c | 40 | ||||
-rw-r--r-- | fw/fe310/eos/eve/eve.h | 10 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/form.c | 134 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/form.h | 25 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/page.c | 135 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/page.h | 15 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/view.c | 55 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/view.h | 12 | ||||
-rw-r--r-- | fw/fe310/eos/eve/screen/window.c | 1 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/freew.c | 17 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/freew.h | 3 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/pagew.c | 1 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/selectw.c | 4 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/strw.c | 7 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/textw.c | 11 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/togglew.c | 18 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/togglew.h | 7 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/widget.c | 4 | ||||
-rw-r--r-- | fw/fe310/eos/eve/widget/widget.h | 9 | ||||
-rw-r--r-- | fw/fe310/eos/soc/timer.h | 7 |
20 files changed, 306 insertions, 209 deletions
diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c index 7f77190..45ac886 100644 --- a/fw/fe310/eos/eve/eve.c +++ b/fw/fe310/eos/eve/eve.c @@ -223,6 +223,9 @@ void eve_cmd(uint32_t cmd, const char *fmt, ...) { case 'p': cmd_buffer(va_arg(argv, const char *), va_arg(argv, int), flags); break; + case '0': + cmd_padding(flags); + break; case '+': cont = 1; break; @@ -294,11 +297,12 @@ void eve_cmd_burst_end(void) { cmd_burst = 0; } -void eve_handle_intr(void) { +uint16_t eve_handle_intr(void) { uint16_t intr_flags; intr_flags = eve_read16(REG_INT_FLAGS); if (intr_flags & (EVE_INT_CONVCOMPLETE | EVE_INT_TAG)) eve_handle_touch(intr_flags); + return intr_flags; } int eve_init(void) { @@ -377,19 +381,7 @@ int eve_init(void) { return EVE_OK; } -void eve_start(void) { - /* enable interrupts */ - eve_write8(REG_INT_EN, 0x01); - while(eve_read8(REG_INT_FLAGS)); -} - -void eve_stop(void) { - /* disable interrupts */ - eve_write8(REG_INT_EN, 0x00); - while(eve_read8(REG_INT_FLAGS)); -} - -void eve_start_clk(void) { +void eve_clk_start(void) { uint16_t gpiox; eve_write8(REG_PCLK, EVE_PCLK); /* start clocking data to the LCD panel */ @@ -397,7 +389,7 @@ void eve_start_clk(void) { eve_write16(REG_GPIOX, gpiox); /* enable the DISP signal to the LCD panel, it is set to output in REG_GPIOX_DIR */ } -void eve_stop_clk(void) { +void eve_clk_stop(void) { uint16_t gpiox; gpiox = eve_read16(REG_GPIOX) & ~0x8000; @@ -405,6 +397,16 @@ void eve_stop_clk(void) { eve_write8(REG_PCLK, 0); } +void eve_intr_enable(void) { + eve_write8(REG_INT_EN, 0x01); + while(eve_read8(REG_INT_FLAGS)); +} + +void eve_intr_disable(void) { + eve_write8(REG_INT_EN, 0x00); + while(eve_read8(REG_INT_FLAGS)); +} + void eve_activate(void) { eve_command(EVE_ACTIVE, 0); eve_sleep(40); @@ -421,8 +423,8 @@ void eve_pwr_standby(void) { void eve_pwr_sleep(void) { if (power_state != EVE_PSTATE_ACTIVE) return; - eve_stop_clk(); - eve_stop(); + eve_clk_stop(); + eve_intr_disable(); eve_command(EVE_SLEEP, 0); @@ -433,8 +435,8 @@ void eve_pwr_wake(void) { eve_activate(); if (power_state == EVE_PSTATE_SLEEP) { - eve_start(); - eve_start_clk(); + eve_intr_enable(); + eve_clk_start(); } power_state = EVE_PSTATE_ACTIVE; diff --git a/fw/fe310/eos/eve/eve.h b/fw/fe310/eos/eve/eve.h index 145c4ba..ea4ec71 100644 --- a/fw/fe310/eos/eve/eve.h +++ b/fw/fe310/eos/eve/eve.h @@ -56,13 +56,13 @@ int eve_cmd_exec(int w); void eve_cmd_burst_start(void); void eve_cmd_burst_end(void); -void eve_handle_intr(void); +uint16_t eve_handle_intr(void); int eve_init(void); -void eve_start(void); -void eve_stop(void); -void eve_start_clk(void); -void eve_stop_clk(void); +void eve_clk_start(void); +void eve_clk_stop(void); +void eve_intr_enable(void); +void eve_intr_disable(void); void eve_activate(void); void eve_pwr_standby(void); diff --git a/fw/fe310/eos/eve/screen/form.c b/fw/fe310/eos/eve/screen/form.c index 13021a0..3e5b97c 100644 --- a/fw/fe310/eos/eve/screen/form.c +++ b/fw/fe310/eos/eve/screen/form.c @@ -12,39 +12,6 @@ #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) -static void form_update_g(EVEForm *form, EVEWidget *_widget) { - EVEPage *page = &form->p; - EVEWidget *widget = page->widget; - int i; - uint16_t w = 0; - uint16_t h = 0; - uint16_t l_h = 0; - - for (i=0; i<page->widget_size; i++) { - if (widget->label) { - h += l_h; - w = widget->label->g.w; - l_h = widget->label->g.h; - widget->label->g.x = 0; - widget->label->g.y = h; - } - if (w + widget->g.w > form->p.v.window->g.w) { - h += l_h; - w = 0; - l_h = 0; - } - widget->g.x = w; - widget->g.y = h; - - w += widget->g.w; - l_h = MAX(l_h, widget->g.h); - - widget = eve_widget_next(widget); - } - page->g.w = page->v.window->g.w; - page->g.h = h + l_h; -} - static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) { int i; @@ -55,38 +22,38 @@ static void widgets_destroy(EVEWidget *widget, uint16_t widget_size) { } } -EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec spec[], uint16_t spec_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor) { +EVEPage *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec spec[], uint16_t spec_size, eve_page_uievt_t uievt, eve_page_destructor_t destructor) { EVEWidget *widgets; EVEWidget *widget; EVELabel *label; - EVEForm *form; + EVEPage *page; int w_size = 0; int i, r; if (uievt == NULL) uievt = eve_form_uievt; if (destructor == NULL) destructor = eve_form_destroy; - form = eve_malloc(sizeof(EVEForm)); - if (form == NULL) { + page = eve_malloc(sizeof(EVEPage)); + if (page == NULL) { return NULL; } - eve_form_init(form, window, stack, NULL, 0, uievt, action, destructor); + eve_form_init(page, window, stack, NULL, 0, uievt, destructor); for (i=0; i<spec_size; i++) { w_size += eve_widget_size(spec[i].widget.type); } widgets = eve_malloc(w_size); if (widgets == NULL) { - eve_free(form); + eve_free(page); return NULL; } widget = widgets; for (i=0; i<spec_size; i++) { - r = eve_widget_create(widget, &spec[i].widget, (EVEPage *)form); + r = eve_widget_create(widget, &spec[i].widget, page); if (r) { widgets_destroy(widgets, i); eve_free(widgets); - eve_free(form); + eve_free(page); return NULL; } if (spec[i].label.title) { @@ -95,42 +62,46 @@ EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec spe eve_widget_destroy(widget); widgets_destroy(widgets, i); eve_free(widgets); - eve_free(form); + eve_free(page); return NULL; } - eve_label_create(label, &spec[i].label, (EVEPage *)form); + eve_label_create(label, &spec[i].label, page); eve_widget_set_label(widget, label); } if (widget->g.w == 0) widget->g.w = window->g.w - (widget->label ? widget->label->g.w : 0); widget = eve_widget_next(widget); } - eve_form_set_widget(form, widgets, spec_size); + eve_form_set_widget(page, widgets, spec_size); - return form; + return page; } -void eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor) { - memset(form, 0, sizeof(EVEForm)); - eve_page_init(&form->p, window, stack, NULL, 0, EVE_PAGE_OPT_SCROLL_Y | EVE_PAGE_OPT_SCROLL_BACK | EVE_PAGE_OPT_TRACK_EXT_Y, eve_page_draw, eve_page_touch, (eve_view_uievt_t)uievt, (eve_page_destructor_t)destructor); - form->action = action; - eve_form_set_widget(form, widget, widget_size); +void eve_form_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, eve_page_uievt_t uievt, eve_page_destructor_t destructor) { + eve_page_init(page, window, stack, NULL, 0, EVE_PAGE_OPT_SCROLL_Y | EVE_PAGE_OPT_SCROLL_BACK | EVE_PAGE_OPT_TRACK_EXT_Y, eve_page_draw, eve_page_touch, uievt, destructor); + if (widget) eve_form_set_widget(page, widget, widget_size); } -void eve_form_set_widget(EVEForm *form, EVEWidget *widget, uint16_t widget_size) { - eve_page_set_widget((EVEPage *)form, widget, widget_size); - form_update_g(form, NULL); +void eve_form_set_widget(EVEPage *page, EVEWidget *widget, uint16_t widget_size) { + eve_page_set_widget(page, widget, widget_size); + eve_form_update_g(page, NULL); } -void eve_form_destroy(EVEForm *form) { - widgets_destroy(form->p.widget, form->p.widget_size); - eve_free(form->p.widget); - eve_free(form); +void eve_form_destroy(EVEPage *page) { + widgets_destroy(page->widget, page->widget_size); + eve_free(page->widget); + eve_free(page); } -int eve_form_uievt(EVEForm *form, uint16_t evt, void *param) { +int eve_form_uievt(EVEPage *page, uint16_t evt, void *param) { switch (evt) { case EVE_UIEVT_WIDGET_UPDATE_G: - form_update_g(form, (EVEWidget *)param); + eve_form_update_g(page, (EVEWidget *)param); + break; + + case EVE_UIEVT_WIDGET_FOCUS_IN: + break; + + case EVE_UIEVT_WIDGET_FOCUS_OUT: break; case EVE_UIEVT_GEST_SCROLL_START: @@ -146,14 +117,51 @@ int eve_form_uievt(EVEForm *form, uint16_t evt, void *param) { EVEUIEvtTouch *touch_p = (EVEUIEvtTouch *)param; if (touch_p->touch->eevt & EVE_TOUCH_EETYPE_TRACK_RIGHT) { - eve_page_close((EVEPage *)form); + eve_page_close(page); return 1; } - if (touch_p->touch->eevt & EVE_TOUCH_EETYPE_TRACK_LEFT) { - if (form->action) form->action(form); - } break; } } return 0; } + +void eve_form_update_g(EVEPage *page, EVEWidget *_widget) { + EVEWidget *widget = page->widget; + EVEWidget *lastw = NULL; + int i; + uint16_t w = 0; + uint16_t h = 0; + uint16_t l_h = 0; + + for (i=0; i<page->widget_size; i++) { + if (widget->flags & EVE_WIDGET_FLAG_HIDDEN) goto update_g_nextw; + if (widget->label) { + h += l_h; + w = widget->label->g.w; + l_h = widget->label->g.h; + widget->label->g.x = 0; + widget->label->g.y = h; + } + if (w + widget->g.w > page->v.window->g.w) { + h += l_h; + w = 0; + l_h = 0; + } + widget->g.x = w; + widget->g.y = h; + + w += widget->g.w; + l_h = MAX(l_h, widget->g.h); + + lastw = widget; +update_g_nextw: + widget = eve_widget_next(widget); + } + page->g.w = page->v.window->g.w; + page->g.h = h + l_h; + + if (lastw && eve_page_oob(page, NULL, NULL)) { + eve_page_show_rect(page, &lastw->g); + } +} diff --git a/fw/fe310/eos/eve/screen/form.h b/fw/fe310/eos/eve/screen/form.h index 62e10f7..bc81d2d 100644 --- a/fw/fe310/eos/eve/screen/form.h +++ b/fw/fe310/eos/eve/screen/form.h @@ -2,28 +2,15 @@ #include "../widget/widget.h" -struct EVEWidget; -struct EVEForm; -struct EVEFormSpec; - -typedef int (*eve_form_uievt_t) (struct EVEForm *, uint16_t, void *); -typedef void (*eve_form_action_t) (struct EVEForm *); -typedef void (*eve_form_destructor_t) (struct EVEForm *); - -typedef struct EVEForm { - EVEPage p; - eve_form_action_t action; -} EVEForm; - typedef struct EVEFormSpec { EVELabelSpec label; EVEWidgetSpec widget; } EVEFormSpec; -EVEForm *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec *spec, uint16_t spec_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor); -void eve_form_init(EVEForm *form, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, eve_form_uievt_t uievt, eve_form_action_t action, eve_form_destructor_t destructor); -void eve_form_set_widget(EVEForm *form, EVEWidget *widget, uint16_t widget_size); -void eve_form_destroy(EVEForm *form); - -int eve_form_uievt(EVEForm *form, uint16_t evt, void *param); +EVEPage *eve_form_create(EVEWindow *window, EVEViewStack *stack, EVEFormSpec spec[], uint16_t spec_size, eve_page_uievt_t uievt, eve_page_destructor_t destructor); +void eve_form_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, eve_page_uievt_t uievt, eve_page_destructor_t destructor); +void eve_form_set_widget(EVEPage *page, EVEWidget *widget, uint16_t widget_size); +void eve_form_destroy(EVEPage *page); +int eve_form_uievt(EVEPage *page, uint16_t evt, void *param); +void eve_form_update_g(EVEPage *page, EVEWidget *_widget); diff --git a/fw/fe310/eos/eve/screen/page.c b/fw/fe310/eos/eve/screen/page.c index 64fc473..9cbc638 100644 --- a/fw/fe310/eos/eve/screen/page.c +++ b/fw/fe310/eos/eve/screen/page.c @@ -14,25 +14,47 @@ #define PAGE_TMODE_TRACK 1 #define PAGE_TMODE_SCROLL 2 -void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, uint8_t opt, eve_view_draw_t draw, eve_view_touch_t touch, eve_view_uievt_t uievt, eve_page_destructor_t destructor) { +void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, EVEWidget *widget, uint16_t widget_size, uint8_t opt, eve_page_draw_t draw, eve_page_touch_t touch, eve_page_uievt_t uievt, eve_page_destructor_t destructor) { memset(page, 0, sizeof(EVEPage)); - eve_view_init(&page->v, window, draw, touch, uievt, NULL); + eve_view_init(&page->v, window, (eve_view_draw_t)draw, (eve_view_touch_t)touch, (eve_view_uievt_t)uievt, NULL); page->stack = stack; page->opt = opt; page->destructor = destructor; eve_page_set_widget(page, widget, widget_size); } -EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx) { +EVEWidget *eve_page_widget(EVEPage *page, uint16_t _idx) { EVEWidget *w = page->widget; - int i; + int i, idx; + + if (_idx >= page->widget_size) return NULL; + + idx = 0; + for (i=0; i<page->widget_size; i++) { + if (!(w->flags & EVE_WIDGET_FLAG_SKIP)) { + if (idx == _idx) { + return w; + } + idx++; + } + w = eve_widget_next(w); + } + return NULL; +} - if (idx >= page->widget_size) return NULL; +EVEWidget *eve_page_widget_search(EVEPage *page, char *label) { + EVEWidget *w = page->widget; + int i; - for (i=0; i<idx; i++) { + for (i=0; i<page->widget_size; i++) { + if (!(w->flags & EVE_WIDGET_FLAG_SKIP)) { + if (w->label && (strcmp(w->label->title, label) == 0)) { + return w; + } + } w = eve_widget_next(w); } - return w; + return NULL; } void eve_page_set_widget(EVEPage *page, EVEWidget *widget, uint16_t widget_size) { @@ -45,8 +67,9 @@ void eve_page_open(EVEPage *parent, eve_view_constructor_t constructor) { EVEViewStack *stack = parent->stack; eve_page_destructor_t destructor = parent->destructor; + eve_page_set_focus(parent, NULL); if (destructor) destructor(parent); - eve_view_create(window, stack, constructor); + eve_stack_create_view(stack, window, constructor); } void eve_page_close(EVEPage *page) { @@ -56,6 +79,7 @@ void eve_page_close(EVEPage *page) { if (stack->level <= 1) return; + eve_page_set_focus(page, NULL); if (eve_timer_running()) { eve_timer_stop(); } @@ -66,7 +90,7 @@ void eve_page_close(EVEPage *page) { eve_window_kbd_detach(window); if (destructor) destructor(page); - eve_view_destroy(window, stack); + eve_stack_back(stack, window); } /* Screen to page coordinates */ @@ -104,7 +128,7 @@ int eve_page_rect_visible(EVEPage *page, EVERect *g) { return 0; } -void eve_page_rect_set_visible(EVEPage *page, EVERect *rect) { +void eve_page_show_rect(EVEPage *page, EVERect *rect) { EVERect g; eve_window_visible_g(page->v.window, &g); @@ -125,11 +149,27 @@ void eve_page_rect_set_visible(EVEPage *page, EVERect *rect) { } } +/* returns true if x or y are out of page bounds for window */ +int eve_page_oob(EVEPage *page, int *_max_x, int *_max_y) { + int max_x, max_y; + EVERect vg; + + eve_window_visible_g(page->v.window, &vg); + max_x = page->g.w > vg.w ? page->g.w - vg.w : 0; + max_y = page->g.h > vg.h ? page->g.h - vg.h : 0; + + if (_max_x) *_max_x = max_x; + if (_max_y) *_max_y = max_y; + + return ((page->g.x < 0) || (page->g.x > max_x) || + (page->g.y < 0) || (page->g.y > max_y)); +} + EVEWidget *eve_page_focus(EVEPage *page) { return page->widget_f; } -void eve_page_set_focus(EVEPage *page, EVEWidget *widget, EVERect *rect) { +void eve_page_set_focus(EVEPage *page, EVEWidget *widget) { if (page->widget_f != widget) { EVEWindow *window = page->v.window; EVEWidget *widget_f = page->widget_f; @@ -148,11 +188,8 @@ void eve_page_set_focus(EVEPage *page, EVEWidget *widget, EVERect *rect) { page->widget_f = widget; if (page->widget_f) eve_view_uievt_push(&page->v, EVE_UIEVT_WIDGET_FOCUS_IN, page->widget_f); } - if (rect) eve_page_rect_set_visible(page, rect); } -#include <stdio.h> - static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0) { EVEView *view = &page->v; EVEWindow *window = view->window; @@ -174,7 +211,7 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0 if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT))) { int _ret = 0; - if (page->widget_f) eve_page_set_focus(page, NULL, NULL); + eve_page_set_focus(page, NULL); _ret = eve_view_uievt_push_gest(view, EVE_UIEVT_GEST_TOUCH, touch, evt, tag0); if (_ret) return _ret; ret = 1; @@ -200,20 +237,17 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0 if (((evt & EVE_TOUCH_ETYPE_TRACK_STOP) && !(evt & EVE_TOUCH_ETYPE_TRACK_ABORT)) || ((evt & EVE_TOUCH_ETYPE_POINT_UP) && (touch->eevt & EVE_TOUCH_EETYPE_ABORT) && !(touch->eevt & EVE_TOUCH_EETYPE_TRACK_XY))) { if ((page->track_mode == PAGE_TMODE_SCROLL) && (page->opt & EVE_PAGE_OPT_SCROLL_BACK)) { - int wmax_x, wmax_y; - int lho_x, lho_y; - EVERect vg; - - eve_window_visible_g(page->v.window, &vg); - wmax_x = page->g.w > vg.w ? page->g.w - vg.w : 0; - wmax_y = page->g.h > vg.h ? page->g.h - vg.h : 0; - lho_x = page->g.x < 0 ? 0 : wmax_x; - lho_y = page->g.y < 0 ? 0 : wmax_y; - if ((page->g.x < 0) || (page->g.x > wmax_x) || - (page->g.y < 0) || (page->g.y > wmax_y)) { - EVEPhyLHO *lho = &page->lho; + int max_x, max_y; + int oob; + + oob = eve_page_oob(page, &max_x, &max_y); + if (oob) { + int lho_x, lho_y; uint8_t _tag; + EVEPhyLHO *lho = &page->lho; + lho_x = page->g.x < 0 ? 0 : max_x; + lho_y = page->g.y < 0 ? 0 : max_y; eve_window_scroll(window->root, &_tag); page->lho_t0 = eve_get_tick(); @@ -272,11 +306,9 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0 more = eve_phy_lho_tick(lho, eve_get_tick() - page->lho_t0, scroll_x ? &x : NULL, scroll_y ? &y : NULL); if (scroll_x) page->g.x = x; if (scroll_y) page->g.y = y; - printf("TIMER: %d\n", y); if (!more) { int _ret = 0; - printf("TIMER STOP!\n"); page->track_mode = PAGE_TMODE_NONE; eve_timer_stop(); eve_window_scroll_stop(window); @@ -290,8 +322,8 @@ static int page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0 return ret; } -uint8_t eve_page_draw(EVEView *view, uint8_t tag0) { - EVEPage *page = (EVEPage *)view; +uint8_t eve_page_draw(EVEPage *page, uint8_t tag0) { + EVEView *view = &page->v; EVEWidget *widget = page->widget; int i; uint8_t tagN = tag0; @@ -308,6 +340,8 @@ uint8_t eve_page_draw(EVEView *view, uint8_t tag0) { eve_cmd_dl(VERTEX_TRANSLATE_X(eve_page_scr_x(page, 0) * 16)); eve_cmd_dl(VERTEX_TRANSLATE_Y(eve_page_scr_y(page, 0) * 16)); for (i=0; i<page->widget_size; i++) { + if (widget->flags & EVE_WIDGET_FLAG_HIDDEN) goto draw_nextw; + if (widget->label && eve_page_rect_visible(page, &widget->label->g)) { eve_cmd_dl(TAG_MASK(0)); eve_label_draw(widget->label); @@ -316,6 +350,8 @@ uint8_t eve_page_draw(EVEView *view, uint8_t tag0) { if (eve_page_rect_visible(page, &widget->g)) { tagN = widget->draw(widget, tagN); } + +draw_nextw: widget = eve_widget_next(widget); } eve_cmd_dl(RESTORE_CONTEXT()); @@ -327,9 +363,9 @@ uint8_t eve_page_draw(EVEView *view, uint8_t tag0) { return tagN; } -int eve_page_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) { - EVEPage *page = (EVEPage *)view; +int eve_page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0) { EVEWidget *widget = page->widget; + EVEViewStack *stack = page->stack; int8_t touch_idx = eve_touch_get_idx(touch); uint16_t _evt; int i, ret; @@ -339,20 +375,37 @@ int eve_page_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) { _evt = eve_touch_evt(touch, evt, tag0, page->v.tag, 1); if (_evt) { ret = page_touch(page, touch, _evt, tag0); + if (stack->dirty) { + stack->dirty = 0; + return 1; + } if (ret) return 1; } for (i=0; i<page->widget_size; i++) { - if (eve_page_rect_visible(page, &widget->g)) { - _evt = eve_touch_evt(touch, evt, tag0, widget->tag0, widget->tagN - widget->tag0); - if (_evt) { - if (page->track_mode == PAGE_TMODE_NONE) { - ret = widget->touch(widget, touch, _evt); - if (ret) return 1; + if (!eve_page_rect_visible(page, &widget->g) || (widget->flags & (EVE_WIDGET_FLAG_SKIP | EVE_WIDGET_FLAG_RO | EVE_WIDGET_FLAG_HIDDEN))) goto touch_nextw; + + _evt = eve_touch_evt(touch, evt, tag0, widget->tag0, widget->tagN - widget->tag0); + if (_evt) { + if (page->track_mode == PAGE_TMODE_NONE) { + ret = widget->touch(widget, touch, _evt); + if (stack->dirty) { + stack->dirty = 0; + return 1; + } + if (ret) { + eve_widget_set_focus(widget); + return 1; } - ret = page_touch(page, touch, _evt, tag0); - if (ret) return 1; } + ret = page_touch(page, touch, _evt, tag0); + if (stack->dirty) { + stack->dirty = 0; + return 1; + } + if (ret) return 1; } + +touch_nextw: widget = eve_widget_next(widget); } diff --git a/fw/fe310/eos/eve/screen/page.h b/fw/fe310/eos/eve/screen/page.h index 7aa8c1d..6874a2d 100644 --- a/fw/fe310/eos/eve/screen/page.h +++ b/fw/fe310/eos/eve/screen/page.h @@ -14,6 +14,9 @@ struct EVEWidget; struct EVEPage; +typedef uint8_t (*eve_page_draw_t) (struct EVEPage *, uint8_t); +typedef int (*eve_page_touch_t) (struct EVEPage *, EVETouch *, uint16_t, uint8_t); +typedef int (*eve_page_uievt_t) (struct EVEPage *, uint16_t, void *); typedef void (*eve_page_destructor_t) (struct EVEPage *); typedef struct EVEPage { @@ -32,9 +35,10 @@ typedef struct EVEPage { uint8_t opt; } EVEPage; -void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, struct EVEWidget *widget, uint16_t widget_size, uint8_t opt,eve_view_draw_t draw, eve_view_touch_t touch, eve_view_uievt_t uievt, eve_page_destructor_t destructor); +void eve_page_init(EVEPage *page, EVEWindow *window, EVEViewStack *stack, struct EVEWidget *widget, uint16_t widget_size, uint8_t opt, eve_page_draw_t draw, eve_page_touch_t touch, eve_page_uievt_t uievt, eve_page_destructor_t destructor); struct EVEWidget *eve_page_widget(EVEPage *page, uint16_t idx); +struct EVEWidget *eve_page_widget_search(EVEPage *page, char *label); void eve_page_set_widget(EVEPage *page, struct EVEWidget *widget, uint16_t widget_size); void eve_page_open(EVEPage *parent, eve_view_constructor_t constructor); @@ -50,10 +54,11 @@ int16_t eve_page_win_y(EVEPage *page, int16_t y); int16_t eve_page_scr_x(EVEPage *page, int16_t x); int16_t eve_page_scr_y(EVEPage *page, int16_t y); int eve_page_rect_visible(EVEPage *page, EVERect *g); -void eve_page_rect_set_visible(EVEPage *page, EVERect *rect); +void eve_page_show_rect(EVEPage *page, EVERect *rect); +int eve_page_oob(EVEPage *page, int *_max_x, int *_max_y); struct EVEWidget *eve_page_focus(EVEPage *page); -void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget, EVERect *rect); +void eve_page_set_focus(EVEPage *page, struct EVEWidget *widget); -uint8_t eve_page_draw(EVEView *view, uint8_t tag0); -int eve_page_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0); +uint8_t eve_page_draw(EVEPage *page, uint8_t tag0); +int eve_page_touch(EVEPage *page, EVETouch *touch, uint16_t evt, uint8_t tag0); diff --git a/fw/fe310/eos/eve/screen/view.c b/fw/fe310/eos/eve/screen/view.c index 466644d..d6e9ede 100644 --- a/fw/fe310/eos/eve/screen/view.c +++ b/fw/fe310/eos/eve/screen/view.c @@ -55,28 +55,6 @@ uint8_t eve_view_clear(EVEView *view, uint8_t tag0, uint8_t tag_opt) { return tag0; } -void eve_view_stack_init(EVEViewStack *stack) { - memset(stack, 0, sizeof(EVEViewStack)); -} - -void eve_view_create(EVEWindow *window, EVEViewStack *stack, eve_view_constructor_t constructor) { - if (stack->level < EVE_VIEW_SIZE_STACK - 1) { - stack->constructor[stack->level] = constructor; - stack->level++; - constructor(window, stack); - } -} - -void eve_view_destroy(EVEWindow *window, EVEViewStack *stack) { - if (stack->level > 1) { - eve_view_constructor_t constructor; - - stack->level--; - constructor = stack->constructor[stack->level - 1]; - constructor(window, stack); - } -} - int eve_view_uievt_push(EVEView *view, uint16_t evt, void *param) { if (view->uievt) return view->uievt(view, evt, param); return 0; @@ -93,3 +71,36 @@ int eve_view_uievt_push_gest(EVEView *view, uint16_t evt, EVETouch *touch, uint1 } return 0; } + +void eve_stack_init(EVEViewStack *stack) { + memset(stack, 0, sizeof(EVEViewStack)); +} + +void eve_stack_create_view(EVEViewStack *stack, EVEWindow *window, eve_view_constructor_t constructor) { + int rv; + + stack->dirty = 1; + if (stack->level < EVE_VIEW_SIZE_STACK - 1) { + stack->constructor[stack->level] = constructor; + stack->level++; + rv = constructor(window, stack); + if (rv) eve_stack_back(stack, window); + } +} + +void eve_stack_back(EVEViewStack *stack, EVEWindow *window) { + eve_view_constructor_t constructor; + int rv = 1; + + stack->dirty = 1; + while ((stack->level > 1) && rv) { + stack->level--; + constructor = stack->constructor[stack->level - 1]; + rv = constructor(window, stack); + } +} + +eve_view_constructor_t eve_stack_get(EVEViewStack *stack) { + if (stack->level) return stack->constructor[stack->level - 1]; + return NULL; +} diff --git a/fw/fe310/eos/eve/screen/view.h b/fw/fe310/eos/eve/screen/view.h index c8be33a..3e8c0a0 100644 --- a/fw/fe310/eos/eve/screen/view.h +++ b/fw/fe310/eos/eve/screen/view.h @@ -11,7 +11,7 @@ struct EVEWindow; typedef uint8_t (*eve_view_draw_t) (struct EVEView *, uint8_t); typedef int (*eve_view_touch_t) (struct EVEView *, EVETouch *, uint16_t, uint8_t); typedef int (*eve_view_uievt_t) (struct EVEView *, uint16_t, void *); -typedef void (*eve_view_constructor_t) (struct EVEWindow *window, struct EVEViewStack *); +typedef int (*eve_view_constructor_t) (struct EVEWindow *window, struct EVEViewStack *); typedef struct EVEView { eve_view_draw_t draw; @@ -27,6 +27,7 @@ typedef struct EVEView { typedef struct EVEViewStack { eve_view_constructor_t constructor[EVE_VIEW_SIZE_STACK]; uint8_t level; + uint8_t dirty; } EVEViewStack; void eve_view_init(EVEView *view, struct EVEWindow *window, eve_view_draw_t draw, eve_view_touch_t touch, eve_view_uievt_t uievt, void *param); @@ -34,9 +35,10 @@ void eve_view_set_color_bg(EVEView *view, uint8_t r, uint8_t g, uint8_t b); void eve_view_set_color_fg(EVEView *view, uint8_t r, uint8_t g, uint8_t b); uint8_t eve_view_clear(EVEView *view, uint8_t tag0, uint8_t tag_opt); -void eve_view_stack_init(EVEViewStack *stack); -void eve_view_create(struct EVEWindow *window, EVEViewStack *stack, eve_view_constructor_t constructor); -void eve_view_destroy(struct EVEWindow *window, EVEViewStack *stack); - int eve_view_uievt_push(EVEView *view, uint16_t evt, void *param); int eve_view_uievt_push_gest(EVEView *view, uint16_t evt, EVETouch *touch, uint16_t t_evt, uint8_t tag0); + +void eve_stack_init(EVEViewStack *stack); +void eve_stack_create_view(EVEViewStack *stack, struct EVEWindow *window, eve_view_constructor_t constructor); +void eve_stack_back(EVEViewStack *stack, struct EVEWindow *window); +eve_view_constructor_t eve_stack_get(EVEViewStack *stack);
\ No newline at end of file diff --git a/fw/fe310/eos/eve/screen/window.c b/fw/fe310/eos/eve/screen/window.c index c259b19..34d265a 100644 --- a/fw/fe310/eos/eve/screen/window.c +++ b/fw/fe310/eos/eve/screen/window.c @@ -27,6 +27,7 @@ void eve_window_init_root(EVEWindowRoot *root, EVERect *g, char *name, EVEFont * root->mem_next = EVE_RAM_G; root->font = font; root->win_kbd = NULL; + root->win_scroll = NULL; root->tag0 = EVE_NOTAG; eve_touch_set_handler(eve_window_root_touch, root); } diff --git a/fw/fe310/eos/eve/widget/freew.c b/fw/fe310/eos/eve/widget/freew.c index e7591da..11b8e50 100644 --- a/fw/fe310/eos/eve/widget/freew.c +++ b/fw/fe310/eos/eve/widget/freew.c @@ -33,7 +33,9 @@ uint8_t eve_freew_draw(EVEWidget *_widget, uint8_t tag0) { _widget->tag0 = tag0; _widget->tagN = tag0; + eve_cmd_dl(SAVE_CONTEXT()); widget->_draw(widget); + eve_cmd_dl(RESTORE_CONTEXT()); return _widget->tagN; } @@ -43,15 +45,24 @@ int eve_freew_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { int ret; ret = widget->_touch(widget, touch, evt); - if (ret) eve_widget_set_focus(_widget, NULL); return ret; } -void eve_freew_tag(EVEFreeWidget *widget) { +uint8_t eve_freew_tag(EVEFreeWidget *widget) { EVEWidget *_widget = &widget->w; + uint8_t ret = EVE_NOTAG; if (_widget->tagN != EVE_NOTAG) { - eve_cmd_dl(TAG(_widget->tagN)); + ret = _widget->tagN; + eve_cmd_dl(TAG(ret)); _widget->tagN++; } + + return ret; } + +uint8_t eve_widget_tag_index(EVEFreeWidget *widget, uint8_t tag) { + EVEWidget *_widget = &widget->w; + + return tag - _widget->tag0; +}
\ No newline at end of file diff --git a/fw/fe310/eos/eve/widget/freew.h b/fw/fe310/eos/eve/widget/freew.h index 324e98d..cbcd08b 100644 --- a/fw/fe310/eos/eve/widget/freew.h +++ b/fw/fe310/eos/eve/widget/freew.h @@ -24,4 +24,5 @@ int eve_freew_create(EVEWidget *_widget, struct EVEWidgetSpec *spec, EVEPage *pa uint8_t eve_freew_draw(EVEWidget *_widget, uint8_t tag0); int eve_freew_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt); -void eve_freew_tag(EVEFreeWidget *widget); +uint8_t eve_freew_tag(EVEFreeWidget *widget); +uint8_t eve_widget_tag_index(EVEFreeWidget *widget, uint8_t tag);
\ No newline at end of file diff --git a/fw/fe310/eos/eve/widget/pagew.c b/fw/fe310/eos/eve/widget/pagew.c index c926892..77e8f01 100644 --- a/fw/fe310/eos/eve/widget/pagew.c +++ b/fw/fe310/eos/eve/widget/pagew.c @@ -51,7 +51,6 @@ int eve_pagew_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { EVEPageWidget *widget = (EVEPageWidget *)_widget; if (evt & EVE_TOUCH_ETYPE_TAG_UP) { - eve_widget_set_focus(_widget, NULL); eve_page_open(parent, widget->constructor); return 1; } diff --git a/fw/fe310/eos/eve/widget/selectw.c b/fw/fe310/eos/eve/widget/selectw.c index 5acf998..f5bb6e0 100644 --- a/fw/fe310/eos/eve/widget/selectw.c +++ b/fw/fe310/eos/eve/widget/selectw.c @@ -180,7 +180,6 @@ int eve_selectw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { } } - eve_widget_set_focus(_widget, NULL); return 1; } @@ -206,7 +205,8 @@ utf8_t *eve_selectw_option(EVESelectWidget *widget, int idx) { } utf8_t *eve_selectw_option_selected(EVESelectWidget *widget) { - return eve_selectw_option(widget, widget->select); + if (widget->select != SELECTW_NOSELECT) return eve_selectw_option(widget, widget->select); + return NULL; } int eve_selectw_add_option(EVESelectWidget *widget, utf8_t *option) { diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c index ae9ccab..6bddbe9 100644 --- a/fw/fe310/eos/eve/widget/strw.c +++ b/fw/fe310/eos/eve/widget/strw.c @@ -81,7 +81,7 @@ void eve_strw_destroy(EVEWidget *_widget) { eve_free(widget->str); } -static void set_focus(EVEStrWidget *widget) { +static void show_rect(EVEStrWidget *widget) { EVEWidget *_widget = &widget->w; EVERect focus; @@ -89,7 +89,7 @@ static void set_focus(EVEStrWidget *widget) { focus.y = _widget->g.y; focus.w = _widget->g.w; focus.h = 2 * widget->font->h; - eve_widget_set_focus(_widget, &focus); + eve_page_show_rect(_widget->page, &focus); } static EVEStrCursor *cursor_prox(EVEStrWidget *widget, EVEStrCursor *cursor, EVETouch *touch, short *dx) { @@ -282,7 +282,7 @@ int eve_strw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT | EVE_TOUCH_EETYPE_LPRESS))) { eve_strw_cursor_set(widget, &widget->cursor1, eve_page_x(page, touch->x0)); if (widget->cursor2.on) eve_strw_cursor_clear(widget, &widget->cursor2); - set_focus(widget); + show_rect(widget); ret = 1; } } @@ -293,7 +293,6 @@ int eve_strw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { widget->track.dx = 0; } - if (ret) eve_widget_set_focus(_widget, NULL); return ret; } diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c index 70a1e06..a4114ee 100644 --- a/fw/fe310/eos/eve/widget/textw.c +++ b/fw/fe310/eos/eve/widget/textw.c @@ -81,7 +81,7 @@ void eve_textw_destroy(EVEWidget *_widget) { eve_free(widget->text); } -static void set_focus(EVETextWidget *widget, EVETextCursor *cursor) { +static void show_rect(EVETextWidget *widget, EVETextCursor *cursor) { EVEWidget *_widget = &widget->w; EVERect focus; @@ -89,7 +89,7 @@ static void set_focus(EVETextWidget *widget, EVETextCursor *cursor) { focus.y = _widget->g.y + cursor->line * widget->font->h; focus.w = _widget->g.w; focus.h = 2 * widget->font->h; - eve_widget_set_focus(_widget, &focus); + eve_page_show_rect(_widget->page, &focus); } static EVETextCursor *cursor_prox(EVETextWidget *widget, EVETextCursor *cursor, EVETouch *touch, short *dx, short *dl) { @@ -280,7 +280,7 @@ int eve_textw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { if ((evt & EVE_TOUCH_ETYPE_POINT_UP) && !(touch->eevt & (EVE_TOUCH_EETYPE_TRACK_XY | EVE_TOUCH_EETYPE_ABORT | EVE_TOUCH_EETYPE_LPRESS))) { eve_textw_cursor_set(widget, &widget->cursor1, touch->tag_up, eve_page_x(page, touch->x0)); if (widget->cursor2.on) eve_textw_cursor_clear(widget, &widget->cursor2); - set_focus(widget, &widget->cursor1); + show_rect(widget, &widget->cursor1); ret = 1; } } @@ -291,7 +291,6 @@ int eve_textw_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt) { widget->track.dl = 0; } - if (ret) eve_widget_set_focus(_widget, NULL); return ret; } @@ -405,11 +404,11 @@ void eve_textw_putc(void *w, int c) { if (cursor1->line && (cursor1->ch < LINE_START(widget, cursor1->line))) { cursor1->line--; eve_textw_cursor_update(widget, cursor1); - set_focus(widget, cursor1); + show_rect(widget, cursor1); } else if (cursor1->ch > LINE_END(widget, cursor1->line)) { while (cursor1->ch > LINE_END(widget, cursor1->line)) cursor1->line++; eve_textw_cursor_update(widget, cursor1); - set_focus(widget, cursor1); + show_rect(widget, cursor1); } else { cursor1->x += ch_w; } 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 diff --git a/fw/fe310/eos/eve/widget/togglew.h b/fw/fe310/eos/eve/widget/togglew.h index 26ff77c..aa5485d 100644 --- a/fw/fe310/eos/eve/widget/togglew.h +++ b/fw/fe310/eos/eve/widget/togglew.h @@ -1,5 +1,7 @@ #include <stdint.h> +#define EVE_TOGGLEW_MARGIN 50 + struct EVEWidgetSpec; typedef struct EVEToggleWidget { @@ -12,6 +14,7 @@ typedef struct EVEToggleWidget { typedef struct EVEToggleSpec { EVEFont *font; char *labels; + uint8_t state; } EVEToggleSpec; void eve_togglew_init(EVEToggleWidget *widget, EVERect *g, EVEPage *page, EVEFont *font, char *labels); @@ -19,3 +22,7 @@ void eve_togglew_init(EVEToggleWidget *widget, EVERect *g, EVEPage *page, EVEFon int eve_togglew_create(EVEWidget *_widget, struct EVEWidgetSpec *spec, EVEPage *page); uint8_t eve_togglew_draw(EVEWidget *_widget, uint8_t tag0); int eve_togglew_touch(EVEWidget *_widget, EVETouch *touch, uint16_t evt); + +void eve_togglew_set(EVEToggleWidget *widget); +void eve_togglew_clr(EVEToggleWidget *widget); +uint8_t eve_togglew_get(EVEToggleWidget *widget);
\ No newline at end of file diff --git a/fw/fe310/eos/eve/widget/widget.c b/fw/fe310/eos/eve/widget/widget.c index a157301..88b90a9 100644 --- a/fw/fe310/eos/eve/widget/widget.c +++ b/fw/fe310/eos/eve/widget/widget.c @@ -49,10 +49,10 @@ void eve_widget_destroy(EVEWidget *widget) { if (_eve_widget_destroy[widget->type]) _eve_widget_destroy[widget->type](widget); } -void eve_widget_set_focus(EVEWidget *widget, EVERect *rect) { +void eve_widget_set_focus(EVEWidget *widget) { EVEPage *page = widget->page; - eve_page_set_focus(page, widget, rect); + eve_page_set_focus(page, widget); } void eve_widget_set_flags(EVEWidget *widget, uint8_t flags) { diff --git a/fw/fe310/eos/eve/widget/widget.h b/fw/fe310/eos/eve/widget/widget.h index 0bef06e..a565b53 100644 --- a/fw/fe310/eos/eve/widget/widget.h +++ b/fw/fe310/eos/eve/widget/widget.h @@ -2,9 +2,10 @@ #include "label.h" -#define EVEP_WIDGET_FLAG_RO 0x01 -#define EVEP_WIDGET_FLAG_HIDDEN 0x02 -#define EVEP_WIDGET_FLAG_BUSY 0x04 +#define EVE_WIDGET_FLAG_SKIP 0x01 +#define EVE_WIDGET_FLAG_HIDDEN 0x02 +#define EVE_WIDGET_FLAG_RO 0x04 +#define EVE_WIDGET_FLAG_BUSY 0x08 struct EVEWidget; @@ -44,6 +45,6 @@ size_t eve_widget_size(uint8_t type); void eve_widget_set_label(EVEWidget *widget, EVELabel *label); EVEWidget *eve_widget_next(EVEWidget *widget); -void eve_widget_set_focus(EVEWidget *widget, EVERect *rect); +void eve_widget_set_focus(EVEWidget *widget); void eve_widget_set_flags(EVEWidget *widget, uint8_t flags); void eve_widget_clr_flags(EVEWidget *widget, uint8_t flags);
\ No newline at end of file diff --git a/fw/fe310/eos/soc/timer.h b/fw/fe310/eos/soc/timer.h index 0309454..6e77502 100644 --- a/fw/fe310/eos/soc/timer.h +++ b/fw/fe310/eos/soc/timer.h @@ -1,10 +1,11 @@ #include <stdint.h> #define EOS_TIMER_ETYPE_UI 1 -#define EOS_TIMER_ETYPE_ECP 2 -#define EOS_TIMER_ETYPE_USER 4 +#define EOS_TIMER_ETYPE_EVE 2 +#define EOS_TIMER_ETYPE_ECP 3 +#define EOS_TIMER_ETYPE_USR 4 -#define EOS_TIMER_MAX_ETYPE 4 +#define EOS_TIMER_MAX_ETYPE 8 #define EOS_TIMER_NONE -1 #define EOS_TIMER_RTC_FREQ 32768 |