Ejemplo n.º 1
0
/**
 * @brief: Main program.
 */
int main() {

	prvSetupHardware();

	// While usually dynamic memory is not a good practice in an embedded program,
	// this task is allocated on the heap only to test if the low level layer works fine.
	// (linker script and runtime support)
	g_pLed1Task = new CHelloWorld(GPIOD, GPIO_Pin_13, 2000);
	g_pLed1Task->Create("Led1", configMINIMAL_STACK_SIZE, mainFLASH_TASK_PRIORITY);

	g_Led2Task.Create("Led2", configMINIMAL_STACK_SIZE, 0);//mainFLASH_TASK_PRIORITY);
	g_HeapTestTask.Create("HT", configMINIMAL_STACK_SIZE, 3);
	g_HeapTestMonitorTask.Create("HTM", 3*configMINIMAL_STACK_SIZE, 5);


	// Static task object
	static CHelloWorld led3Task(GPIOD, GPIO_Pin_3 | GPIO_Pin_4, 3000);
	led3Task.Create("Led3", configMINIMAL_STACK_SIZE, mainFLASH_TASK_PRIORITY);

	CSharedResourceEditor::StartGuardTestClass();
	g_MessageTestTask.Create("msg_test", configMINIMAL_STACK_SIZE*2, 4);
	static CMessageProducerTask s_MessageProduceTask(&g_MessageTestTask);
	s_MessageProduceTask.Create("msg_prod", configMINIMAL_STACK_SIZE*2, 3);

	g_checkTask.Create("Check", configMINIMAL_STACK_SIZE, configMAX_PRIORITIES-1);
	ABlockQ::StartBlockingQueueTasks(&g_checkTask, mainBLOCK_Q_PRIORITY);
	CInteger::StartIntegerMathTasks(&g_checkTask, mainINTEGER_TASK_PRIORITY);
	APollQ::StartPolledQueueTasks(&g_checkTask, mainQUEUE_POLL_PRIORITY);
	CSemTest::StartSemTestTasks(&g_checkTask, mainSEM_TEST_PRIORITY);

	static CTimerTestTask s_timerTask;
	s_timerTask.Create("timer_t", configMINIMAL_STACK_SIZE*2, mainTIMER_TEST_PRIORITY);


	CFreeRTOS::InitHardwareForManagedTasks();
	CFreeRTOS::StartScheduler();

    while(1);

    return 0;
}
  int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow)
  {
     CPaintManagerUI::SetInstance(hInstance);    // 将程序实例与皮肤绘制管理器挂钩
     // 设置皮肤库的资源路径,资源有图片、xml文件等
     CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + TEXT("skin"));
 
     HRESULT Hr = ::CoInitialize(NULL);
     if( FAILED(Hr) ) return 0;
 
     CHelloWorld* pHW = new CHelloWorld();
     if (pHW == NULL)
         return 0;
     pHW->Create(NULL, TEXT("Hello World"), UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE | WS_EX_APPWINDOW);
    // pHW->SetIcon(IDI_HW);
     pHW->CenterWindow();
     pHW->ShowWindow();
     CPaintManagerUI::MessageLoop();
 
     ::CoUninitialize();
     return 0;
 }