| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #include "ui.h"
- #include <unistd.h>
- #include <stdlib.h>
- #include "menu.h"
- #include "sys.h"
- #include "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;
- #if 1//def USE_UI
- thread_start(THREAD_ID_UI, ui_thread, h);
- #endif
- return 0;
- }
|