7 #define READ_PRI_TRIGGER() ((*triggerPri_pin_port & triggerPri_pin_mask) ? true : false)
8 #define READ_SEC_TRIGGER() ((*triggerSec_pin_port & triggerSec_pin_mask) ? true : false)
9 #define READ_THIRD_TRIGGER() ((*triggerThird_pin_port & triggerThird_pin_mask) ? true : false)
11 #define READ_PRI_TRIGGER() digitalRead(pinTrigger)
12 #define READ_SEC_TRIGGER() digitalRead(pinTrigger2)
13 #define READ_THIRD_TRIGGER() digitalRead(pinTrigger3)
16#define DECODER_MISSING_TOOTH 0
17#define DECODER_BASIC_DISTRIBUTOR 1
18#define DECODER_DUAL_WHEEL 2
22#define DECODER_JEEP2000 6
23#define DECODER_AUDI135 7
24#define DECODER_HONDA_D17 8
25#define DECODER_MIATA_9905 9
26#define DECODER_MAZDA_AU 10
27#define DECODER_NON360 11
28#define DECODER_NISSAN_360 12
29#define DECODER_SUBARU_67 13
30#define DECODER_DAIHATSU_PLUS1 14
31#define DECODER_HARLEY 15
32#define DECODER_36_2_2_2 16
33#define DECODER_36_2_1 17
34#define DECODER_420A 18
35#define DECODER_WEBER 19
36#define DECODER_ST170 20
37#define DECODER_DRZ400 21
39#define DECODER_VMAX 23
40#define DECODER_RENIX 24
41#define DECODER_ROVERMEMS 25
42#define DECODER_SUZUKI_K6A 26
43#define DECODER_HONDA_J32 27
45#define BIT_DECODER_2ND_DERIV 0
46#define BIT_DECODER_IS_SEQUENTIAL 1
47#define BIT_DECODER_UNUSED1 2
48#define BIT_DECODER_HAS_SECONDARY 3
49#define BIT_DECODER_HAS_FIXED_CRANKING 4
50#define BIT_DECODER_VALID_TRIGGER 5
51#define BIT_DECODER_TOOTH_ANG_CORRECT 6
53#define TRIGGER_FILTER_OFF 0
54#define TRIGGER_FILTER_LITE 1
55#define TRIGGER_FILTER_MEDIUM 2
56#define TRIGGER_FILTER_AGGRESSIVE 3
288extern volatile unsigned long curTime;
289extern volatile unsigned long curGap;
290extern volatile unsigned long curTime2;
291extern volatile unsigned long curGap2;
292extern volatile unsigned long lastGap;
330#define CRANK_SPEED 0U
334#define TOOTH_CAM_SECONDARY 1
335#define TOOTH_CAM_TERTIARY 2
338#define ID_TOOTH_PATTERN 0
void(* triggerSetEndTeeth)(void)
Pointer to the getCrank Angle function (Gets pointed to the relevant decoder)
Definition decoders.cpp:57
volatile unsigned long toothLastMinusOneSecToothTime
Definition decoders.cpp:79
byte checkSyncToothCount
Definition decoders.cpp:107
unsigned int triggerSecFilterTime_duration
Definition decoders.cpp:105
void triggerSec_DRZ400(void)
Definition decoders.cpp:4515
volatile unsigned long curGap2
Definition decoders.cpp:65
unsigned long lastCrankAngleCalc
Definition decoders.cpp:109
uint16_t ignition8EndTooth
Definition decoders.cpp:119
unsigned long lastVVTtime
Definition decoders.cpp:110
volatile unsigned long triggerSecFilterTime
Definition decoders.cpp:100
volatile unsigned long targetGap
Definition decoders.cpp:69
volatile uint8_t decoderState
Definition decoders.cpp:103
volatile unsigned long curTime2
Definition decoders.cpp:64
int16_t toothAngles[24]
Definition decoders.cpp:121
volatile unsigned long toothSystemLastToothTime
Definition decoders.cpp:74
void(* triggerSecondaryHandler)(void)
Pointer for the trigger function (Gets pointed to the relevant decoder)
Definition decoders.cpp:53
volatile unsigned long lastGap
Definition decoders.cpp:68
uint16_t ignition1EndTooth
Definition decoders.cpp:112
void triggerSetup_DRZ400(void)
Definition decoders.cpp:4501
volatile unsigned long secondaryLastToothTime1
Definition decoders.cpp:92
unsigned long elapsedTime
Definition decoders.cpp:108
volatile uint16_t triggerToothAngle
Definition decoders.cpp:106
void(* triggerTertiaryHandler)(void)
Pointer for the secondary trigger function (Gets pointed to the relevant decoder)
Definition decoders.cpp:54
volatile unsigned long curTime
Definition decoders.cpp:62
volatile uint16_t toothCurrentCount
Definition decoders.cpp:72
uint16_t ignition2EndTooth
Definition decoders.cpp:113
volatile unsigned long secondaryLastToothTime
Definition decoders.cpp:91
volatile unsigned long toothOneTime
Definition decoders.cpp:84
volatile unsigned long toothLastMinusOneToothTime
Definition decoders.cpp:78
int(* getCrankAngle)(void)
Pointer to the getRPM function (Gets pointed to the relevant decoder)
Definition decoders.cpp:56
uint16_t triggerActualTeeth
Definition decoders.cpp:98
volatile unsigned long curGap
Definition decoders.cpp:63
volatile unsigned long targetGap2
Definition decoders.cpp:82
void(* triggerHandler)(void)
Definition decoders.cpp:52
uint16_t ignition7EndTooth
Definition decoders.cpp:118
uint16_t ignition6EndTooth
Definition decoders.cpp:117
uint16_t(* getRPM)(void)
Pointer for the tertiary trigger function (Gets pointed to the relevant decoder)
Definition decoders.cpp:55
uint16_t ignition3EndTooth
Definition decoders.cpp:114
volatile unsigned long triggerFilterTime
Definition decoders.cpp:99
volatile unsigned long toothLastThirdToothTime
Definition decoders.cpp:77
uint16_t ignition4EndTooth
Definition decoders.cpp:115
volatile bool revolutionOne
Definition decoders.cpp:86
uint16_t ignition5EndTooth
Definition decoders.cpp:116
volatile unsigned long toothOneMinusOneTime
Definition decoders.cpp:85
int getCrankAngle_SuzukiK6A(void)
Definition decoders.cpp:5917
void triggerPri_SuzukiK6A(void)
Definition decoders.cpp:5691
void triggerSetup_SuzukiK6A(void)
Definition decoders.cpp:5644
uint16_t getRPM_SuzukiK6A(void)
Definition decoders.cpp:5905
void triggerSetEndTeeth_SuzukiK6A(void)
Definition decoders.cpp:5959
void triggerSec_SuzukiK6A(void)
Definition decoders.cpp:5900
void triggerSec_ThirtySixMinus21(void)
Definition decoders.cpp:4021
void triggerSetEndTeeth_ThirtySixMinus21(void)
Definition decoders.cpp:4050
int getCrankAngle_ThirtySixMinus21(void)
Definition decoders.cpp:4044
uint16_t getRPM_ThirtySixMinus21(void)
Definition decoders.cpp:4026
void triggerSetup_ThirtySixMinus21(void)
Definition decoders.cpp:3935
void triggerPri_ThirtySixMinus21(void)
Definition decoders.cpp:3951
void triggerSec_ThirtySixMinus222(void)
Definition decoders.cpp:3862
uint16_t getRPM_ThirtySixMinus222(void)
Definition decoders.cpp:3867
void triggerSetEndTeeth_ThirtySixMinus222(void)
Definition decoders.cpp:3896
int getCrankAngle_ThirtySixMinus222(void)
Definition decoders.cpp:3890
void triggerSetup_ThirtySixMinus222(void)
Definition decoders.cpp:3755
void triggerPri_ThirtySixMinus222(void)
Definition decoders.cpp:3771
void triggerPri_Audi135(void)
Definition decoders.cpp:2110
void triggerSetEndTeeth_Audi135(void)
Definition decoders.cpp:2205
int getCrankAngle_Audi135(void)
Definition decoders.cpp:2173
void triggerSec_Audi135(void)
Definition decoders.cpp:2148
void triggerSetup_Audi135(void)
Definition decoders.cpp:2096
uint16_t getRPM_Audi135(void)
Definition decoders.cpp:2168
void triggerPri_Daihatsu(void)
Definition decoders.cpp:3480
void triggerSetEndTeeth_Daihatsu(void)
Definition decoders.cpp:3601
int getCrankAngle_Daihatsu(void)
Definition decoders.cpp:3576
void triggerSec_Daihatsu(void)
Definition decoders.cpp:3548
void triggerSetup_Daihatsu(void)
Definition decoders.cpp:3450
uint16_t getRPM_Daihatsu(void)
Definition decoders.cpp:3550
uint16_t getRPM_BasicDistributor(void)
Definition decoders.cpp:1176
void triggerSec_BasicDistributor(void)
Definition decoders.cpp:1175
void triggerSetup_BasicDistributor(void)
Definition decoders.cpp:1096
void triggerSetEndTeeth_BasicDistributor(void)
Definition decoders.cpp:1222
int getCrankAngle_BasicDistributor(void)
Definition decoders.cpp:1195
void triggerPri_BasicDistributor(void)
Definition decoders.cpp:1119
void triggerSetup_420a(void)
Definition decoders.cpp:4066
uint16_t getRPM_420a(void)
Definition decoders.cpp:4182
int getCrankAngle_420a(void)
Definition decoders.cpp:4197
void triggerSetEndTeeth_420a(void)
Definition decoders.cpp:4222
void triggerSec_420a(void)
Definition decoders.cpp:4137
void triggerPri_420a(void)
Definition decoders.cpp:4098
void triggerPri_DualWheel(void)
Definition decoders.cpp:921
int getCrankAngle_DualWheel(void)
Definition decoders.cpp:1020
void triggerSec_DualWheel(void)
Definition decoders.cpp:966
void triggerSetEndTeeth_DualWheel(void)
Definition decoders.cpp:1064
void triggerSetup_DualWheel(void)
Definition decoders.cpp:901
uint16_t getRPM_DualWheel(void)
Definition decoders.cpp:1000
void triggerSetEndTeeth_FordST170(void)
Definition decoders.cpp:4486
void triggerSetup_FordST170(void)
Definition decoders.cpp:4354
void triggerSec_FordST170(void)
Definition decoders.cpp:4382
int getCrankAngle_FordST170(void)
Definition decoders.cpp:4447
uint16_t getRPM_FordST170(void)
Definition decoders.cpp:4429
void triggerPri_GM7X(void)
Definition decoders.cpp:1312
void triggerSetup_GM7X(void)
Definition decoders.cpp:1303
int getCrankAngle_GM7X(void)
Definition decoders.cpp:1376
void triggerSetEndTeeth_GM7X(void)
Definition decoders.cpp:1413
void triggerSec_GM7X(void)
Definition decoders.cpp:1371
uint16_t getRPM_GM7X(void)
Definition decoders.cpp:1372
void triggerSec_24X(void)
Definition decoders.cpp:1939
uint16_t getRPM_24X(void)
Definition decoders.cpp:1945
void triggerSetup_24X(void)
Definition decoders.cpp:1871
void triggerPri_24X(void)
Definition decoders.cpp:1907
int getCrankAngle_24X(void)
Definition decoders.cpp:1949
void triggerSetEndTeeth_24X(void)
Definition decoders.cpp:1979
int getCrankAngle_Harley(void)
Definition decoders.cpp:3706
void triggerSetEndTeeth_Harley(void)
Definition decoders.cpp:3738
void triggerSec_Harley(void)
Definition decoders.cpp:3665
uint16_t getRPM_Harley(void)
Definition decoders.cpp:3672
void triggerSetup_Harley(void)
Definition decoders.cpp:3612
void triggerPri_Harley(void)
Definition decoders.cpp:3623
void triggerPri_HondaD17(void)
Definition decoders.cpp:2223
uint16_t getRPM_HondaD17(void)
Definition decoders.cpp:2265
int getCrankAngle_HondaD17(void)
Definition decoders.cpp:2269
void triggerSec_HondaD17(void)
Definition decoders.cpp:2264
void triggerSetEndTeeth_HondaD17(void)
Definition decoders.cpp:2302
void triggerSetup_HondaD17(void)
Definition decoders.cpp:2214
int getCrankAngle_HondaJ32(void)
Definition decoders.cpp:2411
void triggerSetup_HondaJ32(void)
Definition decoders.cpp:2324
uint16_t getRPM_HondaJ32(void)
Definition decoders.cpp:2406
void triggerPri_HondaJ32(void)
Definition decoders.cpp:2342
void triggerSetEndTeeth_HondaJ32(void)
Definition decoders.cpp:2445
void triggerSec_HondaJ32(void)
Definition decoders.cpp:2401
void triggerSec_Jeep2000(void)
Definition decoders.cpp:2049
void triggerSetEndTeeth_Jeep2000(void)
Definition decoders.cpp:2085
uint16_t getRPM_Jeep2000(void)
Definition decoders.cpp:2055
void triggerPri_Jeep2000(void)
Definition decoders.cpp:2016
int getCrankAngle_Jeep2000(void)
Definition decoders.cpp:2059
void triggerSetup_Jeep2000(void)
Definition decoders.cpp:1992
void triggerSetEndTeeth_missingTooth(void)
Definition decoders.cpp:869
void triggerPri_missingTooth(void)
Definition decoders.cpp:566
void triggerThird_missingTooth(void)
Definition decoders.cpp:766
void triggerSec_missingTooth(void)
Definition decoders.cpp:685
uint16_t getRPM_missingTooth(void)
Definition decoders.cpp:798
int getCrankAngle_missingTooth(void)
Definition decoders.cpp:816
void triggerSetup_missingTooth(void)
Definition decoders.cpp:529
void triggerPri_4G63(void)
Definition decoders.cpp:1491
void triggerSetup_4G63(void)
Definition decoders.cpp:1437
void triggerSec_4G63(void)
Definition decoders.cpp:1679
uint16_t getRPM_4G63(void)
Definition decoders.cpp:1758
int getCrankAngle_4G63(void)
Definition decoders.cpp:1795
void triggerSetEndTeeth_4G63(void)
Definition decoders.cpp:1822
void triggerSetEndTeeth_Nissan360(void)
Definition decoders.cpp:3156
void triggerSetup_Nissan360(void)
Definition decoders.cpp:2951
void triggerSec_Nissan360(void)
Definition decoders.cpp:3006
int getCrankAngle_Nissan360(void)
Definition decoders.cpp:3126
void triggerPri_Nissan360(void)
Definition decoders.cpp:2965
uint16_t getRPM_Nissan360(void)
Definition decoders.cpp:3100
void triggerSetEndTeeth_non360(void)
Definition decoders.cpp:2941
void triggerPri_non360(void)
Definition decoders.cpp:2891
void triggerSetup_non360(void)
Definition decoders.cpp:2878
void triggerSec_non360(void)
Definition decoders.cpp:2896
int getCrankAngle_non360(void)
Definition decoders.cpp:2912
uint16_t getRPM_non360(void)
Definition decoders.cpp:2901
void triggerSetEndTeeth_Renix(void)
Definition decoders.cpp:5214
void triggerSetup_Renix(void)
Definition decoders.cpp:5092
void triggerPri_Renix(void)
Definition decoders.cpp:5128
void triggerSetEndTeeth_Subaru67(void)
Definition decoders.cpp:3403
uint16_t getRPM_Subaru67(void)
Definition decoders.cpp:3362
void triggerSetup_Subaru67(void)
Definition decoders.cpp:3176
void triggerSec_Subaru67(void)
Definition decoders.cpp:3324
void triggerPri_Subaru67(void)
Definition decoders.cpp:3205
int getCrankAngle_Subaru67(void)
Definition decoders.cpp:3375
void resetDecoder(void)
This function is called when the engine is stopped, or when the engine is started....
Definition decoders.cpp:350
void loggerPrimaryISR(void)
Definition decoders.cpp:212
bool engineIsRunning(uint32_t curTime)
Is the engine running?
Definition decoders.cpp:340
void loggerTertiaryISR(void)
Definition decoders.cpp:271
void loggerSecondaryISR(void)
Definition decoders.cpp:246
int getCrankAngle_Vmax(void)
Definition decoders.cpp:5049
void triggerSetEndTeeth_Vmax(void)
Definition decoders.cpp:5075
void triggerSetup_Vmax(void)
Definition decoders.cpp:4890
void triggerPri_Vmax(void)
Definition decoders.cpp:4914
uint16_t getRPM_Vmax(void)
Definition decoders.cpp:5020
void triggerSec_Vmax(void)
Definition decoders.cpp:5013
void triggerPri_Webber(void)
Definition decoders.cpp:4246
void triggerSec_Webber(void)
Definition decoders.cpp:4297
void triggerSetup_RoverMEMS(void)
Definition decoders.cpp:5258
void triggerPri_RoverMEMS(void)
Definition decoders.cpp:5282
uint16_t getRPM_RoverMEMS(void)
Definition decoders.cpp:5556
void triggerSec_NGC68(void)
Definition decoders.cpp:4775
uint16_t getRPM_NGC(void)
Definition decoders.cpp:4830
void triggerSec_RoverMEMS(void)
Definition decoders.cpp:5474
void triggerPri_NGC(void)
Definition decoders.cpp:4609
void triggerSetEndTeeth_NGC(void)
Definition decoders.cpp:4864
int getCrankAngle_RoverMEMS(void)
Definition decoders.cpp:5446
void triggerSetup_NGC(void)
Definition decoders.cpp:4552
void triggerSetEndTeeth_RoverMEMS(void)
Definition decoders.cpp:5576
void triggerSec_NGC4(void)
Definition decoders.cpp:4723
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
uint16_t getRPM_MazdaAU(void)
Definition decoders.cpp:2818
void triggerPri_MazdaAU(void)
Definition decoders.cpp:2749
void triggerSetEndTeeth_MazdaAU(void)
Definition decoders.cpp:2868
void triggerSec_MazdaAU(void)
Definition decoders.cpp:2786
int getCrankAngle_MazdaAU(void)
Definition decoders.cpp:2840
void triggerSetup_MazdaAU(void)
Definition decoders.cpp:2729
void triggerSetEndTeeth_Miata9905(void)
Definition decoders.cpp:2682
int getCrankAngle_Miata9905(void)
Definition decoders.cpp:2643
void triggerSec_Miata9905(void)
Definition decoders.cpp:2585
uint16_t getRPM_Miata9905(void)
Definition decoders.cpp:2611
void triggerPri_Miata9905(void)
Definition decoders.cpp:2498
void triggerSetup_Miata9905(void)
Definition decoders.cpp:2460
int getCamAngle_Miata9905(void)
Definition decoders.cpp:2671