PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Go to the source code of this file.
Macros | |
#define | SUMD_RANGE_MIN 0.0f |
#define | SUMD_RANGE_MAX 4096.0f |
#define | SUMD_TARGET_MIN 1000.0f |
#define | SUMD_TARGET_MAX 2000.0f |
#define | SUMD_SCALE_FACTOR ((SUMD_TARGET_MAX - SUMD_TARGET_MIN) / (SUMD_RANGE_MAX - SUMD_RANGE_MIN)) |
#define | SUMD_SCALE_OFFSET (int)(SUMD_TARGET_MIN - (SUMD_SCALE_FACTOR * SUMD_RANGE_MIN + 0.5f)) |
Functions | |
uint16_t | sumd_crc16 (uint16_t crc, uint8_t value) |
CRC16 implementation for SUMD protocol. More... | |
uint8_t | sumd_crc8 (uint8_t crc, uint8_t value) |
CRC8 implementation for SUMH protocol. More... | |
int | sumd_decode (uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channel_count, uint16_t *channels, uint16_t max_chan_count, bool *failsafe) |
Decoder for SUMD/SUMH protocol. More... | |
Variables | |
uint8_t | _crc8 = 0x00 |
uint16_t | _crc16 = 0x0000 |
bool | _sumd = true |
bool | _crcOK = false |
bool | _debug = false |
static enum SUMD_DECODE_STATE | _decode_state = SUMD_DECODE_STATE_UNSYNCED |
static uint8_t | _rxlen |
static ReceiverFcPacketHoTT & | _rxpacket = rc_decode_buf._hottrxpacket |
#define SUMD_SCALE_FACTOR ((SUMD_TARGET_MAX - SUMD_TARGET_MIN) / (SUMD_RANGE_MAX - SUMD_RANGE_MIN)) |
#define SUMD_SCALE_OFFSET (int)(SUMD_TARGET_MIN - (SUMD_SCALE_FACTOR * SUMD_RANGE_MIN + 0.5f)) |
enum SUMD_DECODE_STATE |
uint16_t sumd_crc16 | ( | uint16_t | crc, |
uint8_t | value | ||
) |
CRC16 implementation for SUMD protocol.
crc | Initial CRC Value |
value | to accumulate in the checksum |
Definition at line 93 of file sumd.cpp.
Referenced by sumd_decode().
uint8_t sumd_crc8 | ( | uint8_t | crc, |
uint8_t | value | ||
) |
CRC8 implementation for SUMH protocol.
crc | Initial CRC Value |
value | to accumulate in the checksum |
Definition at line 105 of file sumd.cpp.
Referenced by sumd_decode().
int sumd_decode | ( | uint8_t | byte, |
uint8_t * | rssi, | ||
uint8_t * | rx_count, | ||
uint16_t * | channel_count, | ||
uint16_t * | channels, | ||
uint16_t | max_chan_count, | ||
bool * | failsafe | ||
) |
Decoder for SUMD/SUMH protocol.
byte | current char to read |
rssi | pointer to a byte where the RSSI value is written back to |
rx_count | pointer to a byte where the receive count of packets signce last wireless frame is written back to |
channels | pointer to a datastructure of size max_chan_count where channel values (12 bit) are written back to |
max_chan_count | maximum channels to decode - if more channels are decoded, the last n are skipped and success (0) is returned |
failsafe | pointer to a boolean where the decoded failsafe flag is written back to |
Definition at line 111 of file sumd.cpp.
References _crc16, _crc8, _crcOK, _debug, _decode_state, _rxlen, _sumd, ReceiverFcPacketHoTT::crc16_high, ReceiverFcPacketHoTT::crc16_low, ReceiverFcPacketHoTT::crc8, ReceiverFcPacketHoTT::header, ReceiverFcPacketHoTT::length, ReceiverFcPacketHoTT::status, sumd_crc16(), sumd_crc8(), ReceiverFcPacketHoTT::sumd_data, SUMD_DECODE_STATE_GOT_CRC, SUMD_DECODE_STATE_GOT_CRC16_BYTE_1, SUMD_DECODE_STATE_GOT_CRC16_BYTE_2, SUMD_DECODE_STATE_GOT_DATA, SUMD_DECODE_STATE_GOT_HEADER, SUMD_DECODE_STATE_GOT_LEN, SUMD_DECODE_STATE_GOT_STATE, SUMD_DECODE_STATE_UNSYNCED, SUMD_HEADER_ID, SUMD_ID_FAILSAFE, SUMD_ID_SUMD, SUMD_ID_SUMH, SUMD_MAX_CHANNELS, and ReceiverFcPacketHoTT::telemetry.
Referenced by RCInput::cycle(), dsm_port_input(), and RCTest::sumdTest().
uint16_t _crc16 = 0x0000 |
Definition at line 71 of file sumd.cpp.
Referenced by sumd_decode().
uint8_t _crc8 = 0x00 |
Definition at line 70 of file sumd.cpp.
Referenced by sumd_decode().
bool _crcOK = false |
Definition at line 73 of file sumd.cpp.
Referenced by sumd_decode().
bool _debug = false |
Definition at line 74 of file sumd.cpp.
Referenced by sumd_decode().
|
static |
Definition at line 88 of file sumd.cpp.
Referenced by sumd_decode().
|
static |
Definition at line 89 of file sumd.cpp.
Referenced by sumd_decode().
|
static |
bool _sumd = true |
Definition at line 72 of file sumd.cpp.
Referenced by sumd_decode().