miscISRs.c

Go to the documentation of this file.
00001 /*      miscISRs.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 #include "inc/freeEMS.h"
00025 #include "inc/interrupts.h"
00026 #include "inc/miscISRs.h"
00027 
00028 /* Unimplemented interrupt service routine */
00029 void UISR(void){
00030         /* Increment the unimplemnted ISR execution counter */
00031         Counters.UISRCounter++;
00032 }
00033 
00034 void PortPISR(void){
00035         /* Clear all port P flags (we only want one at a time) */
00036         PIFP = ONES;
00037         /* Increment the unimplemnted ISR execution counter */
00038         Counters.UISRCounter++;
00039 }                       /* Port P interrupt service routine */
00040 
00041 /* Port J interrupt service routine */
00042 void PortJISR(void){
00043         /* Clear all port H flags (we only want one at a time) */
00044         PIFJ = ONES;
00045         /* Increment the unimplemnted ISR execution counter */
00046         Counters.UISRCounter++;
00047 }
00048 
00049 /* Port H interrupt service routine */
00050 void PortHISR(void)
00051 {
00052 //      // read the interrupt flags to a variable
00053 //      unsigned char portHFlags = PIFH;
00054 //      portHFlags &= 0xF8; // mask out the other bits
00055 //
00056 //      /* Clear all port H flags (we only want one at a time) */
00057         PIFH = ONES;
00058 //
00059 //      // Toggle a LED so we can see if the code ran
00060         PORTA ^= 0x80; // Fuel pump pin (A7)
00061 //
00062         // debounce
00063         if(portHDebounce == 0){
00064                 portHDebounce = 2;
00065         }else{
00066                 return;
00067         }
00068 //
00069 //      // find out which pin triggered it, clear the flag, perform the action.
00070 //      switch(portHFlags)
00071 //      {
00072 //      case 0x80 :     // Increment cylinder count and set port count appropriately.
00073 //              switch (configs.combustionEventsPerEngineCycle) {
00074 //                      case 1 :
00075 //                              configs.combustionEventsPerEngineCycle = 2;
00076 //                              configs.ports = 2;
00077 //                              break;
00078 //                      case 2 :
00079 //                              configs.combustionEventsPerEngineCycle = 3;
00080 //                              configs.ports = 3;
00081 //                              break;
00082 //                      case 3 :
00083 //                              configs.combustionEventsPerEngineCycle = 4;
00084 //                              configs.ports = 4;
00085 //                              break;
00086 //                      case 4 :
00087 //                              configs.combustionEventsPerEngineCycle = 5;
00088 //                              configs.ports = 5;
00089 //                              break;
00090 //                      case 5 :
00091 //                              configs.combustionEventsPerEngineCycle = 6;
00092 //                              configs.ports = 6;
00093 //                              break;
00094 //                      case 6 :
00095 //                              configs.combustionEventsPerEngineCycle = 8;
00096 //                              configs.ports = 4;
00097 //                              break;
00098 //                      case 8 :
00099 //                              configs.combustionEventsPerEngineCycle = 10;
00100 //                              configs.ports = 5;
00101 //                              break;
00102 //                      case 10 :
00103 //                              configs.combustionEventsPerEngineCycle = 12;
00104 //                              configs.ports = 6;
00105 //                              break;
00106 //                      case 12 :
00107 //                              configs.combustionEventsPerEngineCycle = 1;
00108 //                              configs.ports = 1;
00109 //                              break;
00110 //              }
00111 //              break;
00112 //      case 0x40 : // Injection output enable/disable
00113 //              if(coreSettingsA & FUEL_CUT){
00114 //                      coreSettingsA &= FUEL_CUT_OFF;
00115 //              }else{
00116 //                      coreSettingsA |= FUEL_CUT;
00117 //              }
00118 //              break;
00119 //      case 0x20 : // Ignition output enable/disable
00120 //              if(coreSettingsA & HARD_SPARK_CUT){
00121 //                      coreSettingsA &= HARD_SPARK_CUT_OFF;
00122 //              }else{
00123 //                      coreSettingsA |= HARD_SPARK_CUT;
00124 //              }
00125 //              break;
00126 //      case 0x10 : // Staged injection enable/disable
00127 //              if(coreSettingsA & STAGED_ON){
00128 //                      coreSettingsA &= STAGED_OFF;
00129 //              }else{
00130 //                      coreSettingsA |= STAGED_ON;
00131 //              }
00132 //              break;
00133 //      case 0x08 : // Staged injection start sched/fixed
00134 //              if(coreSettingsA & STAGED_START){
00135 //                      coreSettingsA &= CLEAR_STAGED_START;
00136 //              }else{
00137 //                      coreSettingsA |= STAGED_START;
00138 //              }
00139 //              break;
00140 //      case 0x04 : // Staged injection end sched/fixed
00141 //              if(coreSettingsA & STAGED_END){
00142 //                      coreSettingsA &= CLEAR_STAGED_END;
00143 //              }else{
00144 //                      coreSettingsA |= STAGED_END;
00145 //              }
00146 //              break;
00147 //      case 0x02 : // free input
00148 //              break;
00149 //      case 0x01 : // free input
00150 //              break;
00151 //      default : // Two or more pressed, nothing to do except wait for another button press
00152 //              break;
00153 //      }
00154 }
00155 
00156 /* IRQ/PE1 interrupt service routine */
00157 void IRQISR(void){
00158         /* Clear the flag */
00159         // ?? TODO
00160 
00161         /* Increment the unimplemnted ISR execution counter */
00162         Counters.UISRCounter++;
00163 }
00164 
00165 /* XIRQ/PE0 interrupt service routine */
00166 void XIRQISR(void){
00167         /* Clear the flag */
00168         // ?? TODO
00169 
00170         /* Increment the unimplemnted ISR execution counter */
00171         Counters.UISRCounter++;
00172 }
00173 
00174 /* Count how often our voltage goes too low without resetting */
00175 void LowVoltageISR(void){
00176         /* Clear the flag */
00177         VREGCTRL |= 0x01;
00178 
00179         /* Increment the counter */
00180         Counters.lowVoltISRCounter++;
00181 }

Generated on Mon Nov 10 21:18:50 2008 for freeems by  doxygen 1.5.2