If RSSI Channel is set to Disabled when using S.Bus then generate RSS… (#5090)
[betaflight.git] / src / main / rx / sbus_channels.h
blob5252d41f00441a3cd3b1efc04724ae48edc2418e
1 /*
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/>.
18 #pragma once
20 #include <stdint.h>
22 #define SBUS_MAX_CHANNEL 18
24 #define SBUS_FLAG_SIGNAL_LOSS (1 << 2)
25 #define SBUS_FLAG_FAILSAFE_ACTIVE (1 << 3)
27 typedef struct sbusChannels_s {
28 // 176 bits of data (11 bits per channel * 16 channels) = 22 bytes.
29 unsigned int chan0 : 11;
30 unsigned int chan1 : 11;
31 unsigned int chan2 : 11;
32 unsigned int chan3 : 11;
33 unsigned int chan4 : 11;
34 unsigned int chan5 : 11;
35 unsigned int chan6 : 11;
36 unsigned int chan7 : 11;
37 unsigned int chan8 : 11;
38 unsigned int chan9 : 11;
39 unsigned int chan10 : 11;
40 unsigned int chan11 : 11;
41 unsigned int chan12 : 11;
42 unsigned int chan13 : 11;
43 unsigned int chan14 : 11;
44 unsigned int chan15 : 11;
45 uint8_t flags;
46 } __attribute__((__packed__)) sbusChannels_t;
48 #define SBUS_CHANNEL_DATA_LENGTH sizeof(sbusChannels_t)
50 uint8_t sbusChannelsDecode(rxRuntimeConfig_t *rxRuntimeConfig, const sbusChannels_t *channels);
52 void sbusChannelsInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig);