예제 #1
0
파일: main.c 프로젝트: ckt1010/Robin
/** \fn void main(void)
 * \brief The main function of the demo.
 *
 * \todo Create description
 */
void main(void)
{
  xdata U8 buf[] = {0x7E,0x05,0x01, 0x02, 0x03, 0x7D, 0x5D, 0x00, 0x83, 0x7E};
  U16 i=65536;
  // Initialize the Hardware and Radio
  vInitializeHW();

  // Start RX
  vRadio_StartRX(pRadioConfiguration->Radio_ChannelNumber);
  while (TRUE)
  {

	Uart_revc_Radio_trans();

    if(gRadio_CheckReceived())
	{
		if(Uart_trans_Radio_recv()==0)
		//if(LED)
		//LED = ILLUMINATE;
		//else
		LED ^= EXTINGUISH;
	}
//	Uart_trans_Radio_recv_test(buf);
  }
}
예제 #2
0
파일: radio.c 프로젝트: Ryoma521/ChlTest
/**
 *  Demo Application Poll-Handler-TX
 *
 *  @note This function must be called periodically.
 *
 */
void DemoApp_Pollhandler_RX()
{
  // Check if radio packet received
  if (TRUE == gRadio_CheckReceived())
  {
      
  }    
}
예제 #3
0
파일: main.c 프로젝트: x893/WDS
/**
 *  Demo Application Poll-Handler
 *
 *  @note This function must be called periodically.
 *
 */
void DemoApp_Pollhandler()
{
  U8 lButton = 0xFF;

  // Check if radio packet received
  if (TRUE == gRadio_CheckReceived())
  {
    // Check if the radio packet contains "BUTTON" string
    if (gSampleCode_StringCompare((U8 *) &fixRadioPacket[0u], "BUTTON", 6u) == TRUE)
    {
      // Search for button index number (from '1' to '4')
      lButton = fixRadioPacket[6u] - 0x30;

      vHmi_ChangeBuzzState(eHmi_BuzzOnce_c);
    }
    else if (fixRadioPacket[0u] == fixRadioPacket[2u])
    {
      /* Packet sent by old Keyfob */

      switch (fixRadioPacket[0u])
      {
        case 0xD7:
          lButton = 0x01;
          break;

        case 0xF5:
          lButton = 0x02;
          break;

        case 0x5F:
          lButton = 0x03;
          break;

        case 0x7D:
          lButton = 0x04;
          break;

        default:
          break;
      }
    }
    else
    {
      /* Packet sent by new Keyfob */

      if (fixRadioPacket[4u] & (1u << 0u))
      {
        lButton = 0x01;
      }
      else if (fixRadioPacket[4u] & (1u << 1u))
      {
        lButton = 0x02;
      }
      else if (fixRadioPacket[4u] & (1u << 2u))
      {
        lButton = 0x03;
      }
      else if (fixRadioPacket[4u] & (1u << 3u))
      {
        lButton = 0x04;
      }
    }

    switch (lButton)
    {
    /* Show the button number in BCD form on LEDs */
    case 0x01:
      vHmi_ChangeLedState(eHmi_Led2_c, eHmi_LedBlinkOnce_c);
      break;

    case 0x02:
      vHmi_ChangeLedState(eHmi_Led3_c, eHmi_LedBlinkOnce_c);
      break;

    case 0x03:
      vHmi_ChangeLedState(eHmi_Led2_c, eHmi_LedBlinkOnce_c);
      vHmi_ChangeLedState(eHmi_Led3_c, eHmi_LedBlinkOnce_c);
      break;

    case 0x04:
      vHmi_ChangeLedState(eHmi_Led4_c, eHmi_LedBlinkOnce_c);
      break;

    default:
      /* Wrong number */
      vHmi_ChangeLedState(eHmi_Led2_c, eHmi_LedBlinkOnce_c);
      vHmi_ChangeLedState(eHmi_Led3_c, eHmi_LedBlinkOnce_c);
      vHmi_ChangeLedState(eHmi_Led4_c, eHmi_LedBlinkOnce_c);
      break;
    }
  }
}