#include #include #include #include #include #include #include #include #include #include #include #include #include #include "app/app.h" #include "timer.h" static void timer(unsigned char evt) { int rv; printf("TIMER\n"); eos_timer_set(EOS_TIMER_ETYPE_USR, 500); } int timer_app(EVEWindow *window, EVEViewStack *stack) { EVEFormSpec spec[] = { APP_SPACERW(1,1), }; EVEPage *page = eve_form_create(window, stack, spec, APP_SPEC_SIZE(spec), NULL, timer_close); if (page == NULL) return EVE_ERR_NOMEM; eos_timer_set_handler(EOS_TIMER_ETYPE_USR, timer); eos_timer_set(EOS_TIMER_ETYPE_USR, 500); eos_net_acquire_for_evt(EOS_EVT_TIMER | EOS_TIMER_ETYPE_USR, 1); return EVE_OK; } void timer_close(EVEPage *page) { eos_timer_clear(EOS_TIMER_ETYPE_USR); eos_timer_set_handler(EOS_TIMER_ETYPE_USR, NULL); eos_net_acquire_for_evt(EOS_EVT_TIMER | EOS_TIMER_ETYPE_USR, 0); eve_form_destroy(page); }