Remove custom datalog file and search path hack now redundant due to fully customisab...
[freeems-vanilla.git] / src / decoders / Listener.c
blobd5e999b185a9ba5944092b638141bb01e88928c2
1 /* FreeEMS - the open source engine management system
3 * Copyright 2011-2012 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
29 * @ingroup interruptHandlers
30 * @ingroup enginePositionRPMDecoders
32 * @brief Prevents main loop from running calculations and finishes quickly
34 * The purpose of this "decoder" is purely to listen to the inputs and trick the
35 * rest of the code into not running any calculations and just sending as many
36 * logs as it can.
38 * This is useful to get a smooth logic analyser or other high speed log free
39 * of gaps in the stream.
43 #define DECODER_IMPLEMENTATION_C
44 #define DECODER_MAX_CODE_TIME 666 // This is optimal!
45 #define NUMBER_OF_REAL_EVENTS 1 // no events really...
46 #define NUMBER_OF_VIRTUAL_EVENTS 1 // no events really...
48 #include "../inc/freeEMS.h"
49 #include "../inc/interrupts.h"
50 #include "../inc/decoderInterface.h"
52 void decoderInitPreliminary(){} // This decoder works with the defaults
53 void perDecoderReset(){} // Nothing special to reset for this code
55 const unsigned short eventAngles[] = {0}; // no events really...
56 const unsigned char eventValidForCrankSync[] = {0}; // no events really...
59 /* Keep disabling calcs as often as we can. */
60 void PrimaryRPMISR(){
61 /* Clear the interrupt flag for this input compare channel */
62 TFLG = 0x01;
63 DEBUG_TURN_PIN_ON(DECODER_BENCHMARKS, BIT0, PORTB);
64 // Count the number of both negative and positive going pulses seen.
65 KeyUserDebugs.primaryTeethSeen++;
66 /* Reset the clock for reading timeout */
67 Clocks.timeoutADCreadingClock = 0;
68 DEBUG_TURN_PIN_OFF(DECODER_BENCHMARKS, NBIT0, PORTB);
72 /* Keep disabling calcs as often as we can. */
73 void SecondaryRPMISR(){
74 /* Clear the interrupt flag for this input compare channel */
75 TFLG = 0x02;
76 DEBUG_TURN_PIN_ON(DECODER_BENCHMARKS, BIT1, PORTB);
77 // Count the number of both negative and positive going pulses seen.
78 KeyUserDebugs.secondaryTeethSeen++;
79 /* Reset the clock for reading timeout */
80 Clocks.timeoutADCreadingClock = 0;
81 DEBUG_TURN_PIN_OFF(DECODER_BENCHMARKS, NBIT1, PORTB);