Ruthlessly remove old commented out and unused crap. Can get it back from history...
[freeems-vanilla.git] / src / injectionISRs.c
blob45ebb3b1733eb62b705b6132a018cfd08aeeb17a
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.
37 * @see injectorISR.c
39 * @author Fred Cooke
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){
52 // clear the flag
53 PITINTE |= 0x04;
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
60 // TODO
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 */
68 // TODO
71 /* Staged injection switch off timer */
72 void StagedOffISR(void){
73 // clear the flag
74 PITINTE |= 0x08;
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
81 // TODO
83 /* Clear the PIT3 flag */
84 // TODO
88 /* Define the variables correctly for each channel then import the code */
90 /* Channel 1 */
91 #define INJECTOR_CHANNEL_NUMBER 0
92 #define InjectorXISR Injector1ISR
93 #define STAGEDXOFF STAGED1OFF
94 #define STAGEDXON STAGED1ON
95 #include "inc/injectorISR.c"
96 #undef InjectorXISR
97 #undef STAGEDXOFF
98 #undef STAGEDXON
99 #undef INJECTOR_CHANNEL_NUMBER
101 /* Channel 2 */
102 #define INJECTOR_CHANNEL_NUMBER 1
103 #define InjectorXISR Injector2ISR
104 #define STAGEDXOFF STAGED2OFF
105 #define STAGEDXON STAGED2ON
106 #include "inc/injectorISR.c"
107 #undef InjectorXISR
108 #undef STAGEDXOFF
109 #undef STAGEDXON
110 #undef INJECTOR_CHANNEL_NUMBER
112 /* Channel 3 */
113 #define INJECTOR_CHANNEL_NUMBER 2
114 #define InjectorXISR Injector3ISR
115 #define STAGEDXOFF STAGED3OFF
116 #define STAGEDXON STAGED3ON
117 #include "inc/injectorISR.c"
118 #undef InjectorXISR
119 #undef STAGEDXOFF
120 #undef STAGEDXON
121 #undef INJECTOR_CHANNEL_NUMBER
123 /* Channel 4 */
124 #define INJECTOR_CHANNEL_NUMBER 3
125 #define InjectorXISR Injector4ISR
126 #define STAGEDXOFF STAGED4OFF
127 #define STAGEDXON STAGED4ON
128 #include "inc/injectorISR.c"
129 #undef InjectorXISR
130 #undef STAGEDXOFF
131 #undef STAGEDXON
132 #undef INJECTOR_CHANNEL_NUMBER
134 /* Channel 5 */
135 #define INJECTOR_CHANNEL_NUMBER 4
136 #define InjectorXISR Injector5ISR
137 #define STAGEDXOFF STAGED5OFF
138 #define STAGEDXON STAGED5ON
139 #include "inc/injectorISR.c"
140 #undef InjectorXISR
141 #undef STAGEDXOFF
142 #undef STAGEDXON
143 #undef INJECTOR_CHANNEL_NUMBER
145 /* Channel 6 */
146 #define INJECTOR_CHANNEL_NUMBER 5
147 #define InjectorXISR Injector6ISR
148 #define STAGEDXOFF STAGED6OFF
149 #define STAGEDXON STAGED6ON
150 #include "inc/injectorISR.c"
151 #undef InjectorXISR
152 #undef STAGEDXOFF
153 #undef STAGEDXON
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) */