void edit_consumption_set(uint8_t pos, int8_t step) { helpers_loop(&consumption, 1, 4, step); display_chars(0, LCD_SEG_L1_3_0, consumption_str[consumption-1], SEG_SET); display_symbol(0, LCD_UNIT_L1_PER_S, consumption == 4 ? SEG_ON : SEG_OFF); }
/* lcd_screen_activate() - the memory pointed by display_screens is assumed to be on contiguos memory if scr_nr == 0xff, then activate next screen. */ void lcd_screen_activate(uint8_t scr_nr) { uint8_t prevscr = display_activescr; if (scr_nr == 0xff) helpers_loop(&display_activescr, 0, display_nrscreens - 1, 1); else display_activescr = scr_nr; /* allocate memory for previous screen */ display_screens[prevscr].segmem = malloc(LCD_MEM_LEN); display_screens[prevscr].blkmem = malloc(LCD_MEM_LEN); /* copy real screen contents to previous screen */ memcpy(display_screens[prevscr].segmem, LCD_SEG_MEM, LCD_MEM_LEN); memcpy(display_screens[prevscr].blkmem, LCD_BLK_MEM, LCD_MEM_LEN); /* update real screen with contents from activated screen */ memcpy(LCD_SEG_MEM, display_screens[display_activescr].segmem, LCD_MEM_LEN); memcpy(LCD_BLK_MEM, display_screens[display_activescr].blkmem, LCD_MEM_LEN); /* free memory from the activated screen */ free(display_screens[display_activescr].segmem); free(display_screens[display_activescr].blkmem); /* set activated screen as real screen output */ display_screens[display_activescr].segmem = LCD_SEG_MEM; display_screens[display_activescr].blkmem = LCD_BLK_MEM; }
static void edit_hh_set(int8_t step) { helpers_loop(&rtca_time.hour, 0, 23, step); #ifdef CONFIG_MOD_CLOCK_AMPM uint8_t tmp_hh = rtca_time.hour; if (tmp_hh > 12) { display_symbol(0, LCD_SYMB_AM, SEG_OFF); display_symbol(0, LCD_SYMB_PM, SEG_SET); _printf(0, LCD_SEG_L1_3_2, "%02u", tmp_hh-12); } else { if (tmp_hh == 0) { _printf(0, LCD_SEG_L1_3_2, "%02u", 12); } else { if (tmp_hh > 9) _printf(0, LCD_SEG_L1_3_2, "%02u", tmp_hh); else _printf(0, LCD_SEG_L1_3_2, "%02u", tmp_hh); } if (tmp_hh == 12) { display_symbol(0, LCD_SYMB_AM, SEG_OFF); display_symbol(0, LCD_SYMB_PM, SEG_SET); } else { display_symbol(0, LCD_SYMB_PM, SEG_OFF); display_symbol(0, LCD_SYMB_AM, SEG_SET); } } rtca_time.hour = tmp_hh; #else _printf(0, LCD_SEG_L1_3_2, "%02u", rtca_time.hour); #endif }
static void edit_yy_set(int8_t step) { /* this allows setting years between 2012 and 2022 */ *((uint8_t *)&rtca_time.year + 1) = 0x07; helpers_loop((uint8_t *)&rtca_time.year, 220, 230, step); _printf(1, LCD_SEG_L1_3_0, "%04u", rtca_time.year); }
static void edit_dd_set(int8_t step) { helpers_loop(&rtca_time.day, 1, rtca_get_max_days(rtca_time.mon, rtca_time.year), step); #ifdef CONFIG_MOD_CLOCK_MONTH_FIRST _printf(0, LCD_SEG_L2_1_0, "%02u", rtca_time.day); #else _printf(0, LCD_SEG_L2_4_3, "%02u", rtca_time.day); #endif }
static void edit_mo_set(int8_t step) { helpers_loop(&rtca_time.mon, 1, 12, step); #ifdef CONFIG_MOD_CLOCK_MONTH_FIRST _printf(0, LCD_SEG_L2_4_3, "%02u", rtca_time.mon); #else _printf(0, LCD_SEG_L2_1_0, "%02u", rtca_time.mon); #endif }
static void edit_mm_set(int8_t step) { helpers_loop(&rtca_time.min, 0, 59, step); _printf(0, LCD_SEG_L1_1_0, "%02u", rtca_time.min); }
static void edit_mm_set(int8_t step) { helpers_loop(&tmp_mm, 0, 59, step); _printf(0, LCD_SEG_L1_1_0, "%02u", tmp_mm); }
static void edit_hh_set(int8_t step) { /* TODO: fix for 12/24 hr! */ helpers_loop(&tmp_hh, 0, 23, step); _printf(0, LCD_SEG_L1_3_2, "%02u", tmp_hh); }
static void it_edit_dd_set(int8_t step) { helpers_loop(&it_tmp_device, 1, 16, step); _printf(0, LCD_SEG_L1_1_0, "%02u", it_tmp_device); }
void edit_power_set(uint8_t pos, int8_t step) { helpers_loop(&altPowerMode, 0, 3, step); display_chars(0, LCD_SEG_L1_3_0, power_mode_str[altPowerMode], SEG_SET); }
void editMMSet(int8_t step) { helpers_loop(&(enteredTimeOfNextLow.minutesLeft), 0, 59, step); _printf(0, LCD_SEG_L1_1_0, "%02u", enteredTimeOfNextLow.minutesLeft); }
void editHHSet(int8_t step) { helpers_loop(&(enteredTimeOfNextLow.hoursLeft), 0, 23, step); _printf(0, LCD_SEG_L1_3_2, "%02u", enteredTimeOfNextLow.hoursLeft); }
static void edit_mm_set(int8_t step) { helpers_loop(&tmp_date.month, 1, 12, step); _printf(0, EDIT_MM_FIELD, "%2u", tmp_date.month); }
static void edit_dd_set(int8_t step) { uint8_t day_limit = get_number_of_days(tmp_date.month, tmp_date.year); helpers_loop(&tmp_date.day, 1, day_limit, step); _printf(0, EDIT_DD_FIELD, "%2u", tmp_date.day); }
static void it_edit_pwr_set(int8_t step) { helpers_loop(&it_tmp_pwr_level, 0, 3, step); _printf(0, LCD_SEG_L2_1_0, "%02x", it_pwr[it_tmp_pwr_level]); }
void edit_threshold_set(uint8_t pos, int8_t step) { helpers_loop(&sAlt.accu_threshold, 0, 9, step); _printf(0, LCD_SEG_L1_1_0, "%1u", sAlt.accu_threshold); }
static void it_edit_ff_set(int8_t step) { helpers_loop(&it_tmp_family, 1, 16, step); _printf(0, LCD_SEG_L1_3_2, "%02u", it_tmp_family); }