Minor cleanup for compiling on Teensy with MC33810
This commit is contained in:
parent
11c3c97280
commit
b02b33d4bf
|
@ -28,7 +28,7 @@ platform=teensy
|
|||
board=teensy35
|
||||
framework=arduino
|
||||
lib_deps = EEPROM, FlexCAN, SD
|
||||
build_flags = -DUSE_MC33810 -DUSE_SPI_EEPROM
|
||||
build_flags = -DUSE_MC33810 ;-DUSE_SPI_EEPROM
|
||||
|
||||
[env:teensy40]
|
||||
platform=teensy
|
||||
|
|
|
@ -15,6 +15,7 @@ Flood clear mode etc.
|
|||
|
||||
#include "globals.h"
|
||||
#include "corrections.h"
|
||||
#include "speeduino.h"
|
||||
#include "timers.h"
|
||||
#include "maths.h"
|
||||
#include "sensors.h"
|
||||
|
|
|
@ -1085,11 +1085,11 @@ extern byte pinBaro; //Pin that an external barometric pressure sensor is attach
|
|||
extern byte pinResetControl; // Output pin used control resetting the Arduino
|
||||
#ifdef USE_MC33810
|
||||
//If the MC33810 IC\s are in use, these are the chip select pins
|
||||
byte pinMC33810_1_CS;
|
||||
byte pinMC33810_2_CS;
|
||||
extern byte pinMC33810_1_CS;
|
||||
extern byte pinMC33810_2_CS;
|
||||
#endif
|
||||
#ifdef USE_SPI_EEPROM
|
||||
byte pinSPIFlash_CS;
|
||||
extern byte pinSPIFlash_CS;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "idle.h"
|
||||
#include "table.h"
|
||||
#include BOARD_H //Note that this is not a real file, it is defined in globals.h.
|
||||
#include EEPROM_LIB_H
|
||||
|
||||
void initialiseAll()
|
||||
{
|
||||
|
@ -1774,18 +1775,19 @@ void setPinMapping(byte boardID)
|
|||
MC33810_BIT_INJ2 = 1;
|
||||
MC33810_BIT_INJ3 = 0;
|
||||
MC33810_BIT_INJ4 = 2;
|
||||
MC33810_BIT_IGN1 = 5;
|
||||
MC33810_BIT_IGN2 = 6;
|
||||
MC33810_BIT_IGN3 = 7;
|
||||
MC33810_BIT_IGN4 = 8;
|
||||
MC33810_BIT_IGN1 = 4;
|
||||
MC33810_BIT_IGN2 = 5;
|
||||
MC33810_BIT_IGN3 = 6;
|
||||
MC33810_BIT_IGN4 = 7;
|
||||
|
||||
MC33810_BIT_INJ5 = 3;
|
||||
MC33810_BIT_INJ6 = 1;
|
||||
MC33810_BIT_INJ7 = 0;
|
||||
MC33810_BIT_INJ8 = 2;
|
||||
MC33810_BIT_IGN5 = 5;
|
||||
MC33810_BIT_IGN6 = 6;
|
||||
MC33810_BIT_IGN7 = 7;
|
||||
MC33810_BIT_IGN8 = 8;
|
||||
MC33810_BIT_IGN5 = 4;
|
||||
MC33810_BIT_IGN6 = 5;
|
||||
MC33810_BIT_IGN7 = 6;
|
||||
MC33810_BIT_IGN8 = 7;
|
||||
#endif
|
||||
|
||||
#ifdef USE_SPI_EEPROM
|
||||
|
@ -2182,9 +2184,9 @@ void setPinMapping(byte boardID)
|
|||
ign8_pin_port = portOutputRegister(digitalPinToPort(pinCoil8));
|
||||
ign8_pin_mask = digitalPinToBitMask(pinCoil8);
|
||||
#else
|
||||
mc33810_1_pin_port = portOutputRegister(pinMC33810_1_CS);
|
||||
mc33810_1_pin_port = portOutputRegister(digitalPinToPort(pinMC33810_1_CS));
|
||||
mc33810_1_pin_mask = digitalPinToBitMask(pinMC33810_1_CS);
|
||||
mc33810_2_pin_port = portOutputRegister(pinMC33810_2_CS);
|
||||
mc33810_2_pin_port = portOutputRegister(digitalPinToPort(pinMC33810_2_CS));
|
||||
mc33810_2_pin_mask = digitalPinToBitMask(pinMC33810_2_CS);
|
||||
|
||||
initMC33810();
|
||||
|
|
|
@ -3,39 +3,77 @@
|
|||
#include "globals.h"
|
||||
#include "timers.h"
|
||||
|
||||
inline void beginCoil1Charge() { digitalWrite(pinCoil1, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil1Charge() { digitalWrite(pinCoil1, coilLOW); }
|
||||
#ifndef USE_MC33810
|
||||
inline void beginCoil1Charge() { digitalWrite(pinCoil1, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil1Charge() { digitalWrite(pinCoil1, coilLOW); }
|
||||
|
||||
inline void beginCoil2Charge() { digitalWrite(pinCoil2, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil2Charge() { digitalWrite(pinCoil2, coilLOW); }
|
||||
inline void beginCoil2Charge() { digitalWrite(pinCoil2, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil2Charge() { digitalWrite(pinCoil2, coilLOW); }
|
||||
|
||||
inline void beginCoil3Charge() { digitalWrite(pinCoil3, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil3Charge() { digitalWrite(pinCoil3, coilLOW); }
|
||||
inline void beginCoil3Charge() { digitalWrite(pinCoil3, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil3Charge() { digitalWrite(pinCoil3, coilLOW); }
|
||||
|
||||
inline void beginCoil4Charge() { digitalWrite(pinCoil4, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil4Charge() { digitalWrite(pinCoil4, coilLOW); }
|
||||
inline void beginCoil4Charge() { digitalWrite(pinCoil4, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil4Charge() { digitalWrite(pinCoil4, coilLOW); }
|
||||
|
||||
inline void beginCoil5Charge() { digitalWrite(pinCoil5, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil5Charge() { digitalWrite(pinCoil5, coilLOW); }
|
||||
inline void beginCoil5Charge() { digitalWrite(pinCoil5, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil5Charge() { digitalWrite(pinCoil5, coilLOW); }
|
||||
|
||||
inline void beginCoil6Charge() { digitalWrite(pinCoil6, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil6Charge() { digitalWrite(pinCoil6, coilLOW); }
|
||||
inline void beginCoil6Charge() { digitalWrite(pinCoil6, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil6Charge() { digitalWrite(pinCoil6, coilLOW); }
|
||||
|
||||
inline void beginCoil7Charge() { digitalWrite(pinCoil7, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil7Charge() { digitalWrite(pinCoil7, coilLOW); }
|
||||
inline void beginCoil7Charge() { digitalWrite(pinCoil7, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil7Charge() { digitalWrite(pinCoil7, coilLOW); }
|
||||
|
||||
inline void beginCoil8Charge() { digitalWrite(pinCoil8, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil8Charge() { digitalWrite(pinCoil8, coilLOW); }
|
||||
inline void beginCoil8Charge() { digitalWrite(pinCoil8, coilHIGH); tachoOutputFlag = READY; }
|
||||
inline void endCoil8Charge() { digitalWrite(pinCoil8, coilLOW); }
|
||||
|
||||
//The below 3 calls are all part of the rotary ignition mode
|
||||
inline void beginTrailingCoilCharge() { digitalWrite(pinCoil2, coilHIGH); }
|
||||
inline void endTrailingCoilCharge1() { digitalWrite(pinCoil2, coilLOW); *ign3_pin_port |= ign3_pin_mask; } //Sets ign3 (Trailing select) high
|
||||
inline void endTrailingCoilCharge2() { digitalWrite(pinCoil2, coilLOW); *ign3_pin_port &= ~(ign3_pin_mask); } //sets ign3 (Trailing select) low
|
||||
//The below 3 calls are all part of the rotary ignition mode
|
||||
inline void beginTrailingCoilCharge() { digitalWrite(pinCoil2, coilHIGH); }
|
||||
inline void endTrailingCoilCharge1() { digitalWrite(pinCoil2, coilLOW); *ign3_pin_port |= ign3_pin_mask; } //Sets ign3 (Trailing select) high
|
||||
inline void endTrailingCoilCharge2() { digitalWrite(pinCoil2, coilLOW); *ign3_pin_port &= ~(ign3_pin_mask); } //sets ign3 (Trailing select) low
|
||||
|
||||
//As above but for ignition (Wasted COP mode)
|
||||
void beginCoil1and3Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil3, coilHIGH); tachoOutputFlag = READY; }
|
||||
void endCoil1and3Charge() { digitalWrite(pinCoil1, coilLOW); digitalWrite(pinCoil3, coilLOW); }
|
||||
void beginCoil2and4Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pinCoil4, coilHIGH); tachoOutputFlag = READY; }
|
||||
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); }
|
||||
//As above but for ignition (Wasted COP mode)
|
||||
void beginCoil1and3Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil3, coilHIGH); tachoOutputFlag = READY; }
|
||||
void endCoil1and3Charge() { digitalWrite(pinCoil1, coilLOW); digitalWrite(pinCoil3, coilLOW); }
|
||||
void beginCoil2and4Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pinCoil4, coilHIGH); tachoOutputFlag = READY; }
|
||||
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); }
|
||||
#else
|
||||
//This really should be combined with the above code at some point, but need to write a neat macro to handle coilHIGH vs coilLOW
|
||||
inline void beginCoil1Charge() { coil1High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil1Charge() { coil1Low(); }
|
||||
|
||||
inline void beginCoil2Charge() { coil2High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil2Charge() { coil2Low(); }
|
||||
|
||||
inline void beginCoil3Charge() { coil3High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil3Charge() { coil3Low(); }
|
||||
|
||||
inline void beginCoil4Charge() { coil4High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil4Charge() { coil4Low(); }
|
||||
|
||||
inline void beginCoil5Charge() { coil5High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil5Charge() { coil5Low(); }
|
||||
|
||||
inline void beginCoil6Charge() { coil6High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil6Charge() { coil6Low(); }
|
||||
|
||||
inline void beginCoil7Charge() { coil7High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil7Charge() { coil7Low(); }
|
||||
|
||||
inline void beginCoil8Charge() { coil8High(); tachoOutputFlag = READY; }
|
||||
inline void endCoil8Charge() { coil8Low(); }
|
||||
|
||||
//The below 3 calls are all part of the rotary ignition mode
|
||||
inline void beginTrailingCoilCharge() { digitalWrite(pinCoil2, coilHIGH); }
|
||||
inline void endTrailingCoilCharge1() { digitalWrite(pinCoil2, coilLOW); *ign3_pin_port |= ign3_pin_mask; } //Sets ign3 (Trailing select) high
|
||||
inline void endTrailingCoilCharge2() { digitalWrite(pinCoil2, coilLOW); *ign3_pin_port &= ~(ign3_pin_mask); } //sets ign3 (Trailing select) low
|
||||
|
||||
//As above but for ignition (Wasted COP mode)
|
||||
void beginCoil1and3Charge() { digitalWrite(pinCoil1, coilHIGH); digitalWrite(pinCoil3, coilHIGH); tachoOutputFlag = READY; }
|
||||
void endCoil1and3Charge() { digitalWrite(pinCoil1, coilLOW); digitalWrite(pinCoil3, coilLOW); }
|
||||
void beginCoil2and4Charge() { digitalWrite(pinCoil2, coilHIGH); digitalWrite(pinCoil4, coilHIGH); tachoOutputFlag = READY; }
|
||||
void endCoil2and4Charge() { digitalWrite(pinCoil2, coilLOW); digitalWrite(pinCoil4, coilLOW); }
|
||||
#endif
|
||||
|
||||
void nullCallback() { return; }
|
||||
|
|
Loading…
Reference in New Issue