2017-01-18 16:34:33 -08:00
# ifndef SCHEDULEDIO_H
# define SCHEDULEDIO_H
2018-03-09 19:07:29 -08:00
//If coil inverse is on, set the output low, else set it high
//#define beginCoil1Charge() { configPage4.IgInv == 1 ? *ign1_pin_port &= ~(ign1_pin_mask); : *ign1_pin_port |= (ign1_pin_mask); } TACH_PULSE_LOW();
2017-01-18 16:34:33 -08:00
inline void beginCoil1Charge ( ) ;
inline void endCoil1Charge ( ) ;
inline void beginCoil2Charge ( ) ;
inline void endCoil2Charge ( ) ;
inline void beginCoil3Charge ( ) ;
inline void endCoil3Charge ( ) ;
inline void beginCoil4Charge ( ) ;
inline void endCoil4Charge ( ) ;
inline void beginCoil5Charge ( ) ;
inline void endCoil5Charge ( ) ;
2018-03-09 19:07:29 -08:00
inline void beginCoil6Charge ( ) ;
inline void endCoil6Charge ( ) ;
inline void beginCoil7Charge ( ) ;
inline void endCoil7Charge ( ) ;
inline void beginCoil8Charge ( ) ;
inline void endCoil8Charge ( ) ;
2017-08-23 00:18:59 -07:00
//The following functions are used specifically for the trailing coil on rotary engines. They are separate as they also control the switching of the trailing select pin
inline void beginTrailingCoilCharge ( ) ;
2017-08-23 07:55:44 -07:00
inline void endTrailingCoilCharge1 ( ) ;
inline void endTrailingCoilCharge2 ( ) ;
2018-07-19 06:26:31 -07:00
//And the combined versions of the above for simplicity
void beginCoil1and3Charge ( ) ;
void endCoil1and3Charge ( ) ;
void beginCoil2and4Charge ( ) ;
void endCoil2and4Charge ( ) ;
2017-08-23 00:18:59 -07:00
2017-10-23 22:54:18 -07:00
# define openInjector1() *inj1_pin_port |= (inj1_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ1)
# define closeInjector1() *inj1_pin_port &= ~(inj1_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ1)
# define openInjector2() *inj2_pin_port |= (inj2_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ2)
# define closeInjector2() *inj2_pin_port &= ~(inj2_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ2)
# define openInjector3() *inj3_pin_port |= (inj3_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ3)
# define closeInjector3() *inj3_pin_port &= ~(inj3_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ3)
# define openInjector4() *inj4_pin_port |= (inj4_pin_mask); BIT_SET(currentStatus.status1, BIT_STATUS1_INJ4)
# define closeInjector4() *inj4_pin_port &= ~(inj4_pin_mask); BIT_CLEAR(currentStatus.status1, BIT_STATUS1_INJ4)
2017-06-13 23:29:17 -07:00
# define openInjector5() *inj5_pin_port |= (inj5_pin_mask)
# define closeInjector5() *inj5_pin_port &= ~(inj5_pin_mask)
2018-01-22 21:14:03 -08:00
//Dynamic functions below
# define openInjector6() *inj6_pin_port |= (inj6_pin_mask);
# define closeInjector6() *inj6_pin_port &= ~(inj6_pin_mask);
# define openInjector7() *inj7_pin_port |= (inj7_pin_mask);
# define closeInjector7() *inj7_pin_port &= ~(inj7_pin_mask);
# define openInjector8() *inj8_pin_port |= (inj8_pin_mask);
# define closeInjector8() *inj8_pin_port &= ~(inj8_pin_mask);
2017-01-18 16:34:33 -08:00
2017-06-13 19:15:26 -07:00
# define openInjector1and4() openInjector1(); openInjector4()
# define closeInjector1and4() closeInjector1(); closeInjector4()
2017-06-20 20:00:58 -07:00
# define openInjector2and3() openInjector2(); openInjector3()
# define closeInjector2and3() closeInjector2(); closeInjector3()
2017-06-13 19:15:26 -07:00
//5 cylinder support doubles up injector 3 as being closese to inj 5 (Crank angle)
# define openInjector3and5() openInjector3(); openInjector5()
# define closeInjector3and5() closeInjector3(); closeInjector5()
2018-08-07 22:17:09 -07:00
# define coil1Low() (*ign1_pin_port &= ~(ign1_pin_mask))
# define coil1High() (*ign1_pin_port |= (ign1_pin_mask))
# define coil2Low() (*ign2_pin_port &= ~(ign2_pin_mask))
# define coil2High() (*ign2_pin_port |= (ign2_pin_mask))
# define coil3Low() (*ign3_pin_port &= ~(ign3_pin_mask))
# define coil3High() (*ign3_pin_port |= (ign3_pin_mask))
# define coil4Low() (*ign4_pin_port &= ~(ign4_pin_mask))
# define coil4High() (*ign4_pin_port |= (ign4_pin_mask))
2018-07-21 07:17:08 -07:00
void nullCallback ( ) ;
2018-07-19 06:26:31 -07:00
static byte coilHIGH = HIGH ;
static byte coilLOW = LOW ;
2017-06-13 19:15:26 -07:00
# endif