예제 #1
0
void commInit(void)
{
  if (isInit)
    return;

#ifdef USE_ESKYLINK
  eskylinkInit();
#else
  /* radiolinkInit(); */
#endif

  crtpInit();

#ifdef USE_UART_CRTP
  crtpSetLink(uartGetLink());
#elif defined(USE_ESKYLINK)
  crtpSetLink(eskylinkGetLink());
#else
  crtpSetLink(radiolinkGetLink());
#endif

  crtpserviceInit();
  logInit();
  consoleInit();
  paramInit();

  //setup CRTP communication channel
  //TODO: check for USB first and prefer USB over radio
  //if (usbTest())
  //  crtpSetLink(usbGetLink);
  //else if(radioTest())
  //  crtpSetLink(radioGetLink());

  isInit = true;
}
예제 #2
0
static uint8_t usbd_cf_Setup(void *pdev , USB_SETUP_REQ  *req)
{
  command = req->wIndex;
  if (command == 0x01) {
    crtpSetLink(usblinkGetLink());
  } else {
    crtpSetLink(radiolinkGetLink());
  }

  return USBD_OK;
}
예제 #3
0
/**
* @brief  USBD_USR_DeviceDisonnected
* @param  None
* @retval Staus
*/
void USBD_USR_DeviceDisconnected(void)
{
  crtpSetLink(radiolinkGetLink());
}
예제 #4
0
/**
* @brief  USBD_USR_DeviceSuspended
* @param  None
* @retval None
*/
void USBD_USR_DeviceSuspended(void)
{
  /* USB communication suspended (probably USB unplugged). Switch back to radiolink */
  crtpSetLink(radiolinkGetLink());
}