#include <stdio.h>
#include <stdint.h>
#include "sumd.h"
Go to the source code of this file.
◆ SUMD_HEADER_ID
| #define SUMD_HEADER_ID 0xA8 |
◆ SUMD_HEADER_LENGTH
| #define SUMD_HEADER_LENGTH 3 |
◆ SUMD_ID_FAILSAFE
| #define SUMD_ID_FAILSAFE 0x81 |
◆ SUMD_ID_SUMD
| #define SUMD_ID_SUMD 0x01 |
◆ SUMD_ID_SUMH
| #define SUMD_ID_SUMH 0x00 |
◆ SUMD_MAX_CHANNELS
| #define SUMD_MAX_CHANNELS 32 |
◆ SUMD_RANGE_MAX
| #define SUMD_RANGE_MAX 4096.0f |
◆ SUMD_RANGE_MIN
| #define SUMD_RANGE_MIN 0.0f |
◆ SUMD_SCALE_FACTOR
◆ SUMD_SCALE_OFFSET
◆ SUMD_TARGET_MAX
| #define SUMD_TARGET_MAX 2000.0f |
◆ SUMD_TARGET_MIN
| #define SUMD_TARGET_MIN 1000.0f |
◆ SUMD_DECODE_STATE
| Enumerator |
|---|
| SUMD_DECODE_STATE_UNSYNCED | |
| SUMD_DECODE_STATE_GOT_HEADER | |
| SUMD_DECODE_STATE_GOT_STATE | |
| SUMD_DECODE_STATE_GOT_LEN | |
| SUMD_DECODE_STATE_GOT_DATA | |
| SUMD_DECODE_STATE_GOT_CRC | |
| SUMD_DECODE_STATE_GOT_CRC16_BYTE_1 | |
| SUMD_DECODE_STATE_GOT_CRC16_BYTE_2 | |
Definition at line 72 of file sumd.cpp.
◆ sumd_crc16()
| static uint16_t sumd_crc16 |
( |
uint16_t |
crc, |
|
|
uint8_t |
value |
|
) |
| |
|
static |
◆ sumd_crc8()
| static uint8_t sumd_crc8 |
( |
uint8_t |
crc, |
|
|
uint8_t |
value |
|
) |
| |
|
static |
◆ 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 |
|
) |
| |
Decoder for SUMD/SUMH protocol
- Parameters
-
| 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 |
- Returns
- 0 for success (a decoded packet), 1 for no packet yet (accumulating), 2 for unknown packet, 3 for out of sync, 4 for checksum error
Definition at line 137 of file sumd.cpp.
Referenced by F4Light::PPM_parser::_process_dsm_pulse(), Linux::RCInput::add_sumd_input(), and F4Light::DSM_parser::init().
◆ _crc16
◆ _crc8
◆ _crcOK
◆ _debug
◆ _decode_state
◆ _rxlen
◆ _rxpacket
◆ _sumd