예제 #1
0
파일: main.c 프로젝트: Gewin/Ucos
void Task1(void *pdata)				//任务1,控制LED灯亮,开启蜂鸣器同时鸣叫
{
	U16 task1Cnt=0;

	if(user_task1_firstboot == 1)
	{
		// RTC初始化
		Rtc_Init();

		user_task1_firstboot = 0;
	}

	while (1)
	{
		task1Cnt++;
		OSPrintf("\nEnter Task1\n");
		OSPrintf("uC/OS Version:V%4.2f\n",(float)OSVersion()*0.01);//打印uC/OS的版本号 

		//实现流水灯
		if((task1Cnt%5) == 0)
			rGPBDAT = 0x1E0;				//全灭
		else
			rGPBDAT = rGPBDAT - (0x10<<(task1Cnt%5));	//流水灯
#if 0
		//蜂鸣器鸣叫
		Beep(3000, 60);
		Beep(2500, 60);
		Beep(2000, 60);
		Beep(1500, 60);
		Beep(1000, 60);
		Beep(900, 60);
#endif		
		OSTimeDly(OS_TICKS_PER_SEC*5);
	}
}
예제 #2
0
void HardwareSetup(void)
{
   ConfigureOperatingFrequency();
   ConfigureOutputPorts();
   Switch_Init();
   Rtc_Init();
   Wdt_Init();
}
예제 #3
0
파일: main.c 프로젝트: Balu1991/Wifly_Light
void main(void)
{
#else
int g_start_gl = 1;
int main(int argc, const char** argv)
{
	if ((argc > 1) && (argv[1][0] == 'h'))
		g_start_gl = 0;
#endif
	/* softReset() on x86 will jump here! */
	softResetJumpDestination();

	InitAll();

	while(1)
	{
		Timer_StartStopwatch(eMAIN);
#ifndef __CC8E__
		// give opengl thread a chance to run
		usleep(10);
#endif /* #ifndef __CC8E__ */



			do_and_measure(Platform_CheckInputs);

			do_and_measure(Error_Throw);

			do_and_measure(CommandIO_GetCommands);

		if(g_UpdateLedStrip > 0) {
			do_and_measure(Ledstrip_UpdateLed);
			Timer1Enable();
			g_UpdateLedStrip = 0;
		}
		Timer_StopStopwatch(eMAIN);

			do_and_measure(ScriptCtrl_Run);

		if(g_UpdateLed > 0) {
			do_and_measure(Ledstrip_DoFade);

			Timer5InterruptLock();
			g_UpdateLed = 0;
			Timer5InterruptUnlock();

		}
	}
}
//*********************** UNTERPROGRAMME **********************************************

void InitAll()
{
	clearRAM();
	Trace_Init();
	Platform_OsciInit();
	Platform_IOInit();
	RingBuf_Init(&g_RingBuf);
	UART_Init();
	Timer_Init();
	Ledstrip_Init();
	CommandIO_Init();
	Rtc_Init();
	ScriptCtrl_Init();
	ExtEeprom_Init();
	
#ifndef __CC8E__
	init_x86(g_start_gl);
#endif /* #ifndef CC8E */

	Platform_AllowInterrupts();

	/* Startup Wait-Time 2s
	 * to protect Wifly-Modul from errors*/
	gScriptBuf.waitValue = 20;
	CommandIO_CreateResponse(&g_ResponseBuf, FW_STARTED, OK);
	CommandIO_SendResponse(&g_ResponseBuf);
	Trace_String(" Init Done ");
	Platform_DisableBootloaderAutostart();
}