Speeduino
Loading...
Searching...
No Matches
globals.h
Go to the documentation of this file.
1
25#ifndef GLOBALS_H
26#define GLOBALS_H
27#include <Arduino.h>
28#include <SimplyAtomic.h>
29#include "table2d.h"
30#include "table3d.h"
31#include "statuses.h"
32#include "config_pages.h"
33
34#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
35 #define BOARD_MAX_DIGITAL_PINS 54 //digital pins +1
36 #define BOARD_MAX_IO_PINS 70 //digital pins + analog channels + 1
37 #define BOARD_MAX_ADC_PINS 15 //Number of analog pins
38 #ifndef LED_BUILTIN
39 #define LED_BUILTIN 13
40 #endif
41 #define CORE_AVR
42 #define BOARD_H "board_avr2560.h"
43 #ifndef INJ_CHANNELS
44 #define INJ_CHANNELS 4
45 #endif
46 #ifndef IGN_CHANNELS
47 #define IGN_CHANNELS 5
48 #endif
49
50 #if defined(__AVR_ATmega2561__)
51 //This is a workaround to avoid having to change all the references to higher ADC channels. We simply define the channels (Which don't exist on the 2561) as being the same as A0-A7
52 //These Analog inputs should never be used on any 2561 board definition (Because they don't exist on the MCU), so it will not cause any issues
53 #define A8 A0
54 #define A9 A1
55 #define A10 A2
56 #define A11 A3
57 #define A12 A4
58 #define A13 A5
59 #define A14 A6
60 #define A15 A7
61 #endif
62
63 //#define TIMER5_MICROS
64
65#elif defined(CORE_TEENSY)
66 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
67 #define CORE_TEENSY35
68 #define BOARD_H "board_teensy35.h"
69 #elif defined(__IMXRT1062__)
70 #define CORE_TEENSY41
71 #define BOARD_H "board_teensy41.h"
72 #endif
73 #define INJ_CHANNELS 8
74 #define IGN_CHANNELS 8
75
76#elif defined(STM32_MCU_SERIES) || defined(ARDUINO_ARCH_STM32) || defined(STM32)
77 #define BOARD_H "board_stm32_official.h"
78 #define CORE_STM32
79
80 #define BOARD_MAX_ADC_PINS NUM_ANALOG_INPUTS-1 //Number of analog pins from core.
81 #if defined(STM32F407xx) //F407 can do 8x8 STM32F401/STM32F411 don't
82 #define INJ_CHANNELS 8
83 #define IGN_CHANNELS 8
84 #else
85 #define INJ_CHANNELS 4
86 #define IGN_CHANNELS 5
87 #endif
88#elif defined(__SAMD21G18A__)
89 #define BOARD_H "board_samd21.h"
90 #define CORE_SAMD21
91 #define CORE_SAM
92 #define INJ_CHANNELS 4
93 #define IGN_CHANNELS 4
94#elif defined(__SAMC21J18A__)
95 #define BOARD_H "board_samc21.h"
96 #define CORE_SAMC21
97 #define CORE_SAM
98#elif defined(__SAME51J19A__)
99 #define BOARD_H "board_same51.h"
100 #define CORE_SAME51
101 #define CORE_SAM
102 #define INJ_CHANNELS 8
103 #define IGN_CHANNELS 8
104#else
105 #error Incorrect board selected. Please select the correct board (Usually Mega 2560) and upload again
106#endif
107
108//This can only be included after the above section
109#include BOARD_H //Note that this is not a real file, it is defined in globals.h.
110
111#define CRANK_ANGLE_MAX (max(CRANK_ANGLE_MAX_IGN, CRANK_ANGLE_MAX_INJ))
112
113#define interruptSafe(c) (noInterrupts(); {c} interrupts();) //Wraps any code between nointerrupt and interrupt calls
114
115#define MICROS_PER_SEC INT32_C(1000000)
116#define MICROS_PER_MIN INT32_C(MICROS_PER_SEC*60U)
117#define MICROS_PER_HOUR INT32_C(MICROS_PER_MIN*60U)
118
119#define SERIAL_PORT_PRIMARY 0
120#define SERIAL_PORT_SECONDARY 3
121
122#define BIT_TIMER_1HZ 0
123#define BIT_TIMER_4HZ 1
124#define BIT_TIMER_10HZ 2
125#define BIT_TIMER_15HZ 3
126#define BIT_TIMER_30HZ 4
127#define BIT_TIMER_50HZ 5
128#define BIT_TIMER_200HZ 6
129#define BIT_TIMER_1KHZ 7
130
131#ifndef UNIT_TEST
132#define TOOTH_LOG_SIZE 127U
133#else
134#define TOOTH_LOG_SIZE 1U
135#endif
136// Some code relies on TOOTH_LOG_SIZE being uint8_t.
137static_assert(TOOTH_LOG_SIZE<UINT8_MAX, "Check all uses of TOOTH_LOG_SIZE");
138
139#define O2_CALIBRATION_PAGE 2U
140#define IAT_CALIBRATION_PAGE 1U
141#define CLT_CALIBRATION_PAGE 0U
142
143// note the sequence of these defines which reference the bits used in a byte has moved when the third trigger & engine cycle was incorporated
144#define COMPOSITE_LOG_PRI 0
145#define COMPOSITE_LOG_SEC 1
146#define COMPOSITE_LOG_THIRD 2
147#define COMPOSITE_LOG_TRIG 3
148#define COMPOSITE_LOG_SYNC 4
149#define COMPOSITE_ENGINE_CYCLE 5
150
151#define OUTPUT_CONTROL_DIRECT 0
152#define OUTPUT_CONTROL_MC33810 10
153
154#define INJ1_CMD_BIT 0
155#define INJ2_CMD_BIT 1
156#define INJ3_CMD_BIT 2
157#define INJ4_CMD_BIT 3
158#define INJ5_CMD_BIT 4
159#define INJ6_CMD_BIT 5
160#define INJ7_CMD_BIT 6
161#define INJ8_CMD_BIT 7
162
163#define IGN1_CMD_BIT 0
164#define IGN2_CMD_BIT 1
165#define IGN3_CMD_BIT 2
166#define IGN4_CMD_BIT 3
167#define IGN5_CMD_BIT 4
168#define IGN6_CMD_BIT 5
169#define IGN7_CMD_BIT 6
170#define IGN8_CMD_BIT 7
171
172#define CALIBRATION_TABLE_SIZE 512
173#define CALIBRATION_TEMPERATURE_OFFSET 40
175#define OFFSET_FUELTRIM 127U
176#define OFFSET_IGNITION 40
177
178#define SERIAL_BUFFER_THRESHOLD 32
179
180#define LOGGER_CSV_SEPARATOR_SEMICOLON 0
181#define LOGGER_CSV_SEPARATOR_COMMA 1
182#define LOGGER_CSV_SEPARATOR_TAB 2
183#define LOGGER_CSV_SEPARATOR_SPACE 3
184
185#define LOGGER_DISABLED 0
186#define LOGGER_CSV 1
187#define LOGGER_BINARY 2
188
189#define LOGGER_RATE_1HZ 0
190#define LOGGER_RATE_4HZ 1
191#define LOGGER_RATE_10HZ 2
192#define LOGGER_RATE_30HZ 3
193
194#define LOGGER_FILENAMING_OVERWRITE 0
195#define LOGGER_FILENAMING_DATETIME 1
196#define LOGGER_FILENAMING_SEQENTIAL 2
197
198extern struct table3d16RpmLoad fuelTable; //16x16 fuel map
199extern struct table3d16RpmLoad fuelTable2; //16x16 fuel map
200extern struct table3d16RpmLoad ignitionTable; //16x16 ignition map
201extern struct table3d16RpmLoad ignitionTable2; //16x16 ignition map
202extern struct table3d16RpmLoad afrTable; //16x16 afr target map
203extern struct table3d8RpmLoad stagingTable; //8x8 fuel staging table
204extern struct table3d8RpmLoad boostTable; //8x8 boost map
205extern struct table3d8RpmLoad boostTableLookupDuty; //8x8 boost map
206extern struct table3d8RpmLoad vvtTable; //8x8 vvt map
207extern struct table3d8RpmLoad vvt2Table; //8x8 vvt map
208extern struct table3d8RpmLoad wmiTable; //8x8 wmi map
209
211
212extern trimTable3d trim1Table; //6x6 Fuel trim 1 map
213extern trimTable3d trim2Table; //6x6 Fuel trim 2 map
214extern trimTable3d trim3Table; //6x6 Fuel trim 3 map
215extern trimTable3d trim4Table; //6x6 Fuel trim 4 map
216extern trimTable3d trim5Table; //6x6 Fuel trim 5 map
217extern trimTable3d trim6Table; //6x6 Fuel trim 6 map
218extern trimTable3d trim7Table; //6x6 Fuel trim 7 map
219extern trimTable3d trim8Table; //6x6 Fuel trim 8 map
220
221extern struct table3d4RpmLoad dwellTable; //4x4 Dwell map
222extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
223extern struct table2D maeTable;
224extern struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
225extern struct table2D ASETable; //4 bin After Start Enrichment map (2D)
226extern struct table2D ASECountTable; //4 bin After Start duration map (2D)
227extern struct table2D PrimingPulseTable; //4 bin Priming pulsewidth map (2D)
228extern struct table2D crankingEnrichTable; //4 bin cranking Enrichment map (2D)
229extern struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D)
230extern struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D)
231extern struct table2D injectorAngleTable; //4 bin injector timing curve (2D)
232extern struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D)
233extern struct table2D baroFuelTable; //8 bin baro correction curve (2D)
234extern struct table2D IATRetardTable; //6 bin ignition adjustment based on inlet air temperature (2D)
235extern struct table2D idleTargetTable; //10 bin idle target table for idle timing (2D)
236extern struct table2D idleAdvanceTable; //6 bin idle advance adjustment table based on RPM difference (2D)
237extern struct table2D CLTAdvanceTable; //6 bin ignition adjustment based on coolant temperature (2D)
238extern struct table2D rotarySplitTable; //8 bin ignition split curve for rotary leading/trailing (2D)
239extern struct table2D flexFuelTable; //6 bin flex fuel correction table for fuel adjustments (2D)
240extern struct table2D flexAdvTable; //6 bin flex fuel correction table for timing advance (2D)
241extern struct table2D flexBoostTable; //6 bin flex fuel correction table for boost adjustments (2D)
242extern struct table2D fuelTempTable; //6 bin fuel temperature correction table for fuel adjustments (2D)
243extern struct table2D knockWindowStartTable;
245extern struct table2D oilPressureProtectTable;
246extern struct table2D wmiAdvTable; //6 bin wmi correction table for timing advance (2D)
247extern struct table2D coolantProtectTable; //6 bin coolant temperature protection table for engine protection (2D)
248extern struct table2D fanPWMTable;
249extern struct table2D rollingCutTable;
250
251//These are for the direct port manipulation of the injectors, coils and aux outputs
252extern volatile PORT_TYPE *inj1_pin_port;
253extern volatile PINMASK_TYPE inj1_pin_mask;
254extern volatile PORT_TYPE *inj2_pin_port;
255extern volatile PINMASK_TYPE inj2_pin_mask;
256extern volatile PORT_TYPE *inj3_pin_port;
257extern volatile PINMASK_TYPE inj3_pin_mask;
258extern volatile PORT_TYPE *inj4_pin_port;
259extern volatile PINMASK_TYPE inj4_pin_mask;
260extern volatile PORT_TYPE *inj5_pin_port;
261extern volatile PINMASK_TYPE inj5_pin_mask;
262extern volatile PORT_TYPE *inj6_pin_port;
263extern volatile PINMASK_TYPE inj6_pin_mask;
264extern volatile PORT_TYPE *inj7_pin_port;
265extern volatile PINMASK_TYPE inj7_pin_mask;
266extern volatile PORT_TYPE *inj8_pin_port;
267extern volatile PINMASK_TYPE inj8_pin_mask;
268
269extern volatile PORT_TYPE *ign1_pin_port;
270extern volatile PINMASK_TYPE ign1_pin_mask;
271extern volatile PORT_TYPE *ign2_pin_port;
272extern volatile PINMASK_TYPE ign2_pin_mask;
273extern volatile PORT_TYPE *ign3_pin_port;
274extern volatile PINMASK_TYPE ign3_pin_mask;
275extern volatile PORT_TYPE *ign4_pin_port;
276extern volatile PINMASK_TYPE ign4_pin_mask;
277extern volatile PORT_TYPE *ign5_pin_port;
278extern volatile PINMASK_TYPE ign5_pin_mask;
279extern volatile PORT_TYPE *ign6_pin_port;
280extern volatile PINMASK_TYPE ign6_pin_mask;
281extern volatile PORT_TYPE *ign7_pin_port;
282extern volatile PINMASK_TYPE ign7_pin_mask;
283extern volatile PORT_TYPE *ign8_pin_port;
284extern volatile PINMASK_TYPE ign8_pin_mask;
285
286extern volatile PORT_TYPE *tach_pin_port;
287extern volatile PINMASK_TYPE tach_pin_mask;
288extern volatile PORT_TYPE *pump_pin_port;
289extern volatile PINMASK_TYPE pump_pin_mask;
290
291extern volatile PORT_TYPE *flex_pin_port;
292extern volatile PINMASK_TYPE flex_pin_mask;
293
294extern volatile PORT_TYPE *triggerPri_pin_port;
295extern volatile PINMASK_TYPE triggerPri_pin_mask;
296extern volatile PORT_TYPE *triggerSec_pin_port;
297extern volatile PINMASK_TYPE triggerSec_pin_mask;
298extern volatile PORT_TYPE *triggerThird_pin_port;
299extern volatile PINMASK_TYPE triggerThird_pin_mask;
300
301extern byte triggerInterrupt;
302extern byte triggerInterrupt2;
303extern byte triggerInterrupt3;
304
305
306extern byte fpPrimeTime; //The time (in seconds, based on currentStatus.secl) that the fuel pump started priming
307extern uint8_t softLimitTime; //The time (in 0.1 seconds, based on seclx10) that the soft limiter started
308extern volatile uint16_t mainLoopCount;
309extern uint32_t revolutionTime; //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
310extern volatile unsigned long timer5_overflow_count; //Increments every time counter 5 overflows. Used for the fast version of micros()
311extern volatile unsigned long ms_counter; //A counter that increments once per ms
313extern volatile uint32_t toothHistory[TOOTH_LOG_SIZE];
315extern volatile unsigned int toothHistoryIndex;
316extern unsigned long currentLoopTime;
317extern volatile uint16_t ignitionCount;
318//The below shouldn't be needed and probably should be cleaned up, but the Atmel SAM (ARM) boards use a specific type for the trigger edge values rather than a simple byte/int
319#if defined(CORE_SAMD21)
323#else
324 extern byte primaryTriggerEdge;
325 extern byte secondaryTriggerEdge;
326 extern byte tertiaryTriggerEdge;
327#endif
328extern int CRANK_ANGLE_MAX_IGN;
329extern int CRANK_ANGLE_MAX_INJ;
330extern volatile uint32_t runSecsX10;
331extern volatile uint32_t seclx10;
332extern volatile byte HWTest_INJ;
333extern volatile byte HWTest_INJ_Pulsed;
334extern volatile byte HWTest_IGN;
335extern volatile byte HWTest_IGN_Pulsed;
336extern byte maxIgnOutputs;
337extern byte maxInjOutputs;
338extern byte resetControl;
339extern volatile byte TIMER_mask;
340extern volatile byte LOOP_TIMER;
341
342extern byte pinInjector1; //Output pin injector 1
343extern byte pinInjector2; //Output pin injector 2
344extern byte pinInjector3; //Output pin injector 3
345extern byte pinInjector4; //Output pin injector 4
346extern byte pinInjector5; //Output pin injector 5
347extern byte pinInjector6; //Output pin injector 6
348extern byte pinInjector7; //Output pin injector 7
349extern byte pinInjector8; //Output pin injector 8
350extern byte injectorOutputControl; //Specifies whether the injectors are controlled directly (Via an IO pin) or using something like the MC33810
351extern byte pinCoil1; //Pin for coil 1
352extern byte pinCoil2; //Pin for coil 2
353extern byte pinCoil3; //Pin for coil 3
354extern byte pinCoil4; //Pin for coil 4
355extern byte pinCoil5; //Pin for coil 5
356extern byte pinCoil6; //Pin for coil 6
357extern byte pinCoil7; //Pin for coil 7
358extern byte pinCoil8; //Pin for coil 8
359extern byte ignitionOutputControl; //Specifies whether the coils are controlled directly (Via an IO pin) or using something like the MC33810
360extern byte pinTrigger; //The CAS pin
361extern byte pinTrigger2; //The Cam Sensor pin known as secondary input
362extern byte pinTrigger3; //the 2nd cam sensor pin known as tertiary input
363extern byte pinTPS;//TPS input pin
364extern byte pinMAP; //MAP sensor pin
365extern byte pinEMAP; //EMAP sensor pin
366extern byte pinMAP2; //2nd MAP sensor (Currently unused)
367extern byte pinIAT; //IAT sensor pin
368extern byte pinCLT; //CLS sensor pin
369extern byte pinO2; //O2 Sensor pin
370extern byte pinO2_2; //second O2 pin
371extern byte pinBat; //Battery voltage pin
372extern byte pinDisplayReset; // OLED reset pin
373extern byte pinTachOut; //Tacho output
374extern byte pinFuelPump; //Fuel pump on/off
375extern byte pinIdle1; //Single wire idle control
376extern byte pinIdle2; //2 wire idle control (Not currently used)
377extern byte pinIdleUp; //Input for triggering Idle Up
378extern byte pinIdleUpOutput; //Output that follows (normal or inverted) the idle up pin
379extern byte pinCTPS; //Input for triggering closed throttle state
380extern byte pinFuel2Input; //Input for switching to the 2nd fuel table
381extern byte pinSpark2Input; //Input for switching to the 2nd ignition table
382extern byte pinSpareTemp1; // Future use only
383extern byte pinSpareTemp2; // Future use only
384extern byte pinSpareOut1; //Generic output
385extern byte pinSpareOut2; //Generic output
386extern byte pinSpareOut3; //Generic output
387extern byte pinSpareOut4; //Generic output
388extern byte pinSpareOut5; //Generic output
389extern byte pinSpareOut6; //Generic output
390extern byte pinSpareHOut1; //spare high current output
391extern byte pinSpareHOut2; // spare high current output
392extern byte pinSpareLOut1; // spare low current output
393extern byte pinSpareLOut2; // spare low current output
394extern byte pinSpareLOut3;
395extern byte pinSpareLOut4;
396extern byte pinSpareLOut5;
397extern byte pinBoost;
398extern byte pinVVT_1; // vvt output 1
399extern byte pinVVT_2; // vvt output 2
400extern byte pinFan; // Cooling fan output
401extern byte pinStepperDir; //Direction pin for the stepper motor driver
402extern byte pinStepperStep; //Step pin for the stepper motor driver
403extern byte pinStepperEnable; //Turning the DRV8825 driver on/off
404extern byte pinLaunch;
405extern byte pinIgnBypass; //The pin used for an ignition bypass (Optional)
406extern byte pinFlex; //Pin with the flex sensor attached
407extern byte pinVSS;
408extern byte pinBaro; //Pin that an external barometric pressure sensor is attached to (If used)
409extern byte pinResetControl; // Output pin used control resetting the Arduino
410extern byte pinFuelPressure;
411extern byte pinOilPressure;
412extern byte pinWMIEmpty; // Water tank empty sensor
413extern byte pinWMIIndicator; // No water indicator bulb
414extern byte pinWMIEnabled; // ON-OFF output to relay/pump/solenoid
415extern byte pinMC33810_1_CS;
416extern byte pinMC33810_2_CS;
417extern byte pinSDEnable; //Input for manually enabling SD logging
418#ifdef USE_SPI_EEPROM
419 extern byte pinSPIFlash_CS;
420#endif
421extern byte pinAirConComp; // Air conditioning compressor output
422extern byte pinAirConFan; // Stand-alone air conditioning fan output
423extern byte pinAirConRequest; // Air conditioning request input
424
425/* global variables */ // from speeduino.ino
426//#ifndef UNIT_TEST
427
428//#endif
429
430extern struct statuses currentStatus; //The global status object
431extern struct config2 configPage2;
432extern struct config4 configPage4;
433extern struct config6 configPage6;
434extern struct config9 configPage9;
435extern struct config10 configPage10;
436extern struct config13 configPage13;
437extern struct config15 configPage15;
438//extern byte cltCalibrationTable[CALIBRATION_TABLE_SIZE]; /**< An array containing the coolant sensor calibration values */
439//extern byte iatCalibrationTable[CALIBRATION_TABLE_SIZE]; /**< An array containing the inlet air temperature sensor calibration values */
440//extern byte o2CalibrationTable[CALIBRATION_TABLE_SIZE]; /**< An array containing the O2 sensor calibration values */
441
447extern uint8_t o2Calibration_values[32]; // Note 8-bit values
448extern struct table2D cltCalibrationTable;
449extern struct table2D iatCalibrationTable;
450extern struct table2D o2CalibrationTable;
452bool pinIsOutput(byte pin);
453bool pinIsUsed(byte pin);
454
455#endif // GLOBALS_H
The tune page structs and related defines.
volatile PINMASK_TYPE pump_pin_mask
Definition globals.cpp:93
byte pinTrigger3
the 2nd cam sensor pin
Definition globals.cpp:169
byte pinStepperEnable
Definition globals.cpp:210
volatile uint16_t ignitionCount
Definition globals.cpp:119
byte pinMC33810_2_CS
Definition globals.cpp:223
int CRANK_ANGLE_MAX_IGN
Definition globals.cpp:129
int CRANK_ANGLE_MAX_INJ
The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequ...
Definition globals.cpp:130
byte pinVSS
Definition globals.cpp:214
struct table2D PrimingPulseTable
4 bin Priming pulsewidth map (2D)
Definition globals.cpp:31
byte pinSpareLOut4
Definition globals.cpp:202
byte triggerInterrupt
byte pinSpareLOut2
Definition globals.cpp:200
byte pinFuelPump
Definition globals.cpp:181
table3d6RpmLoad trimTable3d
Definition globals.h:210
byte pinSpareOut6
Definition globals.cpp:196
byte pinCoil4
Pin for coil 4.
Definition globals.cpp:160
volatile PORT_TYPE * inj7_pin_port
Definition globals.cpp:68
volatile PINMASK_TYPE ign7_pin_mask
Definition globals.cpp:86
struct table3d8RpmLoad stagingTable
8x8 fuel staging table
Definition globals.cpp:11
struct table2D flexFuelTable
6 bin flex fuel correction table for fuel adjustments (2D)
Definition globals.cpp:43
struct table2D fuelTempTable
6 bin flex fuel correction table for fuel adjustments (2D)
Definition globals.cpp:46
struct table2D flexBoostTable
6 bin flex fuel correction table for boost adjustments (2D)
Definition globals.cpp:45
byte pinTrigger2
RPM2 (Typically the Cam Sensor) pin.
Definition globals.cpp:168
volatile PORT_TYPE * inj4_pin_port
Definition globals.cpp:62
byte pinTPS
Definition globals.cpp:170
uint16_t o2Calibration_bins[32]
Definition globals.cpp:251
byte injectorOutputControl
Definition globals.cpp:155
byte maxIgnOutputs
Definition globals.cpp:137
volatile PINMASK_TYPE ign2_pin_mask
Definition globals.cpp:76
struct statuses currentStatus
Definition auxiliaries.cpp:77
trimTable3d trim5Table
6x6 Fuel trim 5 map
Definition globals.cpp:21
volatile PORT_TYPE * flex_pin_port
Definition globals.cpp:95
byte pinFan
Cooling fan output (on/off? See: auxiliaries.ino)
Definition globals.cpp:207
volatile byte TIMER_mask
Definition globals.cpp:143
struct table2D fanPWMTable
Definition globals.cpp:52
struct table2D o2CalibrationTable
Definition globals.cpp:253
trimTable3d trim3Table
6x6 Fuel trim 3 map
Definition globals.cpp:19
byte pinBat
Definition globals.cpp:178
volatile uint32_t seclx10
Definition globals.cpp:132
byte pinTachOut
Definition globals.cpp:180
volatile PINMASK_TYPE inj5_pin_mask
Definition globals.cpp:65
byte pinO2_2
Definition globals.cpp:177
volatile PINMASK_TYPE flex_pin_mask
Definition globals.cpp:96
volatile PORT_TYPE * inj1_pin_port
volatile inj*_pin_port and inj*_pin_mask vars are for the direct port manipulation of the injectors,...
Definition globals.cpp:56
volatile PORT_TYPE * tach_pin_port
Definition globals.cpp:90
byte pinVVT_2
vvt (variable valve timing) output 2
Definition globals.cpp:206
struct table3d8RpmLoad vvt2Table
8x8 vvt2 map
Definition globals.cpp:15
struct table2D iatCalibrationTable
Definition globals.cpp:250
volatile unsigned int toothHistoryIndex
Current index to toothHistory array.
Definition globals.cpp:117
trimTable3d trim4Table
6x6 Fuel trim 4 map
Definition globals.cpp:20
byte pinAirConComp
Definition globals.cpp:228
struct table2D flexAdvTable
6 bin flex fuel correction table for timing advance (2D)
Definition globals.cpp:44
volatile PORT_TYPE * inj5_pin_port
Definition globals.cpp:64
volatile PINMASK_TYPE ign6_pin_mask
Definition globals.cpp:84
unsigned long currentLoopTime
Definition globals.cpp:118
volatile PINMASK_TYPE ign4_pin_mask
Definition globals.cpp:80
byte ignitionOutputControl
Definition globals.cpp:165
byte pinAirConFan
Definition globals.cpp:229
volatile uint32_t runSecsX10
Definition globals.cpp:131
volatile PINMASK_TYPE inj8_pin_mask
Definition globals.cpp:71
#define TOOTH_LOG_SIZE
Definition globals.h:132
uint16_t fixedCrankingOverride
Definition globals.cpp:112
struct table3d16RpmLoad afrTable
16x16 afr target map
Definition globals.cpp:10
volatile PORT_TYPE * inj2_pin_port
Definition globals.cpp:58
byte pinInjector3
Output pin injector 3.
Definition globals.cpp:149
byte triggerInterrupt2
byte pinInjector2
Output pin injector 2.
Definition globals.cpp:148
struct table2D idleAdvanceTable
6 bin idle advance adjustment table based on RPM difference (2D)
Definition globals.cpp:40
volatile byte HWTest_IGN_Pulsed
Definition globals.cpp:136
byte fpPrimeTime
The time (in seconds, based on statuses::secl) that the fuel pump started priming.
Definition globals.cpp:106
struct table3d16RpmLoad ignitionTable2
16x16 ignition map
Definition globals.cpp:9
volatile PORT_TYPE * ign8_pin_port
Definition globals.cpp:87
byte pinCTPS
Definition globals.cpp:186
byte pinMAP
Definition globals.cpp:171
byte pinCoil5
Pin for coil 5.
Definition globals.cpp:161
volatile PINMASK_TYPE inj4_pin_mask
Definition globals.cpp:63
bool pinIsOutput(byte pin)
Definition globals.cpp:256
byte pinWMIEnabled
Definition globals.cpp:221
byte maxInjOutputs
Definition globals.cpp:138
byte pinResetControl
Definition globals.cpp:216
byte secondaryTriggerEdge
Definition globals.cpp:126
byte pinSpareOut5
Definition globals.cpp:195
byte pinBoost
Definition globals.cpp:204
volatile PINMASK_TYPE ign5_pin_mask
Definition globals.cpp:82
byte resetControl
resetControl needs to be here (as global) because using the config page (4) directly can prevent burn...
Definition globals.cpp:141
byte pinIdleUp
Definition globals.cpp:184
byte pinIgnBypass
Definition globals.cpp:212
byte pinSpareTemp2
Definition globals.cpp:190
byte pinSpareOut3
Definition globals.cpp:193
byte pinCoil3
Pin for coil 3.
Definition globals.cpp:159
struct table2D knockWindowStartTable
Definition globals.cpp:47
volatile PORT_TYPE * pump_pin_port
Definition globals.cpp:92
volatile byte HWTest_INJ
Definition globals.cpp:133
byte pinBaro
Definition globals.cpp:215
byte pinCoil8
Pin for coil 8.
Definition globals.cpp:164
uint8_t o2Calibration_values[32]
Definition globals.cpp:252
volatile PORT_TYPE * ign5_pin_port
Definition globals.cpp:81
byte pinCLT
Definition globals.cpp:175
struct table3d16RpmLoad fuelTable2
16x16 fuel map
Definition globals.cpp:7
byte pinLaunch
Definition globals.cpp:211
struct table2D crankingEnrichTable
4 bin cranking Enrichment map (2D)
Definition globals.cpp:32
volatile PORT_TYPE * ign7_pin_port
Definition globals.cpp:85
uint16_t iatCalibration_bins[32]
Definition globals.cpp:248
trimTable3d trim6Table
6x6 Fuel trim 6 map
Definition globals.cpp:22
byte pinEMAP
Definition globals.cpp:172
struct table2D ASECountTable
4 bin After Start duration map (2D)
Definition globals.cpp:30
byte pinO2
Definition globals.cpp:176
byte pinTrigger
RPM1 (Typically CAS=crankshaft angle sensor) pin.
Definition globals.cpp:167
struct table2D CLTAdvanceTable
6 bin ignition adjustment based on coolant temperature (2D)
Definition globals.cpp:41
byte pinInjector6
Output pin injector 6.
Definition globals.cpp:152
struct table2D dwellVCorrectionTable
6 bin dwell voltage correction (2D)
Definition globals.cpp:33
byte pinStepperDir
Definition globals.cpp:208
byte pinSpareTemp1
Definition globals.cpp:189
byte pinSpark2Input
Definition globals.cpp:188
struct table2D oilPressureProtectTable
Definition globals.cpp:49
byte pinFlex
Definition globals.cpp:213
struct table2D injectorVCorrectionTable
6 bin injector voltage correction (2D)
Definition globals.cpp:34
byte pinCoil1
Pin for coil 1.
Definition globals.cpp:157
byte pinIAT
Definition globals.cpp:174
byte pinWMIEmpty
Definition globals.cpp:219
byte pinSpareHOut2
Definition globals.cpp:198
struct config15 configPage15
Definition globals.cpp:239
struct table3d8RpmLoad wmiTable
8x8 wmi map
Definition globals.cpp:16
byte pinInjector1
Various pin numbering (Injectors, Ign outputs, CAS, Cam, Sensors. etc.) assignments.
Definition globals.cpp:147
struct config10 configPage10
Definition globals.cpp:237
volatile byte LOOP_TIMER
Definition globals.cpp:144
volatile PORT_TYPE * inj6_pin_port
Definition globals.cpp:66
volatile PORT_TYPE * triggerSec_pin_port
Definition globals.cpp:100
byte pinWMIIndicator
Definition globals.cpp:220
byte pinSpareLOut1
Definition globals.cpp:199
byte pinInjector5
Output pin injector 5.
Definition globals.cpp:151
byte pinStepperStep
Definition globals.cpp:209
volatile unsigned long timer5_overflow_count
Definition globals.cpp:110
trimTable3d trim7Table
6x6 Fuel trim 7 map
Definition globals.cpp:23
struct table2D knockWindowDurationTable
Definition globals.cpp:48
byte pinSpareLOut5
Definition globals.cpp:203
byte pinSpareOut4
Definition globals.cpp:194
byte pinIdle1
Definition globals.cpp:182
volatile PINMASK_TYPE inj6_pin_mask
Definition globals.cpp:67
volatile byte HWTest_IGN
Definition globals.cpp:135
struct table3d4RpmLoad dwellTable
4x4 Dwell map
Definition globals.cpp:25
byte pinDisplayReset
Definition globals.cpp:179
struct table2D wmiAdvTable
Definition globals.cpp:50
byte pinVVT_1
vvt (variable valve timing) output 1
Definition globals.cpp:205
struct table3d8RpmLoad boostTable
8x8 boost map
Definition globals.cpp:12
struct config9 configPage9
Definition globals.cpp:236
struct table2D rotarySplitTable
8 bin ignition split curve for rotary leading/trailing (2D)
Definition globals.cpp:42
volatile PINMASK_TYPE inj3_pin_mask
Definition globals.cpp:61
struct table2D IATDensityCorrectionTable
9 bin inlet air temperature density correction (2D)
Definition globals.cpp:36
struct table2D IATRetardTable
6 bin ignition adjustment based on inlet air temperature (2D)
Definition globals.cpp:38
struct table2D coolantProtectTable
Definition globals.cpp:51
struct table2D injectorAngleTable
4 bin injector angle curve (2D)
Definition globals.cpp:35
volatile PORT_TYPE * ign3_pin_port
Definition globals.cpp:77
uint8_t softLimitTime
Definition globals.cpp:107
struct table2D taeTable
4 bin TPS Acceleration Enrichment map (2D)
Definition globals.cpp:26
byte pinIdle2
Definition globals.cpp:183
struct table3d16RpmLoad fuelTable
16x16 fuel map
Definition globals.cpp:6
volatile PINMASK_TYPE triggerThird_pin_mask
Definition globals.cpp:103
volatile PINMASK_TYPE triggerPri_pin_mask
Definition globals.cpp:99
volatile PINMASK_TYPE triggerSec_pin_mask
Definition globals.cpp:101
volatile PORT_TYPE * inj3_pin_port
Definition globals.cpp:60
byte triggerInterrupt3
volatile PORT_TYPE * inj8_pin_port
Definition globals.cpp:70
uint16_t cltCalibration_values[32]
Definition globals.cpp:246
byte pinSpareOut1
Definition globals.cpp:191
volatile byte HWTest_INJ_Pulsed
Definition globals.cpp:134
byte pinCoil6
Pin for coil 6.
Definition globals.cpp:162
volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]
Definition globals.cpp:116
byte pinInjector8
Output pin injector 8.
Definition globals.cpp:154
struct table2D maeTable
Definition globals.cpp:27
byte pinInjector7
Output pin injector 7.
Definition globals.cpp:153
volatile PINMASK_TYPE inj7_pin_mask
Definition globals.cpp:69
byte pinAirConRequest
Definition globals.cpp:230
struct config13 configPage13
Definition globals.cpp:238
byte pinSpareLOut3
Definition globals.cpp:201
volatile unsigned long ms_counter
Definition globals.cpp:111
byte primaryTriggerEdge
Definition globals.cpp:125
struct config6 configPage6
Definition globals.cpp:235
volatile uint16_t mainLoopCount
Definition globals.cpp:108
byte pinMAP2
Definition globals.cpp:173
byte pinSpareOut2
Definition globals.cpp:192
struct table2D idleTargetTable
10 bin idle target table for idle timing (2D)
Definition globals.cpp:39
struct config2 configPage2
Definition globals.cpp:233
byte pinMC33810_1_CS
Definition globals.cpp:222
volatile PORT_TYPE * ign2_pin_port
Definition globals.cpp:75
struct table3d8RpmLoad boostTableLookupDuty
8x8 boost map lookup table
Definition globals.cpp:13
byte pinFuel2Input
Definition globals.cpp:187
volatile PORT_TYPE * ign4_pin_port
Definition globals.cpp:79
byte pinFuelPressure
Definition globals.cpp:217
byte pinSDEnable
Definition globals.cpp:224
volatile uint32_t toothHistory[TOOTH_LOG_SIZE]
Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)
Definition globals.cpp:115
volatile PINMASK_TYPE inj2_pin_mask
Definition globals.cpp:59
volatile PINMASK_TYPE ign1_pin_mask
Definition globals.cpp:74
bool pinIsUsed(byte pin)
Definition globals.cpp:311
trimTable3d trim2Table
6x6 Fuel trim 2 map
Definition globals.cpp:18
uint16_t cltCalibration_bins[32]
Definition globals.cpp:245
struct config4 configPage4
Definition globals.cpp:234
volatile PINMASK_TYPE tach_pin_mask
Definition globals.cpp:91
byte tertiaryTriggerEdge
Definition globals.cpp:127
volatile PORT_TYPE * ign6_pin_port
Definition globals.cpp:83
byte pinCoil2
Pin for coil 2.
Definition globals.cpp:158
byte pinSpareHOut1
Definition globals.cpp:197
volatile PINMASK_TYPE ign3_pin_mask
Definition globals.cpp:78
volatile PINMASK_TYPE ign8_pin_mask
Definition globals.cpp:88
byte pinOilPressure
Definition globals.cpp:218
volatile PORT_TYPE * triggerThird_pin_port
Definition globals.cpp:102
volatile PORT_TYPE * ign1_pin_port
Definition globals.cpp:73
byte pinIdleUpOutput
Definition globals.cpp:185
struct table2D WUETable
10 bin Warm Up Enrichment map (2D)
Definition globals.cpp:28
volatile PORT_TYPE * triggerPri_pin_port
Definition globals.cpp:98
byte pinInjector4
Output pin injector 4.
Definition globals.cpp:150
struct table2D cltCalibrationTable
Definition globals.cpp:247
struct table3d16RpmLoad ignitionTable
16x16 ignition map
Definition globals.cpp:8
volatile PINMASK_TYPE inj1_pin_mask
Definition globals.cpp:57
byte pinCoil7
Pin for coil 7.
Definition globals.cpp:163
trimTable3d trim1Table
6x6 Fuel trim 1 map
Definition globals.cpp:17
struct table2D rollingCutTable
Definition globals.cpp:53
uint16_t iatCalibration_values[32]
Definition globals.cpp:249
struct table2D ASETable
4 bin After Start Enrichment map (2D)
Definition globals.cpp:29
uint32_t revolutionTime
Definition globals.cpp:109
trimTable3d trim8Table
6x6 Fuel trim 8 map
Definition globals.cpp:24
struct table2D baroFuelTable
8 bin baro correction curve (2D)
Definition globals.cpp:37
struct table3d8RpmLoad vvtTable
8x8 vvt map
Definition globals.cpp:14
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
The statuses struct and related defines.
Definition config_pages.h:712
Definition config_pages.h:906
Definition config_pages.h:959
Definition config_pages.h:249
Definition config_pages.h:425
Definition config_pages.h:528
Definition config_pages.h:630
The status struct with current values for all 'live' variables.
Definition statuses.h:98
Definition table2d.h:17
3D table data types and functions