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 #include "inc/freeEMS.h"
27 #include "inc/interrupts.h"
30 /* Unimplemented interrupt service routine */
32 /* Increment the unimplemented ISR execution counter */
33 Counters
.callsToUISRs
++;
38 /* Clear all port P flags (we only want one at a time) */
40 /* Increment the unimplemented ISR execution counter */
41 Counters
.callsToUISRs
++;
42 } /* Port P interrupt service routine */
45 /* Port J interrupt service routine */
47 /* Clear all port H flags (we only want one at a time) */
49 /* Increment the unimplemented ISR execution counter */
50 Counters
.callsToUISRs
++;
54 /* Port H interrupt service routine */
57 // // read the interrupt flags to a variable
58 // unsigned char portHFlags = PIFH;
59 // portHFlags &= 0xF8; // mask out the other bits
61 // /* Clear all port H flags (we only want one at a time) */
64 // // Toggle a LED so we can see if the code ran
65 PORTA
^= 0x80; // Fuel pump pin (A7)
68 if(portHDebounce
== 0){
74 // // find out which pin triggered it, clear the flag, perform the action.
77 // case 0x80 : // Increment cylinder count and set port count appropriately.
78 // switch (configs.combustionEventsPerEngineCycle) {
80 // configs.combustionEventsPerEngineCycle = 2;
84 // configs.combustionEventsPerEngineCycle = 3;
88 // configs.combustionEventsPerEngineCycle = 4;
92 // configs.combustionEventsPerEngineCycle = 5;
96 // configs.combustionEventsPerEngineCycle = 6;
100 // configs.combustionEventsPerEngineCycle = 8;
101 // configs.ports = 4;
104 // configs.combustionEventsPerEngineCycle = 10;
105 // configs.ports = 5;
108 // configs.combustionEventsPerEngineCycle = 12;
109 // configs.ports = 6;
112 // configs.combustionEventsPerEngineCycle = 1;
113 // configs.ports = 1;
117 // case 0x40 : // Injection output enable/disable
118 // if(coreSettingsA & FUEL_CUT){
119 // coreSettingsA &= FUEL_CUT_OFF;
121 // coreSettingsA |= FUEL_CUT;
124 // case 0x20 : // Ignition output enable/disable
125 // if(coreSettingsA & HARD_SPARK_CUT){
126 // coreSettingsA &= HARD_SPARK_CUT_OFF;
128 // coreSettingsA |= HARD_SPARK_CUT;
131 // case 0x10 : // Staged injection enable/disable
132 // if(coreSettingsA & STAGED_ON){
133 // coreSettingsA &= STAGED_OFF;
135 // coreSettingsA |= STAGED_ON;
138 // case 0x08 : // Staged injection start sched/fixed
139 // if(coreSettingsA & STAGED_START){
140 // coreSettingsA &= CLEAR_STAGED_START;
142 // coreSettingsA |= STAGED_START;
145 // case 0x04 : // Staged injection end sched/fixed
146 // if(coreSettingsA & STAGED_END){
147 // coreSettingsA &= CLEAR_STAGED_END;
149 // coreSettingsA |= STAGED_END;
152 // case 0x02 : // free input
154 // case 0x01 : // free input
156 // default : // Two or more pressed, nothing to do except wait for another button press
162 /* IRQ/PE1 interrupt service routine */
167 /* Increment the unimplemented ISR execution counter */
168 Counters
.callsToUISRs
++;
172 /* XIRQ/PE0 interrupt service routine */
177 /* Increment the unimplemented ISR execution counter */
178 Counters
.callsToUISRs
++;
182 /* Count how often our voltage goes too low without resetting */
183 void LowVoltageISR(void){
187 /* Increment the counter */
188 Counters
.lowVoltageConditions
++;