| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #include "ui.h"
- #include "lcd.h"
- #include "key.h"
- #include "beep.h"
- #include "thread.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 int menu_init(ui_handle_t *h)
- {
- //key_init(h);
- lcd_init(LCD_WIDTH,LCD_HEIGHT,LCD_COLOR);
-
- lcd_fill(0);
- //lcd_draw_string(10, 10, 80, 30, "Smart 123456789", FONT_08, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
- lcd_draw_string(10, 10, 80, 30, "输出: 12.0V", FONT_12, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
- //lcd_draw_string(10, 40, 80, 30, "输出入通道: 12.0V", FONT_16, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
- //lcd_draw_string(10, 30, 80, 30, "Voltage: 22.4V", FONT_12, COLOR_WHITE, COLOR_BLACK, HORIZONTAL_LEFT, VERTICAL_CENTER);
- lcd_refresh();
-
- return 0;
- }
- static int menu_deinit(ui_handle_t *h)
- {
- //key_deinit(h);
- lcd_deinit();
-
- return 0;
- }
- static int menu_handle(ui_handle_t *h)
- {
- int r;
-
- //r = key_get(h, &kd);
- if(r==0) {
- //switch(kd.key) {
- // case KEY_LEFT:
- // break;
- //}
- }
-
- return 0;
- }
- 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(h);
- while(th->quit==0) {
- menu_handle(h);
- }
- menu_deinit(h);
-
- pthread_exit(NULL);
- }
- /////////////////////////////////////////////////////
- int ui_init(void)
- {
- ui_handle_t *h=&uiHandle;
-
- thread_start(THREAD_ID_UI, ui_thread, h);
-
- return 0;
- }
|