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/>.
25 #define SBUS_MAX_CHANNEL 18
27 #define SBUS_FLAG_SIGNAL_LOSS (1 << 2)
28 #define SBUS_FLAG_FAILSAFE_ACTIVE (1 << 3)
30 typedef struct sbusChannels_s
{
31 // 176 bits of data (11 bits per channel * 16 channels) = 22 bytes.
32 unsigned int chan0
: 11;
33 unsigned int chan1
: 11;
34 unsigned int chan2
: 11;
35 unsigned int chan3
: 11;
36 unsigned int chan4
: 11;
37 unsigned int chan5
: 11;
38 unsigned int chan6
: 11;
39 unsigned int chan7
: 11;
40 unsigned int chan8
: 11;
41 unsigned int chan9
: 11;
42 unsigned int chan10
: 11;
43 unsigned int chan11
: 11;
44 unsigned int chan12
: 11;
45 unsigned int chan13
: 11;
46 unsigned int chan14
: 11;
47 unsigned int chan15
: 11;
49 } __attribute__((__packed__
)) sbusChannels_t
;
51 #define SBUS_CHANNEL_DATA_LENGTH sizeof(sbusChannels_t)
53 uint8_t sbusChannelsDecode(rxRuntimeState_t
*rxRuntimeState
, const sbusChannels_t
*channels
);
55 void sbusChannelsInit(const rxConfig_t
*rxConfig
, rxRuntimeState_t
*rxRuntimeState
);