コード例 #1
0
    /*!
     * This function is used to show the actual state of the push-buttons on the Buzzer.
     *
     * @return  None.
     */
    void vSampleCode_ShowPbOnBuzzer(void)
    {
      uint8_t boPbPushTrack;
      uint16_t woPbPushTime;
      uint8_t bPbLedCnt;

      gHmi_PbIsPushed(&boPbPushTrack, &woPbPushTime);

      for (bPbLedCnt = 1; bPbLedCnt <= 4; bPbLedCnt++)
      {
        if (boPbPushTrack)
        {
          vHmi_ChangeBuzzState(eHmi_BuzzOnce_c);
        }
        else
        {
          vHmi_ChangeBuzzState(eHmi_BuzzOff_c);
        }
      }
    }
コード例 #2
0
ファイル: main.c プロジェクト: x893/WDS
/**
 *  Demo Application Poll-Handler
 *
 *  @note This function must be called periodically.
 *
 */
void DemoApp_Pollhandler()
{
  U8 lButton = 0xFF;

  // 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;
    }
  }

  if (lButton && (lButton < 0x05))
  {
    vHmi_ChangeLedState(lButton, eHmi_LedBlinkOnce_c);
  }
  else
  {
    vHmi_ChangeLedState(eHmi_Led1_c, eHmi_LedBlinkOnce_c);
    vHmi_ChangeLedState(eHmi_Led4_c, eHmi_LedBlinkOnce_c);
  }
}
コード例 #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;
    }
  }
}