1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-24 13:21:23 +01:00

Include file ckleaning

This commit is contained in:
Asbelos 2020-05-27 09:40:12 +01:00
parent 84a6e9759a
commit 54ef92085b
11 changed files with 43 additions and 6 deletions

View File

@ -1,3 +1,6 @@
#ifndef Config_h
#define Config_h
// This hardware configuration would normally be setup using a bunch of #ifdefs.
const byte MAIN_POWER_PIN = 3;
@ -14,3 +17,10 @@ const byte PROG_SENSE_PIN = A1;
const byte PROG_BRAKE_PIN = 10;
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

View File

@ -1,6 +1,7 @@
#include "DCC.h"
#include "DCCWaveform.h"
#include "DIAG.h"
// This module is responsible for converting API calls into
// messages to be sent to the waveform generator.
// It has no visibility of the hardware, timers, interrupts

6
DCC.h
View File

@ -1,5 +1,8 @@
#ifndef DCC_h
#define DCC_h
#include <Arduino.h>
const byte MAX_LOCOS=50;
#include "Config.h"
class DCC {
public:
@ -34,3 +37,4 @@ private:
static byte cv2(int cv);
};
#endif

View File

@ -1,4 +1,5 @@
#ifndef DCCWaveform_h
#define DCCWaveform_h
const int POWER_SAMPLE_MAX = 300;
@ -77,3 +78,4 @@ class DCCWaveform {
POWERMODE powerMode;
unsigned long nextSampleDue;
};
#endif

4
DIAG.h
View File

@ -1,5 +1,9 @@
#ifndef DIAG_h
#define DIAG_h
#include "StringParser.h"
#ifndef DIAG_ENABLED
#define DIAG_ENABLED true
#endif
#define DIAG if (DIAG_ENABLED) StringParser::print
#endif

View File

@ -1,4 +1,5 @@
#ifndef Hardware_h
#define Hardware_h
// Virtualised hardware Interface
class Hardware {
public:
@ -11,3 +12,4 @@ class Hardware {
static void setSingleCallback(int duration, void (*isr)());
static void resetSingleCallback(int duration);
};
#endif

View File

@ -1,4 +1,5 @@
#ifndef JMRIParser_h
#define JMRIParser_h
struct JMRIParser
{
static void parse(Stream & stream,const char * command);
@ -7,3 +8,4 @@ struct JMRIParser
static const int MAX_PARAMS=10;
static int p[MAX_PARAMS];
};
#endif

View File

@ -91,7 +91,7 @@ void JMRITurnout::parse(Stream & stream, int params, int p[]) {
}
///////////////// 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){
if (id<0 || id>=MAX_TURNOUTS || table[id].address!=0) return false;

View File

@ -1,4 +1,8 @@
#ifndef JMRITurnout_h
#define TMRITurnout_h
#include <Arduino.h>
#include "Config.h"
class JMRITurnout {
@ -21,6 +25,6 @@ class JMRITurnout {
byte subAddress;
bool thrown;
};
static const int MAX_TURNOUTS=50;
static TurnoutEntry table[MAX_TURNOUTS];
};
#endif

View File

@ -1,3 +1,6 @@
#ifndef Railcom_h
#define Railcom_h
#include <Arduino.h>
class Railcom {
public:
@ -9,3 +12,5 @@ class Railcom {
static const byte MAX_BUFFER=20;
static byte buffer[MAX_BUFFER];
};
#endif

View File

@ -1,3 +1,5 @@
#ifndef StringParser_h
#define StringParser_h
#include <Arduino.h>
class StringParser
{
@ -14,3 +16,4 @@ class StringParser
static const byte MAX_BUFFER=100;
static char buffer[MAX_BUFFER];
};
#endif