Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
DccOutputHw< OUTPUT_NUMBER > Struct Template Reference

This structure represents a single output channel for a DCC command station. More...

#include <DccOutput.hxx>

Static Public Member Functions

static bool need_railcom_cutout ()
 Called by the driver to decide whether to make this channel participate in the railcom cutout.
 
static bool should_be_enabled ()
 Called once after the railcom cutout is done to decide whether this output should be reenabled.
 
static void clear_disable_reason (DccOutput::DisableReason bit)
 Clears a disable reason.
 

Static Public Attributes

static std::atomic_uint_least8_t outputDisableReasons_
 Bitmask of why this output should be disabled.
 
static std::atomic_uint_least8_t isRailcomCutoutEnabled_
 0 if we should not produce a railcom cutout; 1 for short cutout; 2 for regular cutout.
 
static uint8_t isRailcomCutoutActive_
 1 if we are in a railcom cutout currently.
 

Static Protected Member Functions

static void set_disable_reason_impl (DccOutput::DisableReason bit)
 Set one bit in the disable reasons bit field.
 

Private Member Functions

 DccOutputHw ()
 Private constructor.
 

Detailed Description

template<int OUTPUT_NUMBER>
struct DccOutputHw< OUTPUT_NUMBER >

This structure represents a single output channel for a DCC command station.

The DCC driver uses these structures, with the business logic filled in by the hardware implementor.

Parameters
OUTPUT_NUMBER0,1,... the number of outputs. Each output is independently controlled.

Definition at line 187 of file DccOutput.hxx.

Constructor & Destructor Documentation

◆ DccOutputHw()

template<int OUTPUT_NUMBER>
DccOutputHw< OUTPUT_NUMBER >::DccOutputHw ( )
private

Private constructor.

These objects cannot be initialized and must only have static members.

Member Function Documentation

◆ clear_disable_reason()

template<int OUTPUT_NUMBER>
static void DccOutputHw< OUTPUT_NUMBER >::clear_disable_reason ( DccOutput::DisableReason  bit)
inlinestatic

Clears a disable reason.

If all disable reasons are clear, the output will be enabled by the DCC driver at the beginning of the next packet.

Definition at line 222 of file DccOutput.hxx.

◆ need_railcom_cutout()

template<int OUTPUT_NUMBER>
static bool DccOutputHw< OUTPUT_NUMBER >::need_railcom_cutout ( )
inlinestatic

Called by the driver to decide whether to make this channel participate in the railcom cutout.

Definition at line 208 of file DccOutput.hxx.

◆ set_disable_reason_impl()

template<int OUTPUT_NUMBER>
static void DccOutputHw< OUTPUT_NUMBER >::set_disable_reason_impl ( DccOutput::DisableReason  bit)
inlinestaticprotected

Set one bit in the disable reasons bit field.

This is protected, because the implementation / child class should have a composite function that sets the bit and disables the output in one call.

Definition at line 231 of file DccOutput.hxx.

◆ should_be_enabled()

template<int OUTPUT_NUMBER>
static bool DccOutputHw< OUTPUT_NUMBER >::should_be_enabled ( )
inlinestatic

Called once after the railcom cutout is done to decide whether this output should be reenabled.

Definition at line 215 of file DccOutput.hxx.

Member Data Documentation

◆ isRailcomCutoutActive_

template<int OUTPUT_NUMBER>
uint8_t DccOutputHw< OUTPUT_NUMBER >::isRailcomCutoutActive_
static

1 if we are in a railcom cutout currently.

Set and cleared by the driver before calling the start/stop railcom cutout functions.

Definition at line 204 of file DccOutput.hxx.

◆ isRailcomCutoutEnabled_

template<int OUTPUT_NUMBER>
std::atomic_uint_least8_t DccOutputHw< OUTPUT_NUMBER >::isRailcomCutoutEnabled_
static

0 if we should not produce a railcom cutout; 1 for short cutout; 2 for regular cutout.

Set by the application and read by the DCC driver.

Definition at line 200 of file DccOutput.hxx.

◆ outputDisableReasons_

template<int OUTPUT_NUMBER>
std::atomic_uint_least8_t DccOutputHw< OUTPUT_NUMBER >::outputDisableReasons_
static

Bitmask of why this output should be disabled.

If zero, the output should be enabled. If non-zero, the output should be disabled. A variety of system components own one bit in this bitmask each; see { } These bits are all set by the application. The DCC Driver will only read this variable, and enable the output if all bits are zero.

Definition at line 196 of file DccOutput.hxx.


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