2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
25 #include "build/build_config.h"
27 #include "common/utils.h"
32 static uint16_t channels
[MAX_SUPPORTED_RC_CHANNEL_COUNT
];
33 static bool hasNewData
= false;
34 static uint16_t rssi
= 0;
36 static uint16_t rxSimReadRawRC(const rxRuntimeConfig_t
*rxRuntimeConfigPtr
, uint8_t chan
) {
37 UNUSED(rxRuntimeConfigPtr
);
38 return channels
[chan
];
41 void rxSimSetChannelValue(uint16_t* values
, uint8_t count
) {
42 for (size_t i
= 0; i
< count
; i
++) {
43 channels
[i
] = values
[i
];
49 static uint8_t rxSimFrameStatus(rxRuntimeConfig_t
*rxRuntimeConfig
) {
50 UNUSED(rxRuntimeConfig
);
52 lqTrackerSet(rxRuntimeConfig
->lqTracker
, rssi
);
55 return RX_FRAME_PENDING
;
59 return RX_FRAME_COMPLETE
;
62 void rxSimInit(const rxConfig_t
*rxConfig
, rxRuntimeConfig_t
*rxRuntimeConfig
) {
65 rxRuntimeConfig
->channelCount
= MAX_SUPPORTED_RC_CHANNEL_COUNT
;
66 rxRuntimeConfig
->rxSignalTimeout
= DELAY_5_HZ
;
67 rxRuntimeConfig
->rcReadRawFn
= rxSimReadRawRC
;
68 rxRuntimeConfig
->rcFrameStatusFn
= rxSimFrameStatus
;
71 void rxSimSetRssi(uint16_t value
) {