/*! * This function is used to send fix payload length packet. * * @return TRUE - Started a packet TX / FALSE - No packet sent. */ uint8_t vSampleCode_SendFixPacket(void) { uint8_t boPbPushTrack; uint16_t woPbPushTime; gHmi_PbIsPushed(&boPbPushTrack, &woPbPushTime); if (eHmi_PbNo_c == boPbPushTrack) { return FALSE; } vRadio_StartTx(pRadioConfiguration->Radio_ChannelNumber, (uint8_t *) &pRadioConfiguration->Radio_CustomPayload[0u]); /* Packet sending initialized */ return TRUE; }
/*! * 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); } } }
/** * Sample Code Demo application poll handler. * * * @note Must be called periodically. * *****************************************************************************/ void SampleCode_Demo_Pollhandler() { SEGMENT_VARIABLE(boPbPushTrack, U8, SEG_DATA); SEGMENT_VARIABLE(woPbPushTime, U16, SEG_DATA); /* Transmitter Demo state machine */ switch (SampleCode_Demo_InternalData.SampleCode_Demo_State) { case SM_START: /* Check RF picoboard EBID*/ /* Shutdown the Si4012 */ Si4012_Shutdown(); /* Check RF Pico board EBID */ if (EBID_CheckAvailability() == TRUE) { if (EBID_SearchRadioRecord() != FALSE) { /* EBIDInfo filled */ if ( (EBIDInfo.EBID_Freqband & (1u << 9u)) || (EBIDInfo.EBID_Freqband & (1u << 4u)) ) { /* Use the default settings */ pSi4012_Config_Array = pSi4012_Config_Array_Default; } else { /* Waiting for Reset */ ERROR_HOOK; } SampleCode_Demo_InternalData.SampleCode_Demo_State = SM_STEP1; break; } } /* Waiting for Reset */ ERROR_HOOK; break; case SM_STEP1: /* RF Pico Board detected */ if(TRUE == Si4012_Configure()); { /* LED4 always on */ vHmi_ChangeLedState(eHmi_Led4_c, eHmi_LedOn_c); SampleCode_Demo_InternalData.SampleCode_Demo_State = SM_STEP2; break; } /* Waiting for Reset */ ERROR_HOOK; break; case SM_STEP2: /* Check which button pushed*/ gHmi_PbIsPushed(&boPbPushTrack, &woPbPushTime); /* If Button1 pushed */ if(boPbPushTrack & eHmi_Pb1_c) { /* LED1 turned on*/ vHmi_ChangeLedState(eHmi_Led1_c, eHmi_LedBlinkOnce_c); /* Send packet 3 times */ Si4012_SendPacket(eHmi_Pb1_c); Si4012_SendPacket(eHmi_Pb1_c); Si4012_SendPacket(eHmi_Pb1_c); } /* If Button2 pushed */ if(boPbPushTrack & eHmi_Pb2_c) { /* LED2 turned on*/ vHmi_ChangeLedState(eHmi_Led2_c, eHmi_LedBlinkOnce_c); /* Send packet 3 times */ Si4012_SendPacket(eHmi_Pb2_c); Si4012_SendPacket(eHmi_Pb2_c); Si4012_SendPacket(eHmi_Pb2_c); } /* If Button3 pushed */ if(boPbPushTrack & eHmi_Pb3_c) { /* LED3 turned on */ vHmi_ChangeLedState(eHmi_Led3_c, eHmi_LedBlinkOnce_c); /* Send packet 3 times */ Si4012_SendPacket(eHmi_Pb3_c); Si4012_SendPacket(eHmi_Pb3_c); Si4012_SendPacket(eHmi_Pb3_c); } SampleCode_Demo_InternalData.SampleCode_Demo_State = SM_STEP2; break; } }