Add scope guards to header files

This commit is contained in:
Fredrik Johansson 2015-02-14 14:11:43 +01:00
parent 38778c0c49
commit 4dd9b2a4a5
11 changed files with 45 additions and 2 deletions

View File

@ -1,3 +1,6 @@
#ifndef COMMS_H
#define COMMS_H
#define vePage 1
#define ignPage 2
#define afrPage 3
@ -12,3 +15,5 @@ void sendPage();
void receiveCalibration(byte tableID);
void sendToothLog(bool useChar);
void testComm();
#endif // COMMS_H

View File

@ -2,6 +2,9 @@
All functions in the gamma file return
*/
#ifndef CORRECTIONS_H
#define CORRECTIONS_H
//static byte numCorrections = 2;
byte correctionsTotal();
@ -10,3 +13,5 @@ byte correctionASE(); //After Start Enrichment
byte correctionAccel(); //Acceleration Enrichment
byte correctionsFloodClear(); //Check for flood clear on cranking
byte correctionsAFRClosedLoop(); //Closed loop AFR adjustment
#endif // CORRECTIONS_H

View File

@ -1,3 +1,6 @@
#ifndef FASTANALOG_H
#define FASTANALOG_H
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
@ -5,4 +8,5 @@
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
#endif // FASTANALOG_H

View File

@ -1,3 +1,5 @@
#ifndef GLOBALS_H
#define GLOBALS_H
#include <Arduino.h>
const byte ms_version = 20;
@ -270,3 +272,5 @@ struct config3 {
#define pinCLT A3 //CLS sensor pin
#define pinO2 A4 //O2 Sensor pin
*/
#endif // GLOBALS_H

4
math.h
View File

@ -1,3 +1,5 @@
#ifndef MATH_H
#define MATH_H
//Replace the standard arduino map() function to use the div function instead
int fastMap(int x, int in_min, int in_max, int out_min, int out_max)
@ -49,3 +51,5 @@ int divs100(int n) {
return q + ((r + 28) >> 7);
// return q + (r > 99);
}
#endif // MATH_H

View File

@ -22,6 +22,8 @@ See page 136 of the processors datasheet: http://www.atmel.com/Images/doc2549.pd
256 prescale gives overflow every 1048576uS (This means maximum wait time is 1.0485 seconds)
*/
#ifndef SCHEDULER_H
#define SCHEDULER_H
#include <avr/interrupt.h>
#include <avr/io.h>
@ -54,3 +56,5 @@ Schedule ignitionSchedule1;
Schedule ignitionSchedule2;
Schedule ignitionSchedule3;
Schedule ignitionSchedule4;
#endif // SCHEDULER_H

View File

@ -1,3 +1,5 @@
#ifndef STORAGE_H
#define STORAGE_H
#include <EEPROM.h>
void writeConfig();
@ -59,3 +61,4 @@ Current layout of EEPROM data (Version 2) is as follows (All sizes are in bytes)
#define EEPROM_CALIBRATION_IAT 3071
#define EEPROM_CALIBRATION_CLT 3583
#endif // STORAGE_H

View File

@ -1,6 +1,8 @@
/*
This file is used for everything related to maps/tables including their definition, functions etc
*/
#ifndef TABLE_H
#define TABLE_H
#include <Arduino.h>
/*
@ -46,3 +48,5 @@ Eg: 2x2 table
*/
int get3DTableValue(struct table3D, int, int);
int table2D_getValue(struct table2D, int);
#endif // TABLE_H

View File

@ -1,7 +1,8 @@
/*
This file has a few functions that are helpful for testing such as creating dummy maps and faking interrupts
*/
#ifndef TESTING_H
#define TESTING_H
/*
Aim is to create an 8x8 table that looks like the below:
MAP
@ -105,3 +106,5 @@ void dummyIgnitionTable(struct table3D *mySparkTable)
for (byte x = 0; x< mySparkTable->xSize; x++) { mySparkTable->values[7][x] = tempRow8[x]; }
}
#endif // TESTING_H

View File

@ -16,6 +16,8 @@ We're after a 1ms interval so we'll need 131 intervals to reach this ( 1ms / 0.0
Hence we will preload the timer with 131 cycles to leave 125 until overflow (1ms).
*/
#ifndef TIMERS_H
#define TIMERS_H
volatile int loop250ms;
volatile int loopSec;
@ -24,4 +26,4 @@ volatile unsigned long targetOverdwellTime;
void initialiseTimers();
#endif TIMERS_H

View File

@ -1,6 +1,9 @@
/*
These are some utility functions and variables used through the main code
*/
#ifndef UTILS_H
#define UTILS_H
#include <Arduino.h>
#define MS_IN_MINUTE 60000
#define US_IN_MINUTE 60000000
@ -10,3 +13,5 @@ int AIRDEN();
unsigned int PW();
unsigned int PW_SD();
unsigned int PW_AN();
#endif // UTILS_H