void print_date_xy(time t, uint8_t x, uint8_t y) { lcd_gotoxy(x, y); lcd_puts_p(dayStrings[get_day_of_week(t)]); lcd_putc(' '); lcd_puts_p(monthStrings[t.month - 1]); lcd_putc(' '); lcd_puts(digit_string(t.date)); lcd_puts(", "); lcd_puts(digit_string(t.year)); }
void print_set_date(time tempTime) { lcd_clrscr(); lcd_gotoxy(1, 0); lcd_puts_p(menuStrings[SET_TIME - 1]); print_date_xy(tempTime, 0, 1); }
void print_set_alarm1(time tempTime) { lcd_clrscr(); lcd_gotoxy(1, 0); lcd_puts_p(menuStrings[SET_ALARM1 - 1]); print_time(tempTime); }
unsigned char dispMenu(msg_par par) { menuItem* tempMenu; lcd_clrscr(1); // первая строка - заголовок. Или пункт меню верхнего уровня lcd_gotoxy(1,0); tempMenu = (menuItem*)pgm_read_word(&selectedMenuItem->Parent); if ((void*)tempMenu == (void*)&NULL_ENTRY) { // мы на верхнем уровне lcd_puts_p(PSTR("MENU:")); } else { lcd_puts_p((char *)tempMenu->Text); } lcd_clrscr(2); // Вторая строка - текущий пункт меню lcd_gotoxy(2,1); lcd_puts_p((char *)selectedMenuItem->Text); return (1); }
void updateDisplay() { lcd_gotoxy(0,0); if (parameters[P_CURRENT_STATE] == STATE_OFF) { lcd_puts_p(PSTR(" pSaw Chiller ")); lcd_gotoxy(0,1); lcd_puts_p(PSTR(" Standby ")); return; } else if (parameters[P_CURRENT_STATE] == STATE_ON) { lcd_puts_p(PSTR(" Chiller online ")); } else if (parameters[P_CURRENT_STATE] == STATE_FAN_ON) { lcd_puts_p(PSTR(" Running fan ")); } else if (parameters[P_CURRENT_STATE] == STATE_WARMUP) { lcd_puts_p(PSTR(" Huuuurnggh! ")); } else if (parameters[P_CURRENT_STATE] == STATE_COMPRESSOR_ON) { lcd_puts_p(PSTR(" Compressing! ")); } lcd_gotoxy(0,1); lcd_printf(PSTR("s=%d \xdf" "C o=%d \xdf" "C"), parameters[P_STORE_CURRENT]/10, parameters[P_CIRCULATION_CURRENT]/10); }
void print_menu(uint8_t menu) { lcd_clrscr(); print_arrows(0); lcd_gotoxy(1, 0); lcd_puts_p(menuStrings[menu - 1]); switch (menu) { case SET_TIME: print_time(t); break; case SET_ALARM1: print_time(alarmTime); break; //case SET_ALARM2: // print_time(alarmTime); // break; case SET_RETURN: break; } }
void print_month(time t) { lcd_gotoxy(dateOrigin.x + MONTH_X_OFFSET, dateOrigin.y + 1); lcd_puts_p(monthStrings[t.month - 1]); }
int main(void) { int16_t dac_val=511; int16_t cnt; int8_t dac_dir=0; char out_buf[21]; DDRD|= (1<<DDD0); // LED, enable PD0, LED as output LEDOFF; init_dac(); lcd_init(); lcd_clrscr(); lcd_puts("use U+/U-"); lcd_gotoxy(0,1); lcd_puts("and store"); init_kbd(); delay_ms(500); delay_ms(500); lcd_clrscr(); lcd_puts_p(PSTR("pause")); while (1) { if (dac_dir==1){ dac_val++; } if (dac_dir==-1){ dac_val--; } if (dac_val>0xFFF){ dac_val=0xFFF; //max, 13bit } if (dac_val<0){ dac_val=0; } lcd_gotoxy(0,1); itoa(dac_val,out_buf,10); lcd_puts(out_buf); lcd_puts(" "); dac(dac_val); cnt=1; check_u_button(&cnt); if (cnt>1){ lcd_clrscr(); // u+ pressed lcd_puts_p(PSTR("up")); dac_dir=1; LEDOFF; } if (cnt<1){ lcd_clrscr(); // u- pressed lcd_puts_p(PSTR("down")); dac_dir=-1; LEDON; } if (check_store_button()){ lcd_clrscr(); lcd_puts_p(PSTR("pause")); dac_dir=0; } delay_ms(100); cnt=1; check_u_button(&cnt); if (cnt>1){ lcd_clrscr(); // u+ pressed lcd_puts_p(PSTR("up")); dac_dir=1; LEDOFF; } if (cnt<1){ lcd_clrscr(); // u- pressed lcd_puts_p(PSTR("down")); dac_dir=-1; LEDON; } if (check_store_button()){ lcd_clrscr(); lcd_puts_p(PSTR("pause")); dac_dir=0; } delay_ms(100); } return(0); }