injectionISRs.c

Go to the documentation of this file.
00001 /*      injectionISRs.c
00002 
00003         Copyright 2008 Fred Cooke
00004 
00005         This file is part of the FreeEMS project.
00006 
00007         FreeEMS software is free software: you can redistribute it and/or modify
00008         it under the terms of the GNU General Public License as published by
00009         the Free Software Foundation, either version 3 of the License, or
00010         (at your option) any later version.
00011 
00012         FreeEMS software is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016 
00017         You should have received a copy of the GNU General Public License
00018         along with any FreeEMS software.  If not, see <http://www.gnu.org/licenses/>.
00019 
00020         We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org
00021 
00022         Thank you for choosing FreeEMS to run your engine! */
00023 
00024 #define INJECTIONISRS_C
00025 #include "inc/freeEMS.h"
00026 #include "inc/interrupts.h"
00027 #include "inc/injectionISRs.h"
00028 
00029 /* Staged control algorithms for PIT2 and PIT3 */
00030 /* Staged injection switch on timer */
00031 void StagedOnISR(void){
00032         // clear the flag
00033         PITINTE |= 0x04;
00034 
00035         // bit bang on the correct injector channel
00036         // TODO figure out which channel and switch it
00037         // TODO set the flag for that channel
00038 
00039         // if there are other staged channels pending, schedule them and adjust the data
00040         // TODO
00041 
00042         /* If staged injection needs the end point scheduled, do it now (otherwise it will turn off naturally with the main injector) */
00043         if(!(fixedConfigs1.coreSettingsA & STAGED_END)){
00044                 // TODO schedule the end of staged injection with PIT 3
00045         }
00046 
00047         /* Clear the PIT2 flag */
00048         // TODO
00049 }
00050 
00051 /* Staged injection switch off timer */
00052 void StagedOffISR(void){
00053         // clear the flag
00054         PITINTE |= 0x08;
00055 
00056         // bit bang off the correct injector channel
00057         // TODO figure out which channel and switch it
00058         // TODO set the flag for that channel
00059 
00060         // if there are other staged channels pending, schedule them and adjust the data
00061         // TODO
00062 
00063         /* Clear the PIT3 flag */
00064         // TODO
00065 }
00066 
00067 
00068 /* Define the variables correctly for each channel then import the code */
00069 
00070 /* Channel 1 */
00071 #define INJECTOR_CHANNEL_NUMBER 0
00072 #define InjectorXISR Injector1ISR
00073 #define STAGEDXOFF STAGED1OFF
00074 #define STAGEDXON STAGED1ON
00075 #include "inc/injectorISR.c"
00076 #undef InjectorXISR
00077 #undef STAGEDXOFF
00078 #undef STAGEDXON
00079 #undef INJECTOR_CHANNEL_NUMBER
00080 
00081 /* Channel 2 */
00082 #define INJECTOR_CHANNEL_NUMBER 1
00083 #define InjectorXISR Injector2ISR
00084 #define STAGEDXOFF STAGED2OFF
00085 #define STAGEDXON STAGED2ON
00086 #include "inc/injectorISR.c"
00087 #undef InjectorXISR
00088 #undef STAGEDXOFF
00089 #undef STAGEDXON
00090 #undef INJECTOR_CHANNEL_NUMBER
00091 
00092 /* Channel 3 */
00093 #define INJECTOR_CHANNEL_NUMBER 2
00094 #define InjectorXISR Injector3ISR
00095 #define STAGEDXOFF STAGED3OFF
00096 #define STAGEDXON STAGED3ON
00097 #include "inc/injectorISR.c"
00098 #undef InjectorXISR
00099 #undef STAGEDXOFF
00100 #undef STAGEDXON
00101 #undef INJECTOR_CHANNEL_NUMBER
00102 
00103 /* Channel 4 */
00104 #define INJECTOR_CHANNEL_NUMBER 3
00105 #define InjectorXISR Injector4ISR
00106 #define STAGEDXOFF STAGED4OFF
00107 #define STAGEDXON STAGED4ON
00108 #include "inc/injectorISR.c"
00109 #undef InjectorXISR
00110 #undef STAGEDXOFF
00111 #undef STAGEDXON
00112 #undef INJECTOR_CHANNEL_NUMBER
00113 
00114 /* Channel 5 */
00115 #define INJECTOR_CHANNEL_NUMBER 4
00116 #define InjectorXISR Injector5ISR
00117 #define STAGEDXOFF STAGED5OFF
00118 #define STAGEDXON STAGED5ON
00119 #include "inc/injectorISR.c"
00120 #undef InjectorXISR
00121 #undef STAGEDXOFF
00122 #undef STAGEDXON
00123 #undef INJECTOR_CHANNEL_NUMBER
00124 
00125 /* Channel 6 */
00126 #define INJECTOR_CHANNEL_NUMBER 5
00127 #define InjectorXISR Injector6ISR
00128 #define STAGEDXOFF STAGED6OFF
00129 #define STAGEDXON STAGED6ON
00130 #include "inc/injectorISR.c"
00131 #undef InjectorXISR
00132 #undef STAGEDXOFF
00133 #undef STAGEDXON
00134 #undef INJECTOR_CHANNEL_NUMBER
00135 
00136 /* 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) */

Generated on Mon Dec 22 21:29:18 2008 for freeems by  doxygen 1.5.2