/*------------------------------------------------------------------------------ * * FUNCTION DESCRIPTION: * This function contains the loop which consists of three procedures, * tx setup, tx loop and tx shutdown in the application. * During waiting for repeat transmission, check button state. * Once any new push button is detected, then transmit the new packet * instead of the current packet. * *------------------------------------------------------------------------------ */ void vRepeatTxLoop (void) { vFCast_Tune( fDesiredFreq ); if (rOdsSetup.bModulationType == bModFSK_c) { vFCast_FskAdj( bFskDev ); } // Wait until there is a temperature sample available while ( 0 == bDmdTs_GetSamplesTaken() ) { //wait } // Tune the PA with the temperature as an argument vPa_Tune( iDmdTs_GetLatestTemp()); vPacketAssemble(); //Convert whole frame before transmission vConvertPacket(rOdsSetup.bModulationType); vStl_PreLoop(); do { // get current timestamp lTimestamp = lSys_GetMasterTime(); //if part is burned to user or run mode if ((PROT0_CTRL & M_NVM_BLOWN) > 1) { //turn LED on GPIO_LED = 1; } while ( (lSys_GetMasterTime() - lTimestamp) < lLEDOnTime ) { //wait for LED ON time to expire } GPIO_LED = 0; //turn LED off //Transmit packet vStl_SingleTxLoop(pbFrameHead,bFrameSize); // Wait repeat interval. while ( (lSys_GetMasterTime() - lTimestamp) < wRepeatInterval_c ); }while(--bRepeatCount); vStl_PostLoop(); // Clear time value for next button push detecting. vSys_SetMasterTime(0); return; }
/*------------------------------------------------------------------------------ * * FUNCTION DESCRIPTION: * This function contains the loop which consists of three procedures, * tx setup, tx loop and tx shutdown in the application. * During waiting for repeat transmission, check button state. * Once any new push button is detected, then transmit the new packet * instead of the current packet. * *------------------------------------------------------------------------------ */ void vRtl_RepeatTxLoop(void) { // Repeat packet 8 times for each button packet transmission. bRepeatCount = bRepeatCount_c; do { // Setup the bandgap vSys_BandGapLdo( 1 ); // Save current timestamp for repeat transmission interval checking later. lTimestamp = lSys_GetMasterTime(); // Run at 433.92 MHz (frequency).Input is in [Hz]. // The function also calculates necessary data to be used by the single Tx loop // main function, vStl_SingleTxLoop(), for fine frequency correction during TX vFCast_Tune( fOperatingFrequency ); // bFskDeviation comes from the calculation spreadsheet. // vFCast_FskAdj( bFskDeviation ); // Now wait until there is a temperature value while ( 0 == bDmdTs_GetSamplesTaken() ){} // Tune the PA with the current temperature as an argument vPa_Tune( iDmdTs_GetLatestTemp()); // Sets up the temperature sensor and demodulator, // enable ODS before entering the single tx loop. vStl_PreLoop(); // Then assign the first address of the frame buffer to // the packet pointer used for transmission. pbRke_FrameHead = abButtonFrame; // call the single tx loop function vStl_SingleTxLoop(pbRke_FrameHead, bFrameSize_c); // Disable the temperature sensor and ODS vStl_PostLoop(); // Disable Bandgap and LDO vSys_BandGapLdo(0); //turn LED on GPIO_LED = 1; // Wait repeat interval. while ( (lSys_GetMasterTime() - lTimestamp) < wRepeatInterval ); //turn LED off GPIO_LED = 0; }while(--bRepeatCount); // After repeat transmission, clear all tasks flag. bAp_ButtonState = 0; // Clear time value for next button push detecting. vSys_SetMasterTime(0); return; }