Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF > Struct Template Reference

Generic implementation of the actual HW output with a booster enable and a railcom enable GPIO. More...

#include <DccOutput.hxx>

Inheritance diagram for DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >:
DccOutputHw< N >

Static Public Member Functions

static void hw_preinit (void)
 Called once during hw_preinit boot state.
 
static unsigned start_railcom_cutout_phase1 (void)
 Invoked at the beginning of a railcom cutout.
 
static unsigned start_railcom_cutout_phase2 (void)
 Invoked at the beginning of a railcom cutout after the delay.
 
static unsigned stop_railcom_cutout_phase1 (void)
 Invoked at the end of a railcom cutout.
 
static void stop_railcom_cutout_phase2 (void)
 Invoked at the end of a railcom cutout.
 
static void enable_output (void)
 Called once every packet by the driver, typically before the preamble, if the output is supposed to be on.
 
static void set_disable_reason (DccOutput::DisableReason bit)
 
- Static Public Member Functions inherited from DccOutputHw< N >
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.
 

Additional Inherited Members

- Static Public Attributes inherited from DccOutputHw< N >
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 inherited from DccOutputHw< N >
static void set_disable_reason_impl (DccOutput::DisableReason bit)
 Set one bit in the disable reasons bit field.
 

Detailed Description

template<int N, class BOOSTER_ENABLE, class RAILCOM_ENABLE, unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
struct DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >

Generic implementation of the actual HW output with a booster enable and a railcom enable GPIO.

Parameters
Nis the output number
BOOSTER_ENABLEis a GPIO structure that turns the output on/off. set(true) is on.
RAILCOM_ENABLEis a GPIO structure that turns the RailCom FETs on. set(true) starts the cutout.
DELAY_ON_1is the number of usec to delay from BOOSTER_ENABLE off to RAILCOM_ENABLE on.
DELAY_ON_2is the number of usec to delay from RAILCOM_ENABLE on to railcom UART on.
DELAY_OFFis the number of usec to delay from RAILCOM_ENABLE off to booster enable on.

Definition at line 320 of file DccOutput.hxx.

Member Function Documentation

◆ enable_output()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static void DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::enable_output ( void  )
inlinestatic

Called once every packet by the driver, typically before the preamble, if the output is supposed to be on.

Definition at line 365 of file DccOutput.hxx.

◆ hw_preinit()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static void DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::hw_preinit ( void  )
inlinestatic

Called once during hw_preinit boot state.

Definition at line 324 of file DccOutput.hxx.

◆ set_disable_reason()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static void DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::set_disable_reason ( DccOutput::DisableReason  bit)
inlinestatic

Definition at line 370 of file DccOutput.hxx.

◆ start_railcom_cutout_phase1()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static unsigned DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::start_railcom_cutout_phase1 ( void  )
inlinestatic

Invoked at the beginning of a railcom cutout.

Returns
the number of usec to wait before invoking phase2.

Definition at line 334 of file DccOutput.hxx.

◆ start_railcom_cutout_phase2()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static unsigned DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::start_railcom_cutout_phase2 ( void  )
inlinestatic

Invoked at the beginning of a railcom cutout after the delay.

Returns
number of usec to delay before enabling railcom UART receive.

Definition at line 342 of file DccOutput.hxx.

◆ stop_railcom_cutout_phase1()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static unsigned DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::stop_railcom_cutout_phase1 ( void  )
inlinestatic

Invoked at the end of a railcom cutout.

Returns
the number of usec to wait before invoking phase2.

Definition at line 350 of file DccOutput.hxx.

◆ stop_railcom_cutout_phase2()

template<int N, class BOOSTER_ENABLE , class RAILCOM_ENABLE , unsigned DELAY_ON_1, unsigned DELAY_ON_2, unsigned DELAY_OFF>
static void DccOutputHwReal< N, BOOSTER_ENABLE, RAILCOM_ENABLE, DELAY_ON_1, DELAY_ON_2, DELAY_OFF >::stop_railcom_cutout_phase2 ( void  )
inlinestatic

Invoked at the end of a railcom cutout.

Todo:
consider checking whether output disable reason == 0 then enable the output?

Definition at line 357 of file DccOutput.hxx.


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