fremoclock  1_3A01
FREMO Clock - Software for UTG
UserInterfaceLcdNormal.c
Go to the documentation of this file.
1 
23 /*
24  Copyright (C) 2007 Bernd Wisotzki
25 
26  This library is free software; you can redistribute it and/or
27  modify it under the terms of the GNU Lesser General Public
28  License as published by the Free Software Foundation; either
29  version 2.1 of the License, or (at your option) any later version.
30 
31  This library is distributed in the hope that it will be useful,
32  but WITHOUT ANY WARRANTY; without even the implied warranty of
33  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34  Lesser General Public License for more details.
35 
36  You should have received a copy of the GNU Lesser General Public
37  License along with this library; if not, write to the Free Software
38  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 */
40 
41 /* -- System wide includes -------------------------------------------------- */
42 #include <stdint.h> // typedef uint8_t
43 #include <avr/pgmspace.h> // PSTR()
44 
45 /* -- Special Includes e.g. Onboard or direct attached Equipment ------------ */
46 //TODO: cleanup of imports, add comments what is imported
47 #include "ClockKernel.h" // clock kernel
48 #include "lcd.h"
49 //#include "uart.h" // logging
50 #include "UserInterfaceLcd.h"
51 #include "UserInterfaceMenu.h" // typedef menuNormalClock_t,
52  // typedef menuSetTime_t
53 #include "UserInterfaceLcdNormal.h"
54 
55 /* -- Function prototypes internal functions -------------------------------- */
56 
57 // for comment see below
59 
60 // for comment see below
61 static void UserInterfaceLcdNormalTime(const char *which, menuSetTime_t button,
62  uint8_t hour, uint8_t minute);
63 
64 // for comment see below
65 static void UserInterfaceLcdNormalTimeSet(const char *which,
66  uint8_t minute, uint8_t hour);
67 
68 /* -- Standard functions ---------------------------------------------------- */
69 
81 {
82  lcd_goto(0, 0);
84  lcd_puts_P(PSTR(" "));
86  lcd_puts_P(PSTR(" NmUhr"));
87  lcd_goto(5, 1);
88  lcd_puts_P(PSTR(" "));
90  lcd_goto(0, 1);
91  fclock_t clock = ClockGetTime();
93 }
94 
100 {
101  //lcd_clear();
102  lcd_goto(0, 0);
104  lcd_goto(11, 0);
105  lcd_puts_P(PSTR("NmSvr"));
106  lcd_goto(0, 1);
107  fclock_t clock = ClockGetTime();
108  UserInterfaceLcdWriteTime(clock.hour, clock.minute);
109  lcd_goto(11, 1);
110  switch (ucbut)
111  {
112  case MENU_FASTFWD_START: lcd_puts_P(PSTR("SvSrt")); break;
113  case MENU_FASTFWD_NULL : lcd_puts_P(PSTR("SvNul")); break;
114  case MENU_FASTFWD_BACK : lcd_puts_P(PSTR("Zurck")); break;
115  default : lcd_puts_P(PSTR("Error")); break;
116  }
117 }
118 
127  menuNormalClock_t ucbut1,
128  uint8_t ucminute, uint8_t uchour)
129 {
130  //lcd_clear();
131  lcd_goto(0, 0);
132  UserInterfaceLcdWriteTime(uchour, ucminute);
133  lcd_goto(11, 0);
134  switch (ucbut)
135  {
136  case MENU_FASTFWD_START: lcd_puts_P(PSTR("SvSrt")); break;
137  case MENU_FASTFWD_NULL : lcd_puts_P(PSTR("SvNul")); break;
138  // case MENU_FASTFWD_BACK: break;
139  default : lcd_puts_P(PSTR("Error")); break;
140  }
141  lcd_goto(0, 1);
142  fclock_t clock = ClockGetTime();
143  UserInterfaceLcdWriteTime(clock.hour, clock.minute);
144  lcd_goto(11, 1);
146 }
147 
153 {
154  lcd_goto(0, 0);
155  lcd_puts_P(PSTR(" "));
157  lcd_puts_P(PSTR(" NmVkz"));
158  lcd_goto(0, 1);
159  lcd_puts_P(PSTR("Up/Down Zurck"));
160 }
161 
167 {
168  UserInterfaceLcdNormalTime(PSTR(" NmSZt"), ucbut,
171 }
172 
178 {
179  fclock_t clock = ClockGetTime();
180  UserInterfaceLcdNormalTime(PSTR(" NmAZt"), ucbut,
181  clock.hour, clock.minute);
182 }
183 
189 {
190  UserInterfaceLcdNormalTime(PSTR(" NmZZt"), ucbut,
193 }
194 
200 void UserInterfaceLcdNormalStartTimeSet(uint8_t ucminute, uint8_t uchour)
201 {
202  UserInterfaceLcdNormalTimeSet(PSTR(" NmSZt"), ucminute, uchour);
203 }
204 
210 void UserInterfaceLcdNormalCurrentTimeSet(uint8_t ucminute, uint8_t uchour)
211 {
212  UserInterfaceLcdNormalTimeSet(PSTR(" NmAZt"), ucminute, uchour);
213 }
214 
220 void UserInterfaceLcdNormalTargetTimeSet(uint8_t ucminute, uint8_t uchour)
221 {
222  UserInterfaceLcdNormalTimeSet(PSTR(" NmZZt"), ucminute, uchour);
223 }
224 
225 /* -- private functions ----------------------------------------------------- */
226 
232 {
233  switch (button)
234  {
235  case MENU_NORMAL_START: lcd_puts_P(PSTR("Start")); break;
236  case MENU_NORMAL_BACK : lcd_puts_P(PSTR("Zurck")); break;
237  case MENU_NORMAL_STOP : lcd_puts_P(PSTR("Stop ")); break;
238  default : lcd_puts_P(PSTR("Error")); break;
239  }
240 }
241 
248 static void UserInterfaceLcdNormalTimeSet(const char *which,
249  uint8_t minute, uint8_t hour)
250 {
251  lcd_goto(0, 0);
252  UserInterfaceLcdWriteTime(hour, minute);
253  lcd_puts_P(which);
254  lcd_goto(0, 1);
255  lcd_puts_P(PSTR("Up/Down Zurck"));
256 }
257 
265 static void UserInterfaceLcdNormalTime(const char *which, menuSetTime_t button,
266  uint8_t hour, uint8_t minute)
267 {
268  lcd_goto(0, 0);
269  UserInterfaceLcdWriteTime(hour, minute);
270  lcd_puts_P(which);
271  lcd_goto(0, 1);
272  lcd_puts_P(PSTR(" "));
273  switch (button)
274  {
275  case MENU_SET_MINUTE: lcd_puts_P(PSTR("Minte")); break;
276  case MENU_SET_HOUR : lcd_puts_P(PSTR("Stnde")); break;
277  case MENU_SET_BACK : lcd_puts_P(PSTR("Zurck")); break;
278  default : lcd_puts_P(PSTR("Error")); break;
279  }
280 }
"SvSrt" | Schneller Vorlauf bis Startzeit
Subroutines for UserInterfaceMenu.
void UserInterfaceLcdNormalStartTimeSet(uint8_t ucminute, uint8_t uchour)
Write LCD display "NmSZt".
"Zurck" | Zurueck
A struct with hour and minute.
Definition: ClockKernel.h:69
void UserInterfaceLcdNormalCurrentTimeSet(uint8_t ucminute, uint8_t uchour)
Write LCD display "NmAZt".
uint8_t ClockReadTimeFactor(void)
Get time factor.
Definition: ClockKernel.c:350
Subroutines for acess to LCD for Normal.
uint8_t ClockReadEndTimeMinute(void)
Get the minute of the end time.
Definition: ClockKernel.c:422
void UserInterfaceLcdNormalQuick(menuFastFwd_t ucbut)
Write LCD display in Normal Mode ("NmSvr").
void UserInterfaceLcdNormalTargetTime(menuSetTime_t ucbut)
Write LCD display "NmZZt".
void UserInterfaceLcdNormalCurrentTime(menuSetTime_t ucbut)
Write LCD display "NmAZt".
void UserInterfaceLcdNormalTimeFactor(uint8_t ucbut)
Write LCD display while setting time factor.
uint8_t minute
minute value 0..59
Definition: ClockKernel.h:71
void UserInterfaceLcdWriteTime(uint8_t uchour, uint8_t ucminute)
Write clock value to lcd.
void lcd_goto(uint8_t x, uint8_t y)
Go to the specified position.
Definition: lcd.c:210
menuFastFwd_t
Enum used for Fast Forward Menu to select between Start Time or 00:00.
void UserInterfaceLcdNormalStartTime(menuSetTime_t ucbut)
Write LCD display "NmSZt".
menuSetTime_t
Enum used for Menus where Hour and Minute of a time value are modified.
"Zurck" | Zurueck
void lcd_puts_P(const char *s)
Write a string from progmem of chars to the LCD.
Definition: lcd.c:192
Subroutines for UserInterfaceLcd.
menuNormalClock_t
Enum used for Normal Clock Menu.
"Minte" | Minute einstellen
void UserInterfaceLcdNormalTargetTimeSet(uint8_t ucminute, uint8_t uchour)
Write LCD display "NmZZt".
uint8_t ClockReadEndTimeHour(void)
Get the hour of the end time.
Definition: ClockKernel.c:446
uint8_t hour
hour value 0..23
Definition: ClockKernel.h:70
LCD interface header file.
"Stnde" | Stunde einstellen
void UserInterfaceLcdNormalQuickClock(menuFastFwd_t ucbut, menuNormalClock_t ucbut1, uint8_t ucminute, uint8_t uchour)
Write LCD display in Normal Mode ("SvSrt" or "SvNul").
void UserInterfaceLcdNormalClock(menuNormalClock_t ucbut)
Write LCD display in Normal Mode ("NmUhr").
static void UserInterfaceLcdNormalTime(const char *which, menuSetTime_t button, uint8_t hour, uint8_t minute)
Write LCD: TODO: more details.
"Stop " | Uhr Stoppen
uint8_t ClockReadStartTimeHour(void)
Get the hour of the start time.
Definition: ClockKernel.c:398
uint8_t ClockReadStartTimeMinute(void)
Get the minute of the start time.
Definition: ClockKernel.c:374
static void UserInterfaceLcdNormalTimeSet(const char *which, uint8_t minute, uint8_t hour)
Write LCD: TODO: more details.
User function called by timer ISR.
"Start" | Uhr Start
void UserInterfaceLcdWriteTimeFactor(uint8_t ucfactor)
Write time factor to lcd.
static void UserInterfaceLcdNormalSwitch(menuNormalClock_t button)
Write LCD display sub menu: "Start", "Stop", "Zurck".
fclock_t ClockGetTime(void)
Get actual time.
Definition: ClockKernel.c:317
"SvNul" | Schneller Vorlauf bis 00:00
"Zurck" | Zurueck