void BSP_ToggleLED(int Index) {
    if (_LEDPORT_STATE & (1 << (19 + Index))) {  /* LED is switched off */
        BSP_SetLED(Index);
    } else {
        BSP_ClrLED(Index);
    }
}
Beispiel #2
0
void MainTask(void) {
  BSP_ClrLED(0);
  BSP_ClrLED(1);
  BSP_ClrLED(2);
  IP_Init();
  OS_SetPriority(OS_GetTaskID(), 255);
  OS_CREATETASK(&_TCBIP       , "IP_Task"  , IP_Task  , 150, _StackIP);
#if USE_RX_TASK
  OS_CREATETASK(&_TCBIPRx     , "IP_RxTask", IP_RxTask, 250, _StackIPRx);
#endif
  OS_CREATETASK_EX(&_TCBClient, "Client"   ,  _Client , 100, _StackClient, NULL);
  while (1) {
    BSP_ToggleLED(2);
    OS_Delay (200);
  }
}
Beispiel #3
0
void BSP_ToggleLED(int Index) {
  if (Index >= NUM_LEDS) {
    return;
  }
  if (LPC_GPIO2->PIN & (1 << (LED0_BIT + Index))) {  // Active low
    BSP_SetLED(Index);
  } else {
    BSP_ClrLED(Index);
  }
}
Beispiel #4
0
/*********************************************************************
*
*       LPTask
*/
static void LPTask(void) {
  while (1) {
    OS_Delay(100);     // Syncronize to tick to avoid jitter
    //
    // Display measurement overhead
    //
    BSP_SetLED(0);
    BSP_ClrLED(0);
    //
    // Perform measurement
    //
    BSP_SetLED(0);     // Start measurement
    OS_Resume(&TCBHP); // Resume high priority task to force task switch
  }
}
void MainTask(void) {
  OS_CREATETASK(&TCBHP, "HP Task", HPTask, 150, StackHP);
  OS_Delay(1);
  while (1) {
    OS_Delay(100);     // Syncronize to tick to avoid jitter
    //
    // Display measurement overhead
    //
    BSP_SetLED(0);
    BSP_ClrLED(0);
    //
    // Perform measurement
    //
    BSP_SetLED(0);     // Start measurement
    OS_Resume(&TCBHP); // Resume high priority task to force task switch
  }
}
Beispiel #6
0
/*********************************************************************
*
*       _USBTask
*/
static void _USBTask(void) {
  while(1) {
    //
    // Loop: Receive data byte by byte, send back (data + 1)
    //
    while (1) {
      char c;

      while ((USB_GetState() & (USB_STAT_CONFIGURED | USB_STAT_SUSPENDED)) != USB_STAT_CONFIGURED) {
        BSP_ToggleLED(0);
        USB_OS_Delay(50);
      }
      BSP_SetLED(0);         // LED on to indicate we are waiting for data
      USB_BULK_Read(&c, 1);
      BSP_ClrLED(0);
      c++;
      USB_BULK_Write(&c, 1);
    }
  }
}
/*********************************************************************
*
*       HPTask
*/
static void HPTask(void) {
  while (1) {
    OS_Suspend(NULL);   // Suspend high priority task
    BSP_ClrLED(0);      // Stop measurement
  }
}