Model Railroad System  2.2.2
Model RR signals with an Arduino
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SignalDriverMax72xx Class Reference

SignalDriverMax72xx is a Snit type (OO class) that implements the host interface to the SignalDriverMax72xx program running on an Arduino. More...

Public Member Functions

 SignalDriverMax72xx (name,...)
 Constructor: open the port, configure it, set a readable file event, and prime the port. More...
 
 dark ()
 Method to turn off all LEDs. More...
 
 set (signo, aspect)
 Method to set the aspect for one signal. More...
 
 ~SignalDriverMax72xx ()
 Destructor: close the port. More...
 

Static Public Member Functions

static validate (object)
 Type validation typemethod. More...
 

Private Member Functions

 _ReadPort ()
 Method to gobble from the Arduino. More...
 

Private Attributes

 portfd
 Variable to hold the port fd. More...
 
 _ready
 Variable to hold ready (for a command) state. More...
 

Static Private Attributes

static validateaspects
 Validation type for aspects. More...
 
static validatesignalnums
 Validation type for signal numbers. More...
 

Detailed Description

SignalDriverMax72xx is a Snit type (OO class) that implements the host interface to the SignalDriverMax72xx program running on an Arduino.

It provides an abstraction of the serial port interface that controls signals multiplexed by the MAX72xx chip. This version assumes a that there is only one SignalDriverMax72xx driver boards (1 to 8 signals, numbered 0 through 7) connected to the Arduino. This version assumes that only these aspects are valid (case folded):

g_r (Green over Red – Clear) y_r (Yellow over Red – Approach) r_r (Red over Red – [Absolute] Stop) r_g (Red over Green – Slow Clear) r_y (Red over Yellow – Approach Limited) dark (all lights off)

Definition at line 19 of file SignalDriverMax72xx_Host.tcl.

Constructor & Destructor Documentation

◆ SignalDriverMax72xx()

SignalDriverMax72xx::SignalDriverMax72xx ( name  ,
  ... 
)

Constructor: open the port, configure it, set a readable file event, and prime the port.

Parameters
nameThe name of the object to be created.
...Options:
  • -portname The name of the USB Serial port connecting to the Uno.

◆ ~SignalDriverMax72xx()

SignalDriverMax72xx::~SignalDriverMax72xx ( )

Destructor: close the port.

Member Function Documentation

◆ _ReadPort()

SignalDriverMax72xx::_ReadPort ( )
private

Method to gobble from the Arduino.

◆ dark()

SignalDriverMax72xx::dark ( )

Method to turn off all LEDs.

◆ set()

SignalDriverMax72xx::set ( signo  ,
aspect   
)

Method to set the aspect for one signal.

Parameters
signoSignal number
aspectThe desired aspect

◆ validate()

static SignalDriverMax72xx::validate ( object  )
static

Type validation typemethod.

Parameters
objectAn object to be validated.

Member Data Documentation

◆ _ready

SignalDriverMax72xx::_ready
private

Variable to hold ready (for a command) state.

Definition at line 51 of file SignalDriverMax72xx_Host.tcl.

◆ portfd

SignalDriverMax72xx::portfd
private

Variable to hold the port fd.

Definition at line 38 of file SignalDriverMax72xx_Host.tcl.

◆ validateaspects

SignalDriverMax72xx::validateaspects
staticprivate

Validation type for aspects.

Definition at line 24 of file SignalDriverMax72xx_Host.tcl.

◆ validatesignalnums

SignalDriverMax72xx::validatesignalnums
staticprivate

Validation type for signal numbers.

Definition at line 28 of file SignalDriverMax72xx_Host.tcl.