1 /* FreeEMS - the open source engine management system
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!
27 /** @file injectionISRs.c
28 * @ingroup interruptHandlers
30 * @brief Injection ISR substitutions
32 * This file defines the pin specific names for each interrupt and all of it's
33 * pin specific variables then imports the actual code from inc/injectorISR.c
34 * for each pin such that each one is unique and references a separate set of
35 * values specific to it while only maintaining a single copy of the code.
43 #define INJECTIONISRS_C
44 #include "inc/freeEMS.h"
45 #include "inc/interrupts.h"
46 #include "inc/injectionISRs.h"
49 /* Staged control algorithms for PIT2 and PIT3 */
50 /* Staged injection switch on timer */
51 void StagedOnISR(void){
55 // bit bang on the correct injector channel
56 // TODO figure out which channel and switch it
57 // TODO set the flag for that channel
59 // if there are other staged channels pending, schedule them and adjust the data
62 /* If staged injection needs the end point scheduled, do it now (otherwise it will turn off naturally with the main injector) */
63 if(!(fixedConfigs1
.coreSettingsA
& STAGED_END
)){
64 // TODO schedule the end of staged injection with PIT 3
67 /* Clear the PIT2 flag */
71 /* Staged injection switch off timer */
72 void StagedOffISR(void){
76 // bit bang off the correct injector channel
77 // TODO figure out which channel and switch it
78 // TODO set the flag for that channel
80 // if there are other staged channels pending, schedule them and adjust the data
83 /* Clear the PIT3 flag */
88 /* Define the variables correctly for each channel then import the code */
91 #define INJECTOR_CHANNEL_NUMBER 0
92 #define InjectorXISR Injector1ISR
93 #define STAGEDXOFF STAGED1OFF
94 #define STAGEDXON STAGED1ON
95 #include "inc/injectorISR.c"
99 #undef INJECTOR_CHANNEL_NUMBER
102 #define INJECTOR_CHANNEL_NUMBER 1
103 #define InjectorXISR Injector2ISR
104 #define STAGEDXOFF STAGED2OFF
105 #define STAGEDXON STAGED2ON
106 #include "inc/injectorISR.c"
110 #undef INJECTOR_CHANNEL_NUMBER
113 #define INJECTOR_CHANNEL_NUMBER 2
114 #define InjectorXISR Injector3ISR
115 #define STAGEDXOFF STAGED3OFF
116 #define STAGEDXON STAGED3ON
117 #include "inc/injectorISR.c"
121 #undef INJECTOR_CHANNEL_NUMBER
124 #define INJECTOR_CHANNEL_NUMBER 3
125 #define InjectorXISR Injector4ISR
126 #define STAGEDXOFF STAGED4OFF
127 #define STAGEDXON STAGED4ON
128 #include "inc/injectorISR.c"
132 #undef INJECTOR_CHANNEL_NUMBER
135 #define INJECTOR_CHANNEL_NUMBER 4
136 #define InjectorXISR Injector5ISR
137 #define STAGEDXOFF STAGED5OFF
138 #define STAGEDXON STAGED5ON
139 #include "inc/injectorISR.c"
143 #undef INJECTOR_CHANNEL_NUMBER
146 #define INJECTOR_CHANNEL_NUMBER 5
147 #define InjectorXISR Injector6ISR
148 #define STAGEDXOFF STAGED6OFF
149 #define STAGEDXON STAGED6ON
150 #include "inc/injectorISR.c"
154 #undef INJECTOR_CHANNEL_NUMBER
156 /* 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) */