Beispiel #1
0
int main(void)
{
#ifndef  AVRGCC
   Wdt_off();
#else
   wdt_reset();
   Wdt_clear_flag();
   Wdt_change_enable();
   Wdt_stop();
#endif
   Clear_prescaler();
   scheduler();
   return 0;
}
/* ------------------------------------------------------------------ */
int main (void)
{
	uint8_t state = ST_TOP_MENU;
	uint8_t nextstate = ST_TOP_MENU;
	uint8_t key = KEY_NONE;
	func_p pStateFunc = states[state];
	
	
	/* disable watchdog */
	wdt_reset();
	Wdt_clear_flag();
	Wdt_change_enable();
	Wdt_stop();
		
	Clear_prescaler();
	InitLED();
	Led1On();
	
	Timer0_Init();
	SPEAKER_Init();
	BUTTON_Init();
	LCD_Init();
	
	sei();
	
	while (1)
	{
		key = BUTTON_GetKey();
		nextstate = pStateFunc(key);
		
		if (nextstate != state) {
			pStateFunc = states[nextstate];
			state = nextstate;
		}
		
	} /* end of while(1) */
	return 0;
}