mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-25 13:41:23 +01:00
Include file ckleaning
This commit is contained in:
parent
84a6e9759a
commit
54ef92085b
10
Config.h
10
Config.h
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef Config_h
|
||||||
|
#define Config_h
|
||||||
|
|
||||||
// This hardware configuration would normally be setup using a bunch of #ifdefs.
|
// This hardware configuration would normally be setup using a bunch of #ifdefs.
|
||||||
|
|
||||||
const byte MAIN_POWER_PIN = 3;
|
const byte MAIN_POWER_PIN = 3;
|
||||||
@ -14,3 +17,10 @@ const byte PROG_SENSE_PIN = A1;
|
|||||||
const byte PROG_BRAKE_PIN = 10;
|
const byte PROG_BRAKE_PIN = 10;
|
||||||
|
|
||||||
const float PROG_SENSE_FACTOR=1; // analgRead(PROG_SENSE_PIN) * PROG_SENSE_FACTOR = milliamps
|
const float PROG_SENSE_FACTOR=1; // analgRead(PROG_SENSE_PIN) * PROG_SENSE_FACTOR = milliamps
|
||||||
|
|
||||||
|
// Allocations with memory implications.. however tiny!
|
||||||
|
// Base system takes approx 500 bytes + 4 per loco and 3 per turnout.
|
||||||
|
const byte MAX_LOCOS=50;
|
||||||
|
const byte MAX_TURNOUTS=50;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
1
DCC.cpp
1
DCC.cpp
@ -1,6 +1,7 @@
|
|||||||
#include "DCC.h"
|
#include "DCC.h"
|
||||||
#include "DCCWaveform.h"
|
#include "DCCWaveform.h"
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
|
|
||||||
// This module is responsible for converting API calls into
|
// This module is responsible for converting API calls into
|
||||||
// messages to be sent to the waveform generator.
|
// messages to be sent to the waveform generator.
|
||||||
// It has no visibility of the hardware, timers, interrupts
|
// It has no visibility of the hardware, timers, interrupts
|
||||||
|
6
DCC.h
6
DCC.h
@ -1,5 +1,8 @@
|
|||||||
|
#ifndef DCC_h
|
||||||
|
#define DCC_h
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
const byte MAX_LOCOS=50;
|
#include "Config.h"
|
||||||
|
|
||||||
|
|
||||||
class DCC {
|
class DCC {
|
||||||
public:
|
public:
|
||||||
@ -34,3 +37,4 @@ private:
|
|||||||
static byte cv2(int cv);
|
static byte cv2(int cv);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
|
#ifndef DCCWaveform_h
|
||||||
|
#define DCCWaveform_h
|
||||||
|
|
||||||
|
|
||||||
const int POWER_SAMPLE_MAX = 300;
|
const int POWER_SAMPLE_MAX = 300;
|
||||||
@ -77,3 +78,4 @@ class DCCWaveform {
|
|||||||
POWERMODE powerMode;
|
POWERMODE powerMode;
|
||||||
unsigned long nextSampleDue;
|
unsigned long nextSampleDue;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
4
DIAG.h
4
DIAG.h
@ -1,5 +1,9 @@
|
|||||||
|
#ifndef DIAG_h
|
||||||
|
#define DIAG_h
|
||||||
|
|
||||||
#include "StringParser.h"
|
#include "StringParser.h"
|
||||||
#ifndef DIAG_ENABLED
|
#ifndef DIAG_ENABLED
|
||||||
#define DIAG_ENABLED true
|
#define DIAG_ENABLED true
|
||||||
#endif
|
#endif
|
||||||
#define DIAG if (DIAG_ENABLED) StringParser::print
|
#define DIAG if (DIAG_ENABLED) StringParser::print
|
||||||
|
#endif
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
|
#ifndef Hardware_h
|
||||||
|
#define Hardware_h
|
||||||
// Virtualised hardware Interface
|
// Virtualised hardware Interface
|
||||||
class Hardware {
|
class Hardware {
|
||||||
public:
|
public:
|
||||||
@ -11,3 +12,4 @@ class Hardware {
|
|||||||
static void setSingleCallback(int duration, void (*isr)());
|
static void setSingleCallback(int duration, void (*isr)());
|
||||||
static void resetSingleCallback(int duration);
|
static void resetSingleCallback(int duration);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
|
#ifndef JMRIParser_h
|
||||||
|
#define JMRIParser_h
|
||||||
struct JMRIParser
|
struct JMRIParser
|
||||||
{
|
{
|
||||||
static void parse(Stream & stream,const char * command);
|
static void parse(Stream & stream,const char * command);
|
||||||
@ -7,3 +8,4 @@ struct JMRIParser
|
|||||||
static const int MAX_PARAMS=10;
|
static const int MAX_PARAMS=10;
|
||||||
static int p[MAX_PARAMS];
|
static int p[MAX_PARAMS];
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
@ -91,7 +91,7 @@ void JMRITurnout::parse(Stream & stream, int params, int p[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////// ALL PRIVATE BELOW HERE //////////////////
|
///////////////// ALL PRIVATE BELOW HERE //////////////////
|
||||||
JMRITurnout::TurnoutEntry JMRITurnout::table[JMRITurnout::MAX_TURNOUTS];
|
JMRITurnout::TurnoutEntry JMRITurnout::table[MAX_TURNOUTS];
|
||||||
|
|
||||||
bool JMRITurnout::create(int id, int add, byte subAdd){
|
bool JMRITurnout::create(int id, int add, byte subAdd){
|
||||||
if (id<0 || id>=MAX_TURNOUTS || table[id].address!=0) return false;
|
if (id<0 || id>=MAX_TURNOUTS || table[id].address!=0) return false;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifndef JMRITurnout_h
|
||||||
|
#define TMRITurnout_h
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
class JMRITurnout {
|
class JMRITurnout {
|
||||||
|
|
||||||
@ -21,6 +25,6 @@ class JMRITurnout {
|
|||||||
byte subAddress;
|
byte subAddress;
|
||||||
bool thrown;
|
bool thrown;
|
||||||
};
|
};
|
||||||
static const int MAX_TURNOUTS=50;
|
|
||||||
static TurnoutEntry table[MAX_TURNOUTS];
|
static TurnoutEntry table[MAX_TURNOUTS];
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef Railcom_h
|
||||||
|
#define Railcom_h
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
class Railcom {
|
class Railcom {
|
||||||
public:
|
public:
|
||||||
@ -9,3 +12,5 @@ class Railcom {
|
|||||||
static const byte MAX_BUFFER=20;
|
static const byte MAX_BUFFER=20;
|
||||||
static byte buffer[MAX_BUFFER];
|
static byte buffer[MAX_BUFFER];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#ifndef StringParser_h
|
||||||
|
#define StringParser_h
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
class StringParser
|
class StringParser
|
||||||
{
|
{
|
||||||
@ -14,3 +16,4 @@ class StringParser
|
|||||||
static const byte MAX_BUFFER=100;
|
static const byte MAX_BUFFER=100;
|
||||||
static char buffer[MAX_BUFFER];
|
static char buffer[MAX_BUFFER];
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user