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 "Arduino.h"
14 
15 #ifdef USE_OUTPUT
16 
18 struct OutputData {
19  byte oStatus;
20  int id;
21  byte pin;
22  byte iFlag;
23 };
24 
129 struct Output{
130  struct OutputData data;
138  void begin(int id, int pin, int iFlag);
145  void set(int id, int pin, int iFlag);
149  void activate(int s = 1);
153  bool isActivated() { return this->data.oStatus > 0; }
154 
155 #if defined(USE_EEPROM) || defined(USE_TEXTCOMMAND)
156  static Output *firstOutput;
157  Output *nextOutput;
163  static Output* get(int id);
168  static void remove(int id);
173  static int count();
174 
175 #ifdef DCCPP_PRINT_DCCPP
176 
179  static void show();
180 #endif
181 
182 #if defined(USE_EEPROM)
183  int num;
188  static void load();
192  static void store();
193 #endif
194 
195 #endif
196 
197 #if defined(USE_TEXTCOMMAND)
198 
202  static bool parse(char *c);
210  static Output *create(int id, int pin, int iFlag);
211 #endif
212 
213 }; // Output
214 
215 #endif
216 #endif