APM:Libraries
|
Go to the source code of this file.
Macros | |
#define | DSM_FRAME_SIZE 16 |
#define | DSM_FRAME_CHANNELS 7 |
#define | debug(fmt, args...) do {} while(0) |
Functions | |
static bool | dsm_decode_channel (uint16_t raw, unsigned shift, unsigned *channel, unsigned *value) |
static void | dsm_guess_format (bool reset, const uint8_t dsm_frame[16]) |
bool | dsm_decode (uint64_t frame_time, const uint8_t dsm_frame[16], uint16_t *values, uint16_t *num_values, uint16_t max_values) |
Variables | |
static uint64_t | dsm_last_frame_time |
static unsigned | dsm_channel_shift |
#define debug | ( | fmt, | |
args... | |||
) | do {} while(0) |
Definition at line 54 of file dsm.cpp.
Referenced by dsm_guess_format().
#define DSM_FRAME_CHANNELS 7 |
Max supported DSM channels
Definition at line 44 of file dsm.cpp.
Referenced by dsm_decode(), and dsm_guess_format().
#define DSM_FRAME_SIZE 16 |
bool dsm_decode | ( | uint64_t | frame_time, |
const uint8_t | dsm_frame[16], | ||
uint16_t * | values, | ||
uint16_t * | num_values, | ||
uint16_t | max_values | ||
) |
Decode the entire dsm frame (all contained channels)
Definition at line 195 of file dsm.cpp.
Referenced by F4Light::PPM_parser::_process_dsm_pulse(), Linux::RCInput::_process_dsm_pulse(), Linux::RCInput::add_dsm_input(), dsm_decode(), F4Light::DSM_parser::init(), and AP_RCProtocol_DSM::process_pulse().
|
static |
Attempt to decode a single channel raw channel datum
The DSM* protocol doesn't provide any explicit framing, so we detect dsm frame boundaries by the inter-dsm frame delay.
The minimum dsm frame spacing is 11ms; with 16 bytes at 115200bps dsm frame transmission time is ~1.4ms.
We expect to only be called when bytes arrive for processing, and if an interval of more than 5ms passes between calls, the first byte we read will be the first byte of a dsm frame.
In the case where byte(s) are dropped from a dsm frame, this also provides a degree of protection. Of course, it would be better if we didn't drop bytes...
Upon receiving a full dsm frame we attempt to decode it
[in] | raw | 16 bit raw channel value from dsm frame |
[in] | shift | position of channel number in raw data |
[out] | channel | pointer to returned channel number |
[out] | value | pointer to returned channel value |
Definition at line 83 of file dsm.cpp.
Referenced by dsm_decode(), and dsm_guess_format().
|
static |
Attempt to guess if receiving 10 or 11 bit channel values
[in] | reset | true=reset the 10/11 bit state to unknown |
Definition at line 105 of file dsm.cpp.
Referenced by dsm_decode().
|
static |
Channel resolution, 0=unknown, 10=10 bit, 11=11 bit
Definition at line 47 of file dsm.cpp.
Referenced by dsm_decode(), and dsm_guess_format().
|
static |
Timestamp for start of last dsm frame
Definition at line 46 of file dsm.cpp.
Referenced by dsm_decode().