DsmParser (dsm_parser v0.1.0) View Source
Parse and store DSM packets coming from Spektrum receiver.
Link to this section Summary
Functions
Appends the latest data to any leftover data from the previous check_for_new_messages
operation.
Empties the stored channel value list.
Returns the stored channel values.
Create a new DsmParser struct that can parse new serial data and store the most recently received RX output.
Link to this section Functions
Specs
Appends the latest data to any leftover data from the previous check_for_new_messages
operation.
Arguments are the %DsmParser{}
struct and the newest serial data from the receiver (must already by converted from binary to list)
Returns {%DsmParser{}, [list of channels]}
. If no valid SBus messages was found, the list of channels will be empty.
NOTE: After a valid message has been received, the clear
function must be called if you do not want the channel values to persist.
Otherwise this function will continue to return a populated channel list even if a new valid message has not been received.
Example:
{dsm_parser, channel_values} = DsmParser.check_for_new_messages(dsm_parser, new_data_list)
dsm_parser = DsmParser.clear(dsm_parser)
Specs
Empties the stored channel value list.
Specs
Returns the stored channel values.
Specs
new() :: struct()
Create a new DsmParser struct that can parse new serial data and store the most recently received RX output.