Updated all .h, .x and .s files with new "please give us your changes" lines.
[freeems-vanilla.git] / src / injectionISRs.c
blobcbf452f623e00c863f72cd0c5f59ac904c3b90e1
1 /* injectionISRs.c
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){
35 // clear the flag
36 PITINTE |= 0x04;
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
43 // TODO
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 */
51 // TODO
54 /* Staged injection switch off timer */
55 void StagedOffISR(void){
56 // clear the flag
57 PITINTE |= 0x08;
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
64 // TODO
66 /* Clear the PIT3 flag */
67 // TODO
71 /* Define the variables correctly for each channel then import the code */
73 /* Channel 1 */
74 #define INJECTOR_CHANNEL_NUMBER 0
75 #define InjectorXISR Injector1ISR
76 #define STAGEDXOFF STAGED1OFF
77 #define STAGEDXON STAGED1ON
78 #include "inc/injectorISR.c"
79 #undef InjectorXISR
80 #undef STAGEDXOFF
81 #undef STAGEDXON
82 #undef INJECTOR_CHANNEL_NUMBER
84 /* Channel 2 */
85 #define INJECTOR_CHANNEL_NUMBER 1
86 #define InjectorXISR Injector2ISR
87 #define STAGEDXOFF STAGED2OFF
88 #define STAGEDXON STAGED2ON
89 #include "inc/injectorISR.c"
90 #undef InjectorXISR
91 #undef STAGEDXOFF
92 #undef STAGEDXON
93 #undef INJECTOR_CHANNEL_NUMBER
95 /* Channel 3 */
96 #define INJECTOR_CHANNEL_NUMBER 2
97 #define InjectorXISR Injector3ISR
98 #define STAGEDXOFF STAGED3OFF
99 #define STAGEDXON STAGED3ON
100 #include "inc/injectorISR.c"
101 #undef InjectorXISR
102 #undef STAGEDXOFF
103 #undef STAGEDXON
104 #undef INJECTOR_CHANNEL_NUMBER
106 /* Channel 4 */
107 #define INJECTOR_CHANNEL_NUMBER 3
108 #define InjectorXISR Injector4ISR
109 #define STAGEDXOFF STAGED4OFF
110 #define STAGEDXON STAGED4ON
111 #include "inc/injectorISR.c"
112 #undef InjectorXISR
113 #undef STAGEDXOFF
114 #undef STAGEDXON
115 #undef INJECTOR_CHANNEL_NUMBER
117 /* Channel 5 */
118 #define INJECTOR_CHANNEL_NUMBER 4
119 #define InjectorXISR Injector5ISR
120 #define STAGEDXOFF STAGED5OFF
121 #define STAGEDXON STAGED5ON
122 #include "inc/injectorISR.c"
123 #undef InjectorXISR
124 #undef STAGEDXOFF
125 #undef STAGEDXON
126 #undef INJECTOR_CHANNEL_NUMBER
128 /* Channel 6 */
129 #define INJECTOR_CHANNEL_NUMBER 5
130 #define InjectorXISR Injector6ISR
131 #define STAGEDXOFF STAGED6OFF
132 #define STAGEDXON STAGED6ON
133 #include "inc/injectorISR.c"
134 #undef InjectorXISR
135 #undef STAGEDXOFF
136 #undef STAGEDXON
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) */