DCCpp
This is the library version of a program for Arduino to control railroading DCC devices.
Outputs.h
1 /**********************************************************************
2 
3 Outputs.h
4 COPYRIGHT (c) 2013-2016 Gregg E. Berman
5 
6 Part of DCC++ BASE STATION for the Arduino
7 
8 **********************************************************************/
9 
10 #ifndef Outputs_h
11 #define Outputs_h
12 
13 #include "DCCpp.h"
14 
15 #ifdef USE_OUTPUT
16 #include "Arduino.h"
17 
18 struct OutputData {
19  byte oStatus;
20  int id;
21  byte pin;
22  byte iFlag;
23 };
24 
102 struct Output{
103  int num;
104  struct OutputData data;
105 
106  void begin(int id, int pin, int iFlag);
107  void set(int id, int pin, int iFlag);
108  void activate(int s = 1);
109  bool isActivated() { return this->data.oStatus > 0; }
110 
111 #if defined(USE_EEPROM) || defined(USE_TEXTCOMMAND)
112  static Output *firstOutput;
113  Output *nextOutput;
114  static Output* get(int);
115  static void remove(int id);
116  static int count();
117 
118 #ifdef DCCPP_PRINT_DCCPP
119  static void show();
120 #endif
121 
122 #if defined(USE_EEPROM)
123  static void load();
124  static void store();
125 #endif
126 
127 #endif
128 
129 #if defined(USE_TEXTCOMMAND)
130  static void parse(char *c);
131  static Output *create(int, int, int);
132 #endif
133 
134 }; // Output
135 
136 #endif
137 #endif
138 
139