2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 // expresslrs packet header types
22 // 00 -> standard 4 channel data packet
23 // 01 -> switch data packet
25 // 10 -> sync packet with hop data
27 ELRS_RC_DATA_PACKET
= 0x00,
28 ELRS_MSP_DATA_PACKET
= 0x01,
29 ELRS_SYNC_PACKET
= 0x02,
30 ELRS_TLM_PACKET
= 0x03,
43 ELRS_DISCONNECT_PENDING
// used on modelmatch change to drop the connection
47 ELRS_TIM_DISCONNECTED
= 0,
48 ELRS_TIM_TENTATIVE
= 1,
52 typedef struct elrsReceiver_s
{
60 volatile uint8_t nonceRX
; // nonce that we THINK we are up to.
62 elrsModSettings_t
*modParams
;
63 elrsRfPerfParams_t
*rfPerfParams
;
77 timerState_e timerState
;
78 connectionState_e connectionState
;
80 uint8_t rfModeCycleMultiplier
;
81 uint16_t cycleIntervalMs
;
82 uint32_t rfModeCycledAtMs
;
84 uint8_t nextRateIndex
;
86 uint32_t gotConnectionMs
;
87 uint32_t lastSyncPacketMs
;
88 uint32_t lastValidPacketMs
;
90 uint32_t configCheckedAtMs
;
94 volatile bool fhssRequired
;
96 uint32_t statsUpdatedAtMs
;
99 elrsRxConfigFnPtr config
;
100 elrsRxStartReceivingFnPtr startReceiving
;
101 elrsRxISRFnPtr rxISR
;
102 elrsRxTransmitDataFnPtr transmitData
;
103 elrsRxReceiveDataFnPtr receiveData
;
104 elrsRxGetRFlinkInfoFnPtr getRFlinkInfo
;
105 elrsRxSetFrequencyFnPtr setFrequency
;
106 elrsRxHandleFreqCorrectionFnPtr handleFreqCorrection
;
108 timerOvrHandlerRec_t timerUpdateCb
;