Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
dcc::DccPayloadBase Struct Reference

Common storage variables for the different DCC Payload types. More...

#include <Loco.hxx>

Inheritance diagram for dcc::DccPayloadBase:
dcc::Dcc128Payload dcc::Dcc28Payload

Public Member Functions

void set_fn_store (unsigned idx, bool value)
 Set a given function bit in storage.
 
bool get_fn_store (unsigned idx)
 Get a given function bit in storage.
 
TrainAddressType get_address_type ()
 

Static Public Member Functions

static unsigned get_max_fn ()
 
static unsigned get_fn_update_code (unsigned address)
 

Public Attributes

uint16_t address_: 14
 Track address. largest address allowed is 10239.
 
uint16_t isShortAddress_: 1
 1 if this is a short address train.
 
uint16_t direction_: 1
 0: forward, 1: reverse
 
uint16_t lastSetSpeed_: 16
 fp16 value of the last set speed.
 
unsigned fn_: 29
 functions f0-f28.
 
uint8_t nextRefresh_: 3
 Which refresh packet should go out next.
 
uint8_t isEstop_: 1
 1 if the last speed set was estop.
 
uint8_t directionChanged_: 1
 Whether the direction change packet still needs to go out.
 
uint8_t f0SetDirectional_: 1
 1 if the F0 function should be set/get in a directional way.
 
uint8_t f0OnForward_: 1
 1 if directional f0 is used and f0 is on for F.
 
uint8_t f0OnReverse_: 1
 1 if directional f0 is used and f0 is on for R.
 
uint8_t f0BlankForward_: 1
 1 if F0 should be turned off when dir==forward.
 
uint8_t f0BlankReverse_: 1
 1 if F0 should be turned off when dir==reverse.
 
uint8_t speed_: 7
 Speed step we last set.
 
uint8_t fhi_ [5]
 f29-f68 state.
 

Detailed Description

Common storage variables for the different DCC Payload types.

Definition at line 355 of file Loco.hxx.

Member Function Documentation

◆ get_address_type()

TrainAddressType dcc::DccPayloadBase::get_address_type ( )
inline
Returns
what type of address this train has.

Definition at line 453 of file Loco.hxx.

◆ get_fn_store()

bool dcc::DccPayloadBase::get_fn_store ( unsigned  idx)
inline

Get a given function bit in storage.

Parameters
idxfunction number, 0 to get_max_fn.
Returns
function state

Definition at line 435 of file Loco.hxx.

◆ get_fn_update_code()

unsigned dcc::DccPayloadBase::get_fn_update_code ( unsigned  address)
static
Returns
the update code to send ot the packet handler for a given function value change.
Parameters
addressis the function number(0..28).

Definition at line 58 of file Loco.cxx.

◆ get_max_fn()

static unsigned dcc::DccPayloadBase::get_max_fn ( )
inlinestatic
Returns
the largest function number supported by this train (inclusive).

Definition at line 397 of file Loco.hxx.

◆ set_fn_store()

void dcc::DccPayloadBase::set_fn_store ( unsigned  idx,
bool  value 
)
inline

Set a given function bit in storage.

Parameters
idxfunction number, 0 to get_max_fn.
valuefunction state

Definition at line 405 of file Loco.hxx.

Member Data Documentation

◆ address_

uint16_t dcc::DccPayloadBase::address_

Track address. largest address allowed is 10239.

Definition at line 358 of file Loco.hxx.

◆ direction_

uint16_t dcc::DccPayloadBase::direction_

0: forward, 1: reverse

Definition at line 362 of file Loco.hxx.

◆ directionChanged_

uint8_t dcc::DccPayloadBase::directionChanged_

Whether the direction change packet still needs to go out.

Definition at line 378 of file Loco.hxx.

◆ f0BlankForward_

uint8_t dcc::DccPayloadBase::f0BlankForward_

1 if F0 should be turned off when dir==forward.

Definition at line 386 of file Loco.hxx.

◆ f0BlankReverse_

uint8_t dcc::DccPayloadBase::f0BlankReverse_

1 if F0 should be turned off when dir==reverse.

Definition at line 388 of file Loco.hxx.

◆ f0OnForward_

uint8_t dcc::DccPayloadBase::f0OnForward_

1 if directional f0 is used and f0 is on for F.

Definition at line 382 of file Loco.hxx.

◆ f0OnReverse_

uint8_t dcc::DccPayloadBase::f0OnReverse_

1 if directional f0 is used and f0 is on for R.

Definition at line 384 of file Loco.hxx.

◆ f0SetDirectional_

uint8_t dcc::DccPayloadBase::f0SetDirectional_

1 if the F0 function should be set/get in a directional way.

Definition at line 380 of file Loco.hxx.

◆ fhi_

uint8_t dcc::DccPayloadBase::fhi_[5]

f29-f68 state.

Definition at line 393 of file Loco.hxx.

◆ fn_

unsigned dcc::DccPayloadBase::fn_

functions f0-f28.

Definition at line 369 of file Loco.hxx.

◆ isEstop_

uint8_t dcc::DccPayloadBase::isEstop_

1 if the last speed set was estop.

Definition at line 376 of file Loco.hxx.

◆ isShortAddress_

uint16_t dcc::DccPayloadBase::isShortAddress_

1 if this is a short address train.

Definition at line 360 of file Loco.hxx.

◆ lastSetSpeed_

uint16_t dcc::DccPayloadBase::lastSetSpeed_

fp16 value of the last set speed.

Definition at line 364 of file Loco.hxx.

◆ nextRefresh_

uint8_t dcc::DccPayloadBase::nextRefresh_

Which refresh packet should go out next.

Definition at line 371 of file Loco.hxx.

◆ speed_

uint8_t dcc::DccPayloadBase::speed_

Speed step we last set.

Definition at line 390 of file Loco.hxx.


The documentation for this struct was generated from the following files: