コード例 #1
0
ファイル: clock_drawer.c プロジェクト: changshuo/cs452
void clockDrawer() {
    int t = Time();
    while(1) {
        draw(t);
        t += 10; // 10 ticks is 1 ms
        DelayUntil(t);
    }
}
コード例 #2
0
ファイル: term.c プロジェクト: mdbaker60/CS452_Kernel
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));
  }
}
コード例 #3
0
ファイル: term.c プロジェクト: mdbaker60/CS452_Kernel
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());
}
コード例 #4
0
ファイル: CHelloWorld.cpp プロジェクト: dessel/stf12
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;
	}

}
コード例 #5
0
ファイル: term.c プロジェクト: mdbaker60/CS452_Kernel
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);
  }
}
コード例 #6
0
ファイル: CCheckTask.cpp プロジェクト: dessel/stf12
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);
	}
}