3 Copyright 2008 Fred Cooke
5 This file is part of the FreeEMS project.
7 FreeEMS software is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 FreeEMS software is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
20 We ask that if you make any changes to this file you email them upstream to
21 us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
23 Thank you for choosing FreeEMS to run your engine! */
26 #define INJECTIONISRS_C
27 #include "inc/freeEMS.h"
28 #include "inc/interrupts.h"
29 #include "inc/injectionISRs.h"
32 /* Staged control algorithms for PIT2 and PIT3 */
33 /* Staged injection switch on timer */
34 void StagedOnISR(void){
38 // bit bang on the correct injector channel
39 // TODO figure out which channel and switch it
40 // TODO set the flag for that channel
42 // if there are other staged channels pending, schedule them and adjust the data
45 /* If staged injection needs the end point scheduled, do it now (otherwise it will turn off naturally with the main injector) */
46 if(!(fixedConfigs1
.coreSettingsA
& STAGED_END
)){
47 // TODO schedule the end of staged injection with PIT 3
50 /* Clear the PIT2 flag */
54 /* Staged injection switch off timer */
55 void StagedOffISR(void){
59 // bit bang off the correct injector channel
60 // TODO figure out which channel and switch it
61 // TODO set the flag for that channel
63 // if there are other staged channels pending, schedule them and adjust the data
66 /* Clear the PIT3 flag */
71 /* Define the variables correctly for each channel then import the code */
74 #define INJECTOR_CHANNEL_NUMBER 0
75 #define InjectorXISR Injector1ISR
76 #define STAGEDXOFF STAGED1OFF
77 #define STAGEDXON STAGED1ON
78 #include "inc/injectorISR.c"
82 #undef INJECTOR_CHANNEL_NUMBER
85 #define INJECTOR_CHANNEL_NUMBER 1
86 #define InjectorXISR Injector2ISR
87 #define STAGEDXOFF STAGED2OFF
88 #define STAGEDXON STAGED2ON
89 #include "inc/injectorISR.c"
93 #undef INJECTOR_CHANNEL_NUMBER
96 #define INJECTOR_CHANNEL_NUMBER 2
97 #define InjectorXISR Injector3ISR
98 #define STAGEDXOFF STAGED3OFF
99 #define STAGEDXON STAGED3ON
100 #include "inc/injectorISR.c"
104 #undef INJECTOR_CHANNEL_NUMBER
107 #define INJECTOR_CHANNEL_NUMBER 3
108 #define InjectorXISR Injector4ISR
109 #define STAGEDXOFF STAGED4OFF
110 #define STAGEDXON STAGED4ON
111 #include "inc/injectorISR.c"
115 #undef INJECTOR_CHANNEL_NUMBER
118 #define INJECTOR_CHANNEL_NUMBER 4
119 #define InjectorXISR Injector5ISR
120 #define STAGEDXOFF STAGED5OFF
121 #define STAGEDXON STAGED5ON
122 #include "inc/injectorISR.c"
126 #undef INJECTOR_CHANNEL_NUMBER
129 #define INJECTOR_CHANNEL_NUMBER 5
130 #define InjectorXISR Injector6ISR
131 #define STAGEDXOFF STAGED6OFF
132 #define STAGEDXON STAGED6ON
133 #include "inc/injectorISR.c"
137 #undef INJECTOR_CHANNEL_NUMBER
139 /* If switching to 8 OC channels with non-IC engine input, place two more sets of defines here :-) (along with all the other mods needed of course) */