|
Open Model Railroad Network (OpenMRN)
|
#include <stdint.h>Go to the source code of this file.
Enumerations | |
| enum class | dcc::TrainAddressType : uint8_t { DCC_SHORT_ADDRESS = 1 , DCC_LONG_ADDRESS , MM , DCC_ACCY_BASIC_OUTPUT , DCC_ACCY_EXT , UNSUPPORTED = 255 , UNSPECIFIED = 254 } |
| Which address type this legacy train node uses. More... | |
| enum | { MARKLIN_DEFAULT_CMD = 0b00100110 , MARKLIN_CHANGE_DIR_B2 = 0b11000000 , DCC_DEFAULT_CMD = 0 , DCC_LONG_PREAMBLE_CMD = 0b00001100 , DCC_SERVICE_MODE_5X_WITH_ACK_CMD = 0b00111000 , DCC_SERVICE_MODE_5X_CMD = 0b00101000 , DCC_SERVICE_MODE_1X_CMD = 0b00001000 , dcc::Defs::DCC_LONG_ADDRESS_FIRST = 0b11000000 , DCC_BASELINE_SPEED = 0b01000000 , DCC_BASELINE_SPEED_FORWARD = 0b00100000 , DCC_BASELINE_SPEED_LIGHT = 0b00010000 , DCC_FUNCTION1 = 0b10000000 , DCC_FUNCTION1_F0 = 0b00010000 , DCC_FUNCTION2_F5 = 0b10110000 , DCC_FUNCTION2_F9 = 0b10100000 , DCC_FEATURE_EXP_F13 = 0b11011110 , DCC_FEATURE_EXP_F21 = 0b11011111 , DCC_FEATURE_EXP_FNHI = 0b11011000 , DCC_BINARY_SHORT = 0b11011101 , DCC_BINARY_LONG = 0b11000000 , DCC_ANALOG_FN = 0b00111101 , DCC_PROG_READ1 = 0b11100100 , DCC_PROG_WRITE1 = 0b11101100 , DCC_PROG_READ4 = 0b11100000 , DCC_SVC_BIT_MANIPULATE = 0b01111000 , DCC_SVC_WRITE = 0b01111100 , DCC_SVC_VERIFY = 0b01110100 , DCC_SVC_MASK = 0b11111100 , DCC_SVC_BITVAL_WRITE = 0b11110000 , DCC_SVC_BITVAL_VERIFY = 0b11100000 , DCC_SVC_BITVAL_VALUE = 0b00001000 , DCC_SVC_BITVAL_MASK = 0b11110000 , DCC_SVC_PAGED_WRITE = 0b01111000 , DCC_SVC_PAGED_VERIFY = 0b01110000 , DCC_SVC_PAGED_MASK = 0b11111000 , DCC_BASIC_ACCESSORY_B1 = 0b10000000 , DCC_BASIC_ACCESSORY_MASK1 = 0b11000000 , DCC_BASIC_ACCESSORY_B2 = 0b10000000 , DCC_BASIC_ACCESSORY_MASK2 = 0b10000000 , DCC_EXT_ACCESSORY_B2 = 0b00000001 , DCC_EXT_ACCESSORY_MASK2 = 0b10001001 , DCC_BASIC_ACCESSORY_B2_ACTIVATE = 0b00001000 , DCC_BASIC_ACCESSORY_B2_DEACTIVATE = 0b00000000 , DCC_BASIC_ACCESSORY_B2_ACTIVATE_MASK = DCC_BASIC_ACCESSORY_B2_ACTIVATE , DCC_BASIC_ACCESSORY_B2_THROWN = 0b00000000 , DCC_BASIC_ACCESSORY_B2_CLOSED = 0b00000001 , DCC_BASIC_ACCESSORY_B2_DIR_MASK = DCC_BASIC_ACCESSORY_B2_CLOSED , DCC_EXT_SPEED = 0b00111111 , DCC_EXT_SPEED_FORWARD = 0x80 , dcc::Defs::ADDRESS_LOGON = 254 , dcc::Defs::ADDRESS_EXT = 253 , dcc::Defs::DCC_LOGON_ENABLE = 0b11111100 , DCC_LOGON_ENABLE_MASK = 0b11111100 , dcc::Defs::DCC_SELECT = 0b11010000 , DCC_SELECT_MASK = 0b11110000 , dcc::Defs::DCC_GET_DATA_START = 0 , dcc::Defs::DCC_GET_DATA_CONT = 1 , dcc::Defs::DCC_LOGON_ASSIGN = 0b11100000 , DCC_LOGON_ASSIGN_MASK = 0b11110000 , dcc::Defs::DCC_DID_MIN = DCC_SELECT , dcc::Defs::DCC_DID_MAX = DCC_LOGON_ASSIGN + 0xF , dcc::Defs::DCC_DID_MASK = 0xF0 , CMD_READ_SHORT_INFO = 0b11111111 , CMD_READ_BLOCK = 0b11111110 , CMD_READ_BACKGROUND = 0b11111101 , CMD_WRITE_BLOCK = 0b11111100 , dcc::Defs::ADR_MASK = 0b111111 , dcc::Defs::ADR_MOBILE_SHORT = 0b00111000 , dcc::Defs::ADR_MOBILE_SHORT_MASK = 0xFF , dcc::Defs::ADR_MOBILE_LONG = 0 , dcc::Defs::MAX_MOBILE_LONG = 0b00100111 , dcc::Defs::ADR_ACC_EXT = 0b00101000 , dcc::Defs::MASK_ACC_EXT = 0b00111000 , dcc::Defs::ADR_ACC_BASIC = 0b00110000 , dcc::Defs::MASK_ACC_BASIC = 0b00111000 , dcc::Defs::ADR_INVALID = (ADR_MOBILE_SHORT << 8) } |
| enum class | dcc::Defs::LogonEnableParam { NOW = 0b11 , LOCO = 0b01 , ACC = 0b10 , ALL = 0b00 } |
| Parameters for the Logon Enable command. More... | |
Functions | |
| bool | dcc::Defs::decode_address_partition (uint16_t addr14, uint16_t *addr, uint8_t *partition, dcc::TrainAddressType *atype) |
| Decodes a 14-bit address (according to S-9.2.1.1) into an address type and a raw address. | |
| static unsigned | dcc::Defs::accy_address_user_to_binary (unsigned user) |
| Convers a DCC basic or extended accessory decoder address from user address (1-2048) to binary address (0..2047). | |
| static unsigned | dcc::Defs::accy_address_binary_to_user (unsigned binary) |
| Convers a DCC basic or extended accessory decoder address from a binary address (0 - 2047) to user address (1 - 2048). | |
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.
Definitions for DCC concepts.
Definition in file dcc/Defs.hxx.
| anonymous enum |
Definition at line 69 of file dcc/Defs.hxx.
|
strong |
Parameters for the Logon Enable command.
| Enumerator | |
|---|---|
| NOW | All decoders respond and ignore backoff. |
| LOCO | Locomotive decoders only. |
| ACC | Accessory decoders only. |
| ALL | All decoders respond. |
Definition at line 264 of file dcc/Defs.hxx.
|
strong |
Which address type this legacy train node uses.
These address types translate to mutually independent packets on the track.
Definition at line 45 of file dcc/Defs.hxx.
|
inlinestatic |
Convers a DCC basic or extended accessory decoder address from a binary address (0 - 2047) to user address (1 - 2048).
This takes into account the 2023 draft of the DCC standard for address mapping. It uses per-output addressing for basic accessory decoders. It uses 2044 user address for the binary address that previously was the broadcast for basic accessory decoders.
| binary | the address in the DCC packet. The one's complement for the highest bits should be undone already. |
Definition at line 251 of file dcc/Defs.hxx.
|
inlinestatic |
Convers a DCC basic or extended accessory decoder address from user address (1-2048) to binary address (0..2047).
This takes into account the 2023 draft of the DCC standard for address mapping. It uses per-output addressing for basic accessory decoders. It uses 2044 for the address that previously was the broadcast address for basic accessory decoders.
| user | user address for accy decoders. 1..2040 uses the legacy addressing. 2041 .. 2048 uses the 2023 RCN-213 and DCC S-9.2.1 encoding. |
Definition at line 229 of file dcc/Defs.hxx.
| bool dcc::Defs::decode_address_partition | ( | uint16_t | addr14, |
| uint16_t * | addr, | ||
| uint8_t * | partition, | ||
| dcc::TrainAddressType * | atype | ||
| ) |
Decodes a 14-bit address (according to S-9.2.1.1) into an address type and a raw address.
| addr14 | a 14-bit address according to S-9.2.1.1 |
| addr | the decoded address value (8 to 14 bits) |
| partition | the partition of the address type (the top byte, max 6 bits, e.g. ADR_MOBILE_SHORT) |
| atype | address type enum |
Definition at line 42 of file dcc/Defs.cxx.