Example #1
0
/***********************************************************************************
* @fn          halLedSet
*
* @brief       Turn LED on.
*
* @param       uint8 id - led to set
*
* @return      none
*/
void halLedSet(uint8 id)
{
    switch (id)
    {
    case 1: HAL_LED_SET_1(); break;
    case 2: HAL_LED_SET_2(); break;
    case 3: HAL_LED_SET_3(); break;
    case 4: HAL_LED_SET_4(); led4State=1; break;

    default: break;
    }
}
Example #2
0
// **************** Process USB class requests with OUT data phase *****************
void usbcrHookProcessOut(void)
{
   // Process USB class requests with OUT data phase, or stall endpoint 0 when unsupported
   if (usbSetupHeader.request == CDC_SET_CONTROL_LINE_STATE) {
       // Control line state from host
      if(usbfwData.ep0Status == EP_IDLE)
      {
        /*
         cdcRTS= usbSetupHeader.value;
        */
         /* RTS is set */
         if (usbSetupHeader.value)
         {
             HAL_LED_SET_2();          // Green LED
         }
         else
         {
             HAL_LED_SET_2();
             /* zb_stop_sniffer(); */
         }

         usbfwData.ep0Status = EP_RX;
      }


   } else if(usbSetupHeader.request == CDC_SET_LINE_CODING) {

      if(usbfwData.ep0Status == EP_IDLE)
      {
         usbSetupData.pBuffer = (uint8 __xdata *) &currentLineCoding;
         usbfwData.ep0Status = EP_RX;
      }
      else if(usbfwData.ep0Status == EP_RX) { }
   }
   // Unknown request?
   else {
      usbfwData.ep0Status = EP_STALL;
   }
}