Model Railroad System  2.2.1
Model RR signals with an Arduino
ProgrammingtheHostComputer.h
1 // -!- c++ -!- //////////////////////////////////////////////////////////////
2 //
3 // System :
4 // Module :
5 // Object Name : $RCSfile$
6 // Revision : $Revision$
7 // Date : $Date$
8 // Author : $Author$
9 // Created By : Robert Heller
10 // Created : Tue Jul 28 09:13:33 2015
11 // Last Modified : <150728.1915>
12 //
13 // Description
14 //
15 // Notes
16 //
17 // History
18 //
19 /////////////////////////////////////////////////////////////////////////////
20 //
21 // Copyright (C) 2015 Robert Heller D/B/A Deepwoods Software
22 // 51 Locke Hill Road
23 // Wendell, MA 01379-9728
24 //
25 // This program is free software; you can redistribute it and/or modify
26 // it under the terms of the GNU General Public License as published by
27 // the Free Software Foundation; either version 2 of the License, or
28 // (at your option) any later version.
29 //
30 // This program is distributed in the hope that it will be useful,
31 // but WITHOUT ANY WARRANTY; without even the implied warranty of
32 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 // GNU General Public License for more details.
34 //
35 // You should have received a copy of the GNU General Public License
36 // along with this program; if not, write to the Free Software
37 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
38 //
39 //
40 //
41 //////////////////////////////////////////////////////////////////////////////
42 
43 #ifndef __PROGRAMMINGTHEHOSTCOMPUTER_H
44 #define __PROGRAMMINGTHEHOSTCOMPUTER_H
45 /** @page ProgrammingtheHostComputer Programming the Host Computer
46  *
47  * The host interface to the Ardunio SignalDriverMax72xx is via a virtual
48  * serial port over the USB interface. The host computer sends text commands
49  * down the serial port and the Ardunio in turn sends data down its SPI
50  * interface to the MAX72XX, which in turn lights up the signal LEDs.
51  *
52  * I wrote a simple Tcl SNIT type (OO class) that implements this interface.
53  * @htmlonly
54  * The Tcl code is in the file
55  * <a href="SignalDriverMax72xx_Host.tcl">SignalDriverMax72xx_Host.tcl</a>.
56  * @endhtmlonly
57  * @latexonly
58  * The Tcl code is in the file SignalDriverMax72xx\_Host.tcl.
59  * @endlatexonly
60  * The constructor connects to the Ardunio by opening the virtual serial port.
61  * Then signals can then be lit with selected aspects with the instance method
62  * @c set, which takes two arguments, a signal number (0 to 7 inclusive) and an
63  * aspect string, which is one of:
64  *
65  * - g_r (Green over Red -- Clear)
66  * - y_r (Yellow over Red -- Approach)
67  * - r_r (Red over Red -- [Absolute] Stop)
68  * - r_g (Red over Green -- Slow Clear)
69  * - r_y (Red over Yellow -- Approach Limited)
70  * - dark (all lights off)
71  *
72  * There is also an instance method, @c dark, which turns all of the signal LEDs
73  * off.
74  *
75  * Typical usage:
76  * @code
77  * # Load the code
78  * package require SignalDriverMax72xx_Host
79  * # Connect to the Ardunio on /dev/ttyACM0
80  * SignalDriverMax72xx controlpoint1 -portname /dev/ttyACM0
81  * # Define symbolic names for the signals
82  * # East end (Westbound) of Control Point 1 on track 2
83  * set CP1w2 0
84  * # East end (Westbound) of Control Point 1 on track 1
85  * set CP1w1 1
86  * # West end (Eastbound) of Control Point 1 on track 2
87  * set CP1e2 2
88  * # West end (Eastbound) of Control Point 1 on track 1
89  * set CP1e1 3
90  * # West end (Eastbound) of Control Point 1 on siding
91  * set CP1eS 4
92  * # Set all signals to Red over Red
93  * controlpoint1 set $CP1w2 r_r
94  * controlpoint1 set $CP1w1 r_r
95  * controlpoint1 set $CP1e2 r_r
96  * controlpoint1 set $CP1e1 r_r
97  * controlpoint1 set $CP1eS r_r
98  * # Set Track 1 for clear (Green over Red) Eastbound
99  * controlpoint1 set $CP1e1 g_r
100  * # Set Track 2 for clear (Green over Red) Westbound
101  * controlpoint1 set $CP1w2 g_r
102  * @endcode
103  *
104  *
105  */
106 
107 #endif // __PROGRAMMINGTHEHOSTCOMPUTER_H
108