#include "ui.h" #include #include #include "led.h" #include "beep.h" #include "menu.h" #include "sys.h" #include "../src/thread.h" #include "cfg.h" #if 1 #define LOGD log_d #define LOGE log_e #else #define LOGD printf #define LOGE printf #endif typedef struct { int fd; }ui_handle_t; static ui_handle_t uiHandle={0}; static void msleep(int ms) { usleep(ms*1000); } static void *ui_thread(void *arg) { int r; thread_handle_t *th=(thread_handle_t*)arg; ui_handle_t *h=(ui_handle_t*)th->arg; menu_init(); while(th->quit==0) { menu_handle(); msleep(50); } menu_deinit(); pthread_exit(NULL); } ///////////////////////////////////////////////////// int ui_init(void) { ui_handle_t *h=&uiHandle; #ifndef SCREEN_RGB thread_start(THREAD_ID_UI, ui_thread, h); #endif return 0; } int ui_deinit(void) { ui_handle_t *h=&uiHandle; thread_stop(THREAD_ID_UI); return 0; }