int main(void) { uint8_t lcd_show = 1, was_in_menu=0; InitAll(); FirstRun(); while(1) { switch(state) { case 0: //simple kb checking my_btn = get_btn(); ProcessMenu(my_btn->button, my_btn->duration); if(is_in_menu()) was_in_menu=1; if(!is_in_menu() && was_in_menu){ state=1; was_in_menu=0; } search_for_cmd(); break; case 1: check_state(); state=0; break; case 2: break; } } }
void add_phone(void){ button *btn; uint8_t btn_val; uint8_t symbol; keyboard my_kb = {CURSOR_BLINK, 12, 3, {{'0', 0 , 0 , 0 , 0 ,' '}, {'1','_', 0 , 0 , 0 , 0 }, {'2','a','b','c', 0 , 0 }, {'3','d','e','f', 0 , 0 }, {'4','g','h','i', 0 , 0 }, {'5','j','k','l', 0 , 0 }, {'6','m','n','o', 0 , 0 }, {'7','p','q','r','s', 0 }, {'8','t','u','v', 0 , 0 }, {'9','w','x','y','z', 0 }, {'<', 0 , 0 , 0 , 0 ,'#'}, {'*','+', 0 , 0 , 0 ,'^'}}, "Type text", "012345678"}; text_editor_init(&my_kb); do{ btn = get_btn(); btn_val = btn->button; if(btn_val){ key_controller(btn_val, btn->duration); } symbol = read_tmp_symbol(); if(symbol){ lcd_putc(symbol); } symbol = read_symbol(); if(symbol){ cursor_shift(RIGHT); } /* switch (btn_val){ case '2': break; case '1': break; case '3': break; case '*': } */ }while (btn_val != '2'); text_editor_close(); }
void wait() { lcd_cursor(1, 0); print_string("Listo"); while (!get_btn()); clear_screen(); lcd_cursor(3, 0); print_string("Go"); _delay_ms(200); }