Код: Выделить всё
/** выбор меню числа месяца */
static void day_of_month_Select(void)
{
signed char x = 1;
dsprintf(string, "%i/%i/20%02i", data[1], data[2], data[3]);
lcd_gotoxy(0,1);
lcd_str_out(string);
x = data[1];
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 31) x = 1; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 1) x = 31; else;
} else;
dsprintf(string, "%i/%i/20%02i", x, data[2], data[3]);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
data[1] = x;
}
/** выбор меню месяца */
static void month_Select(void)
{
signed char x = 1;
dsprintf(string, "%i/%i/20%02i", data[1], data[2], data[3]);
lcd_gotoxy(0,1);
lcd_str_out(string);
x = data[2];
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 12) x = 1; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 1) x = 12; else;
} else;
dsprintf(string, "%i/%i/20%02i", data[1], x, data[3]);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
data[2] = x;
}
/** выбор меню год */
static void year_Select(void)
{
//ds3231_read_data(data);// Вывести дату
dsprintf(string, "%i/%i/20%02i", data[1], data[2], data[3]);
lcd_gotoxy(0,1);
lcd_str_out(string);
signed char x = 1;
//lcd_init(1);
x = data[3];
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 22) x = 22; else;
} else;
dsprintf(string, "%i/%i/20%02i", data[1], data[2], x);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
data[3] = x;
}
/** выбор меню дня недели */
static void day_Select(void)
{
signed char x = 1;
dsprintf(string, "%i", data[0]);
lcd_gotoxy(0,1);
lcd_str_out(string);
//lcd_gotoxy(1,2);
//lcd_init(1);
x = data[0];
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 7) x = 1; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 1) x = 7; else;
} else;
dsprintf(string, "%i", x);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
data[0] = x;
}
/** выбор меню часа */
static void hours_Select(void)
{
signed char x = 1;
ds3231_read_time(time);
// Вывести время
dsprintf(string, "%02i:%02i:%02i", time[0], time[1], time[2]);
lcd_gotoxy(0,1);
lcd_str_out(string);
//lcd_gotoxy(1,2);
//lcd_init(1);
x = time[0];
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 23) x = 0; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 0) x = 23; else;
} else;
dsprintf(string, "%02i:%02i:%02i", x, time[1], time[2]);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
time[0] = x;
}
/** выбор меню минут */
static void minutes_Select(void)
{
signed char x = 1;
// Вывести время
dsprintf(string, "%02i:%02i:%02i", time[0], time[1], time[2]);
lcd_gotoxy(0,1);
lcd_str_out(string);
//lcd_gotoxy(1,2);
//lcd_init(1);
x = time[1];
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 59) x = 0; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 0) x = 59; else;
} else;
dsprintf(string, "%02i:%02i:%02i", time[0], x, time[2]);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
time[1] = x;
}
/** изменение часа открытия */
static void open_hours_Select(void)
{
dsprintf(string, "%02i:%02i", set_HOUR_OPEN, set_MINUTE_OPEN);
lcd_gotoxy(0,1);
lcd_str_out(string);
signed char x = 1;
//lcd_init(1);
x = set_HOUR_OPEN;
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 23) x = 0; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 0) x = 23; else;
} else;
dsprintf(string, "%02i:%02i", x, set_MINUTE_OPEN);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
set_HOUR_OPEN = x;
}
/** изменение минут открытия */
static void open_minutes_Select(void)
{
dsprintf(string, "%02i:%02i", set_HOUR_OPEN, set_MINUTE_OPEN);
lcd_gotoxy(0,1);
lcd_str_out(string);
signed char x = 1;
//lcd_init(1);
x = set_MINUTE_OPEN;
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 59) x = 0; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 0) x = 59; else;
} else;
dsprintf(string, "%02i:%02i", set_HOUR_OPEN, x);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
set_MINUTE_OPEN = x;
}
/** изменение часа зактытия */
static void close_hours_Select(void)
{
dsprintf(string, "%02i:%02i", set_HOUR_CLOSED, set_MINUTE_CLOSED);
lcd_gotoxy(0,1);
lcd_str_out(string);
signed char x = 1;
//lcd_init(1);
x = set_HOUR_CLOSED;
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 23) x = 0; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 0) x = 23; else;
} else;
dsprintf(string, "%02i:%02i", x, set_MINUTE_CLOSED);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
set_HOUR_CLOSED = x;
}
/** выбор меню минут закрытия */
static void close_minutes_Select(void)
{
dsprintf(string, "%02i:%02i", set_HOUR_OPEN, set_MINUTE_OPEN);
lcd_gotoxy(0,1);
lcd_str_out(string);
signed char x = 1;
//lcd_init(1);
x = set_MINUTE_CLOSED;
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++x; if(x > 59) x = 0; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--x; if(x < 0) x = 59; else;
} else;
dsprintf(string, "%02i:%02i", set_HOUR_CLOSED, x);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
set_MINUTE_CLOSED = x;
}
/** выбор меню изменения порога температуры */
static void degress_Select(void)
{
set_TEMPR = temperatura;
// Вывести температуру
dsprintf(string, "%3i", set_TEMPR);
lcd_gotoxy(0,1);
lcd_str_out(string);
//lcd_gotoxy(1,2);
//lcd_init(1);
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++set_TEMPR; if(set_TEMPR > 59) set_TEMPR = 20; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--set_TEMPR; if(set_TEMPR < 20) set_TEMPR = 59; else;
} else;
dsprintf(string, "%3i", set_TEMPR);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
}
/** выбор меню изменения порога яркости */
static void brightnes_Select(void)
{
dsprintf(string, "%3i", level_BRIGHTNES);
lcd_gotoxy(0,1);
lcd_str_out(string);
//lcd_gotoxy(1,2);
//lcd_init(1);
set_BRIGHTNES= level_BRIGHTNES;
//BUTTON = BUTTON_NONE;
while(1)
{
skan_key();
if((BUTTON == BUTTON_LEFT)||(BUTTON == BUTTON_RIGHT)) break; else;
if(BUTTON == BUTTON_UP)
{
++set_BRIGHTNES; if(set_BRIGHTNES > 255) set_BRIGHTNES = 1; else;
} else;
if(BUTTON == BUTTON_DOWN)
{
--set_BRIGHTNES; if(set_BRIGHTNES < 0) set_BRIGHTNES = 255; else;
} else;
dsprintf(string, "%3i", set_BRIGHTNES);
lcd_gotoxy(0,1);
lcd_str_out(string);
}
}