Exemple #1
0
int main(void) {

	SystemInit();

	/*Initialize Erika related stuffs*/
	EE_system_init();

	/*Initialize systick */
	EE_systick_set_period(MILLISECONDS_TO_TICKS(1, SystemCoreClock));
	EE_systick_enable_int();
	EE_systick_start();

	console_init();

	stop = 0;
	calcRawSpeed();
	initState(kwips_rawspeed, initAlarms, initFreq, initKWPP);

	do
	{
		ch = readCharUSART();
	} while (ch != 't');



	ActivateTask(SuperTask);

	StartOS(OSDEFAULTAPPMODE);

	/* Forever loop: background activities (if any) should go here */
	for (;;) {
	}

}
/*
 * MAIN TASK
 */
int main(void)
{
	//GPIO_InitTypeDef GPIO_InitStructure;

	SystemInit();
	/*Initializes Erika related stuffs*/
	EE_system_init();

	SWatch_state.errorStatus = errorSig;
	SWatch_state.ModelData.prevZCSigState = &ZCSig;
	SWatch_state.ModelData.dwork = &DWork;

	/* init state machine */
	SWatch_initialize(&SWatch_state,
			&Bplus, &Bminus, &Btime, &Btimer, &Balarm, &Bswatch, &Bstart, &Bstop,
			&hours, &minutes, &seconds, &tenths, &mode, &alarm_signal, &timer_exp);

	/*Initialize systick */
	EE_systick_set_period(MILLISECONDS_TO_TICKS(1, SystemCoreClock));
	EE_systick_enable_int();
	EE_systick_start();

	/* Initializes LCD and touchscreen */
	IOE_Config();
	/* Initialize the LCD */
	STM32f4_Discovery_LCD_Init();

	//	LCD_Clear(White);

	/* Set the LCD Text size */
	//	LCD_SetFont(&Font8x12);
	//	Lcd_Touch_Calibration();
	InitTouch(-0.102, 0.0656, -335, 10);

	/* Draw the background */
	DrawInit(MyWatchScr);
	LCD_SetTextColor(Black);
	LCD_SetBackColor(Black);
	LCD_DrawFullRect(10, 80, 240, 56);
	WPrint(&MyWatchScr[SEP1STR], ":");
	WPrint(&MyWatchScr[SEP2STR], ":");


	/* Program cyclic alarms which will fire after an initial offset,
	 * and after that periodically
	 * */
	SetRelAlarm(AlarmTaskLCD, 10, 50);
	SetRelAlarm(AlarmTaskClock, 10, 100);

	/* Forever loop: background activities (if any) should go here */
	for (;;) { 
	}

}