|
Open Model Railroad Network (OpenMRN)
|
Go to the source code of this file.
Functions | |
| void | dcc::parse_internal (uint8_t fb_channel, uint8_t railcom_channel, const uint8_t *ptr, unsigned size, std::vector< struct RailcomPacket > *output) |
| Helper function to parse a part of a railcom packet. | |
| void | dcc::parse_railcom_data (const dcc::Feedback &fb, std::vector< struct RailcomPacket > *output) |
| Interprets the data from a railcom feedback. | |
Variables | |
| static constexpr uint8_t | dcc::INV = RailcomDefs::INV |
| static constexpr uint8_t | dcc::ACK = RailcomDefs::ACK |
| static constexpr uint8_t | dcc::NACK = RailcomDefs::NACK |
| static constexpr uint8_t | dcc::BUSY = RailcomDefs::BUSY |
| static constexpr uint8_t | dcc::RESVD1 = RailcomDefs::RESVD1 |
| static constexpr uint8_t | dcc::RESVD2 = RailcomDefs::RESVD2 |
| const uint8_t | dcc::railcom_decode [256] |
| Table for 8-to-6 decoding of railcom data. | |
| const uint8_t | dcc::railcom_encode [64] |
| Table for 6-to-8 encoding of railcom data. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Implementation of RailCom helper functions and tables.
Definition in file RailCom.cxx.
| void dcc::parse_internal | ( | uint8_t | fb_channel, |
| uint8_t | railcom_channel, | ||
| const uint8_t * | ptr, | ||
| unsigned | size, | ||
| std::vector< struct RailcomPacket > * | output | ||
| ) |
Helper function to parse a part of a railcom packet.
| fb_channel | Which hardware channel did the railcom message arrive at. typically from 0.. num channels - 1: for a command station always 0, for a multi-channel railcom decoder it's as many as the number of ports. |
| railcom_channel | 1 or 2 depending on which part of the cutout window the data is from. |
| ptr | raw railcom data read from the UART. |
| size | how many bytes were read from the UART |
| output | where to put the decoded packets (or GARBAGE packets if decoding fails). |
Definition at line 162 of file RailCom.cxx.
| void dcc::parse_railcom_data | ( | const dcc::Feedback & | fb, |
| std::vector< struct RailcomPacket > * | output | ||
| ) |
Interprets the data from a railcom feedback.
If the railcom data contains error, will add a packet of type "GARBAGE" into the output list. Clears the output list before fillign with the railcom data.
Definition at line 267 of file RailCom.cxx.
|
staticconstexpr |
Definition at line 42 of file RailCom.cxx.
|
staticconstexpr |
Definition at line 44 of file RailCom.cxx.
|
staticconstexpr |
Definition at line 41 of file RailCom.cxx.
|
staticconstexpr |
Definition at line 43 of file RailCom.cxx.
| const uint8_t dcc::railcom_decode |
Table for 8-to-6 decoding of railcom data.
This table can be indexed by the 8-bit value read from the railcom channel, and the return value will be either a 6-bit number, or one of the constants in RailcomDefs. If the value is invalid, the INV constant is returned.
Definition at line 47 of file RailCom.cxx.
| const uint8_t dcc::railcom_encode |
Table for 6-to-8 encoding of railcom data.
The table can be indexed by a 6-bit value that is the semantic content of a railcom byte, and returns the matching 8-bit value to put out on the UART. This table only contains the standard codes, for the special codes like ACK use RailcomDefs::ACK.
Definition at line 83 of file RailCom.cxx.
|
staticconstexpr |
Definition at line 45 of file RailCom.cxx.
|
staticconstexpr |
Definition at line 46 of file RailCom.cxx.