void clockDrawer() { int t = Time(); while(1) { draw(t); t += 10; // 10 ticks is 1 ms DelayUntil(t); } }
void periodicTask() { int parent = MyParentTid(); int message = 0, reply; int base = Time(); while(true) { base += 10; //if this changes must also change value in updateProfile DelayUntil(base+10); Send(parent, (char *)&message, sizeof(int), (char *)&reply, sizeof(int)); } }
void delayTask() { int delayTicks, reply = 0, src; Receive(&src, (char *)&delayTicks, sizeof(int)); Reply(src, (char *)&reply, sizeof(int)); DelayUntil(delayTicks); Send(src, (char *)&delayTicks, sizeof(int), (char *)&reply, sizeof(int)); Destroy(MyTid()); }
void CHelloWorld::Run() { TickType_t xLastFlashTime; xLastFlashTime = GetTickCount(); for(;;) { /* Delay for half the flash period then turn the LED on. */ DelayUntil(&xLastFlashTime, m_nFlashRate); // HAL_GPIO_WritePin(m_pPort, m_pin, m_bState ? GPIO_PIN_SET : GPIO_PIN_RESET); HAL_GPIO_TogglePin(m_pPort, m_pin); m_bState = !m_bState; /* Delay for half the flash period then turn the LED off. */ DelayUntil(&xLastFlashTime, m_nFlashRate); // HAL_GPIO_WriteBit(m_pPort, m_pin, m_bState ? GPIO_PIN_SET : GPIO_PIN_RESET); HAL_GPIO_TogglePin(m_pPort, m_pin); m_bState = !m_bState; } }
void clockDriver() { int time = Time(), tenthSecs = 0, secs = 0, mins = 0; while(true) { time += 10; DelayUntil(time); tenthSecs++; if(tenthSecs == 10) { tenthSecs = 0; secs++; if(secs == 60) { secs = 0; mins++; } } printTime(mins, secs, tenthSecs); } }
void CCheckTask::Run() { const char *pcMsg; TickType_t xLastCheckTime; xLastCheckTime = GetTickCount(); for(;;) { DelayUntil(&xLastCheckTime, m_checkFrequency); ICommonDemoTask *pTask = m_pListCommonDemoTaskHead; while((pTask != NULL) && (pTask->IsStillRunning()) ) { pTask = pTask->m_pNext; } if (pTask != NULL) pcMsg = pTask->GetErrorMessage(); else pcMsg = "Status: PASS"; printf("%s\n", pcMsg); } }