fremoclock  1_3A01
FREMO Clock - Software for UTG
main.c
Go to the documentation of this file.
1 
24 /*
25  Copyright (C) 2006 Bernd Wisotzki
26 
27  This library is free software; you can redistribute it and/or
28  modify it under the terms of the GNU Lesser General Public
29  License as published by the Free Software Foundation; either
30  version 2.1 of the License, or (at your option) any later version.
31 
32  This library is distributed in the hope that it will be useful,
33  but WITHOUT ANY WARRANTY; without even the implied warranty of
34  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35  Lesser General Public License for more details.
36 
37  You should have received a copy of the GNU Lesser General Public
38  License along with this library; if not, write to the Free Software
39  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 */
41 
42 #include <avr/interrupt.h> // sei() interrupt enable flag
43 #include "SysHwTimer.h" // HwTimerInit()
44 #include "UserInterfaceMenu.h" // typedef menuResult_t
45  // UserInterfaceBasicInit(),
46  // UserInterfaceMenuEndOfSoap(),
47  // UserInterfaceMenuNormal(),
48  // UserInterfaceMenuProg
49  // UserInterfaceMenuShutdown(),
50  // UserInterfaceMenuStartup(),
51  // UserInterfaceMenuWelcome(),
52  // UserInterfaceMenuWelcome()
53 
54 // suppress gcc warning: "return type of 'main' is not 'int'"
55 #pragma GCC diagnostic ignored "-Wmain"
56 
66 void main(void)
67 {
68  // local variables
69  menuResult_t ucMenuShutdownResult;
70  menuResult_t ucMenuResult;
71 
72  // initialize basic functions of megaxxx
74 
75  // Init system timer and enable interrupts.
76  HwTimerInit();
77  sei();
78 
79  // Welcome message
81 
82  // Startup of application
83  ucMenuResult = UserInterfaceMenuStartup(); // NORMAL or PROG
84 
85  // now starting normal operation
86  do // until shutdown completed
87  {
88  do // until shutdown
89  {
90  if (ucMenuResult == MENU_RES_PROG)
91  {
92  ucMenuResult = UserInterfaceMenuProg(); // NORMAL or SHUTDOWN
93  }
94  else //(ucMenuResult == MENU_RES_NORMAL)
95  {
96  ucMenuResult = UserInterfaceMenuNormal(); // PROG or SHUTDOWN
97  }
98  } while ( (ucMenuResult == MENU_RES_NORMAL)
99  || (ucMenuResult == MENU_RES_PROG) );
100  // shutdown of application
101  ucMenuShutdownResult = UserInterfaceMenuShutdown(); // BACK or SHUTDOWN
102  } while (ucMenuShutdownResult == MENU_RES_BACK);
103 
105  // normal termination will result in interrupts disabled and endless loop
106 }
menuResult_t UserInterfaceMenuStartup(void)
Display Startup Menu ("Init") and initialize from EEPROM.
Subroutines for UserInterfaceMenu.
User has selected "Norml" in sub menu.
void UserInterfaceMenuEndOfSoap(void)
Shutdown, write to EEPROM and display EndOfSoap.
menuResult_t UserInterfaceMenuShutdown(void)
Prepare shutdown.
menuResult_t UserInterfaceMenuNormal(void)
Normal operation.
menuResult_t
Enum used for return values from sub menus.
User has selected "Zurck" in sub menu.
void UserInterfaceMenuWelcome(void)
Send a welcome message to LCD.
User has selected "Progr" in sub menu.
Hardware dependent timer module for Atmel AVR.
menuResult_t UserInterfaceMenuProg(void)
Display Programming Menu ("Progr").
void UserInterfaceBasicInit(void)
Init all the basic HW and.
void main(void)
Entry point of the application.
Definition: main.c:66
void HwTimerInit(void)
Initialize the hardware time.
Definition: SysHwTimer.c:115