Speeduino
Loading...
Searching...
No Matches
Macros | Functions | Variables
decoders.h File Reference
#include "globals.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define READ_PRI_TRIGGER()   digitalRead(pinTrigger)
 
#define READ_SEC_TRIGGER()   digitalRead(pinTrigger2)
 
#define READ_THIRD_TRIGGER()   digitalRead(pinTrigger3)
 
#define DECODER_MISSING_TOOTH   0
 
#define DECODER_BASIC_DISTRIBUTOR   1
 
#define DECODER_DUAL_WHEEL   2
 
#define DECODER_GM7X   3
 
#define DECODER_4G63   4
 
#define DECODER_24X   5
 
#define DECODER_JEEP2000   6
 
#define DECODER_AUDI135   7
 
#define DECODER_HONDA_D17   8
 
#define DECODER_MIATA_9905   9
 
#define DECODER_MAZDA_AU   10
 
#define DECODER_NON360   11
 
#define DECODER_NISSAN_360   12
 
#define DECODER_SUBARU_67   13
 
#define DECODER_DAIHATSU_PLUS1   14
 
#define DECODER_HARLEY   15
 
#define DECODER_36_2_2_2   16
 
#define DECODER_36_2_1   17
 
#define DECODER_420A   18
 
#define DECODER_WEBER   19
 
#define DECODER_ST170   20
 
#define DECODER_DRZ400   21
 
#define DECODER_NGC   22
 
#define DECODER_VMAX   23
 
#define DECODER_RENIX   24
 
#define DECODER_ROVERMEMS   25
 
#define DECODER_SUZUKI_K6A   26
 
#define DECODER_HONDA_J32   27
 
#define BIT_DECODER_2ND_DERIV   0
 
#define BIT_DECODER_IS_SEQUENTIAL   1
 
#define BIT_DECODER_UNUSED1   2
 
#define BIT_DECODER_HAS_SECONDARY   3
 
#define BIT_DECODER_HAS_FIXED_CRANKING   4
 
#define BIT_DECODER_VALID_TRIGGER   5
 
#define BIT_DECODER_TOOTH_ANG_CORRECT   6
 
#define TRIGGER_FILTER_OFF   0
 
#define TRIGGER_FILTER_LITE   1
 
#define TRIGGER_FILTER_MEDIUM   2
 
#define TRIGGER_FILTER_AGGRESSIVE   3
 
#define CRANK_SPEED   0U
 
#define CAM_SPEED   1U
 
#define TOOTH_CRANK   0
 
#define TOOTH_CAM_SECONDARY   1
 
#define TOOTH_CAM_TERTIARY   2
 
#define ID_TOOTH_PATTERN   0
 
#define SKIP_TOOTH1   1
 
#define SKIP_TOOTH2   2
 
#define SKIP_TOOTH3   3
 
#define SKIP_TOOTH4   4
 

Functions

bool engineIsRunning (uint32_t curTime)
 Is the engine running?
 
void loggerPrimaryISR (void)
 
void loggerSecondaryISR (void)
 
void loggerTertiaryISR (void)
 
void triggerSetup_missingTooth (void)
 
void triggerPri_missingTooth (void)
 
void triggerSec_missingTooth (void)
 
void triggerThird_missingTooth (void)
 
uint16_t getRPM_missingTooth (void)
 
int getCrankAngle_missingTooth (void)
 
void triggerSetEndTeeth_missingTooth (void)
 
void triggerSetup_DualWheel (void)
 
void triggerPri_DualWheel (void)
 
void triggerSec_DualWheel (void)
 
uint16_t getRPM_DualWheel (void)
 
int getCrankAngle_DualWheel (void)
 
void triggerSetEndTeeth_DualWheel (void)
 
void triggerSetup_BasicDistributor (void)
 
void triggerPri_BasicDistributor (void)
 
void triggerSec_BasicDistributor (void)
 
uint16_t getRPM_BasicDistributor (void)
 
int getCrankAngle_BasicDistributor (void)
 
void triggerSetEndTeeth_BasicDistributor (void)
 
void triggerSetup_GM7X (void)
 
void triggerPri_GM7X (void)
 
void triggerSec_GM7X (void)
 
uint16_t getRPM_GM7X (void)
 
int getCrankAngle_GM7X (void)
 
void triggerSetEndTeeth_GM7X (void)
 
void triggerSetup_4G63 (void)
 
void triggerPri_4G63 (void)
 
void triggerSec_4G63 (void)
 
uint16_t getRPM_4G63 (void)
 
int getCrankAngle_4G63 (void)
 
void triggerSetEndTeeth_4G63 (void)
 
void triggerSetup_24X (void)
 
void triggerPri_24X (void)
 
void triggerSec_24X (void)
 
uint16_t getRPM_24X (void)
 
int getCrankAngle_24X (void)
 
void triggerSetEndTeeth_24X (void)
 
void triggerSetup_Jeep2000 (void)
 
void triggerPri_Jeep2000 (void)
 
void triggerSec_Jeep2000 (void)
 
uint16_t getRPM_Jeep2000 (void)
 
int getCrankAngle_Jeep2000 (void)
 
void triggerSetEndTeeth_Jeep2000 (void)
 
void triggerSetup_Audi135 (void)
 
void triggerPri_Audi135 (void)
 
void triggerSec_Audi135 (void)
 
uint16_t getRPM_Audi135 (void)
 
int getCrankAngle_Audi135 (void)
 
void triggerSetEndTeeth_Audi135 (void)
 
void triggerSetup_HondaD17 (void)
 
void triggerPri_HondaD17 (void)
 
void triggerSec_HondaD17 (void)
 
uint16_t getRPM_HondaD17 (void)
 
int getCrankAngle_HondaD17 (void)
 
void triggerSetEndTeeth_HondaD17 (void)
 
void triggerSetup_HondaJ32 (void)
 
void triggerPri_HondaJ32 (void)
 
void triggerSec_HondaJ32 (void)
 
uint16_t getRPM_HondaJ32 (void)
 
int getCrankAngle_HondaJ32 (void)
 
void triggerSetEndTeeth_HondaJ32 (void)
 
void triggerSetup_Miata9905 (void)
 
void triggerPri_Miata9905 (void)
 
void triggerSec_Miata9905 (void)
 
uint16_t getRPM_Miata9905 (void)
 
int getCrankAngle_Miata9905 (void)
 
void triggerSetEndTeeth_Miata9905 (void)
 
int getCamAngle_Miata9905 (void)
 
void triggerSetup_MazdaAU (void)
 
void triggerPri_MazdaAU (void)
 
void triggerSec_MazdaAU (void)
 
uint16_t getRPM_MazdaAU (void)
 
int getCrankAngle_MazdaAU (void)
 
void triggerSetEndTeeth_MazdaAU (void)
 
void triggerSetup_non360 (void)
 
void triggerPri_non360 (void)
 
void triggerSec_non360 (void)
 
uint16_t getRPM_non360 (void)
 
int getCrankAngle_non360 (void)
 
void triggerSetEndTeeth_non360 (void)
 
void triggerSetup_Nissan360 (void)
 
void triggerPri_Nissan360 (void)
 
void triggerSec_Nissan360 (void)
 
uint16_t getRPM_Nissan360 (void)
 
int getCrankAngle_Nissan360 (void)
 
void triggerSetEndTeeth_Nissan360 (void)
 
void triggerSetup_Subaru67 (void)
 
void triggerPri_Subaru67 (void)
 
void triggerSec_Subaru67 (void)
 
uint16_t getRPM_Subaru67 (void)
 
int getCrankAngle_Subaru67 (void)
 
void triggerSetEndTeeth_Subaru67 (void)
 
void triggerSetup_Daihatsu (void)
 
void triggerPri_Daihatsu (void)
 
void triggerSec_Daihatsu (void)
 
uint16_t getRPM_Daihatsu (void)
 
int getCrankAngle_Daihatsu (void)
 
void triggerSetEndTeeth_Daihatsu (void)
 
void triggerSetup_Harley (void)
 
void triggerPri_Harley (void)
 
void triggerSec_Harley (void)
 
uint16_t getRPM_Harley (void)
 
int getCrankAngle_Harley (void)
 
void triggerSetEndTeeth_Harley (void)
 
void triggerSetup_ThirtySixMinus222 (void)
 
void triggerPri_ThirtySixMinus222 (void)
 
void triggerSec_ThirtySixMinus222 (void)
 
uint16_t getRPM_ThirtySixMinus222 (void)
 
int getCrankAngle_ThirtySixMinus222 (void)
 
void triggerSetEndTeeth_ThirtySixMinus222 (void)
 
void triggerSetup_ThirtySixMinus21 (void)
 
void triggerPri_ThirtySixMinus21 (void)
 
void triggerSec_ThirtySixMinus21 (void)
 
uint16_t getRPM_ThirtySixMinus21 (void)
 
int getCrankAngle_ThirtySixMinus21 (void)
 
void triggerSetEndTeeth_ThirtySixMinus21 (void)
 
void triggerSetup_420a (void)
 
void triggerPri_420a (void)
 
void triggerSec_420a (void)
 
uint16_t getRPM_420a (void)
 
int getCrankAngle_420a (void)
 
void triggerSetEndTeeth_420a (void)
 
void triggerPri_Webber (void)
 
void triggerSec_Webber (void)
 
void triggerSetup_FordST170 (void)
 
void triggerSec_FordST170 (void)
 
uint16_t getRPM_FordST170 (void)
 
int getCrankAngle_FordST170 (void)
 
void triggerSetEndTeeth_FordST170 (void)
 
void triggerSetup_DRZ400 (void)
 
void triggerSec_DRZ400 (void)
 
void triggerSetup_NGC (void)
 
void triggerPri_NGC (void)
 
void triggerSec_NGC4 (void)
 
void triggerSec_NGC68 (void)
 
uint16_t getRPM_NGC (void)
 
void triggerSetEndTeeth_NGC (void)
 
void triggerSetup_Renix (void)
 
void triggerPri_Renix (void)
 
void triggerSetEndTeeth_Renix (void)
 
void triggerSetup_RoverMEMS (void)
 
void triggerPri_RoverMEMS (void)
 
void triggerSec_RoverMEMS (void)
 
uint16_t getRPM_RoverMEMS (void)
 
int getCrankAngle_RoverMEMS (void)
 
void triggerSetEndTeeth_RoverMEMS (void)
 
void triggerSetup_Vmax (void)
 
void triggerPri_Vmax (void)
 
void triggerSec_Vmax (void)
 
uint16_t getRPM_Vmax (void)
 
int getCrankAngle_Vmax (void)
 
void triggerSetEndTeeth_Vmax (void)
 
void triggerSetup_SuzukiK6A (void)
 
void triggerPri_SuzukiK6A (void)
 
void triggerSec_SuzukiK6A (void)
 
uint16_t getRPM_SuzukiK6A (void)
 
int getCrankAngle_SuzukiK6A (void)
 
void triggerSetEndTeeth_SuzukiK6A (void)
 
void resetDecoder (void)
 This function is called when the engine is stopped, or when the engine is started. It resets the decoder state and the tooth tracking variables.
 

Variables

volatile uint8_t decoderState
 
void(* triggerHandler )(void)
 
void(* triggerSecondaryHandler )(void)
 Pointer for the trigger function (Gets pointed to the relevant decoder)
 
void(* triggerTertiaryHandler )(void)
 Pointer for the secondary trigger function (Gets pointed to the relevant decoder)
 
uint16_t(* getRPM )(void)
 Pointer for the tertiary trigger function (Gets pointed to the relevant decoder)
 
int(* getCrankAngle )(void)
 Pointer to the getRPM function (Gets pointed to the relevant decoder)
 
void(* triggerSetEndTeeth )(void)
 Pointer to the getCrank Angle function (Gets pointed to the relevant decoder)
 
volatile unsigned long curTime
 
volatile unsigned long curGap
 
volatile unsigned long curTime2
 
volatile unsigned long curGap2
 
volatile unsigned long lastGap
 
volatile unsigned long targetGap
 
volatile uint16_t toothCurrentCount
 
volatile unsigned long toothSystemLastToothTime
 
volatile unsigned long toothLastThirdToothTime
 
volatile unsigned long toothLastMinusOneToothTime
 
volatile unsigned long toothLastMinusOneSecToothTime
 
volatile unsigned long targetGap2
 
volatile unsigned long toothOneTime
 
volatile unsigned long toothOneMinusOneTime
 
volatile bool revolutionOne
 
volatile unsigned long secondaryLastToothTime
 
volatile unsigned long secondaryLastToothTime1
 
uint16_t triggerActualTeeth
 
volatile unsigned long triggerFilterTime
 
volatile unsigned long triggerSecFilterTime
 
unsigned int triggerSecFilterTime_duration
 
volatile uint16_t triggerToothAngle
 
byte checkSyncToothCount
 
unsigned long elapsedTime
 
unsigned long lastCrankAngleCalc
 
unsigned long lastVVTtime
 
uint16_t ignition1EndTooth
 
uint16_t ignition2EndTooth
 
uint16_t ignition3EndTooth
 
uint16_t ignition4EndTooth
 
uint16_t ignition5EndTooth
 
uint16_t ignition6EndTooth
 
uint16_t ignition7EndTooth
 
uint16_t ignition8EndTooth
 
int16_t toothAngles [24]
 

Macro Definition Documentation

◆ BIT_DECODER_2ND_DERIV

#define BIT_DECODER_2ND_DERIV   0

◆ BIT_DECODER_HAS_FIXED_CRANKING

#define BIT_DECODER_HAS_FIXED_CRANKING   4

◆ BIT_DECODER_HAS_SECONDARY

#define BIT_DECODER_HAS_SECONDARY   3

◆ BIT_DECODER_IS_SEQUENTIAL

#define BIT_DECODER_IS_SEQUENTIAL   1

◆ BIT_DECODER_TOOTH_ANG_CORRECT

#define BIT_DECODER_TOOTH_ANG_CORRECT   6

◆ BIT_DECODER_UNUSED1

#define BIT_DECODER_UNUSED1   2

◆ BIT_DECODER_VALID_TRIGGER

#define BIT_DECODER_VALID_TRIGGER   5

◆ CAM_SPEED

#define CAM_SPEED   1U

◆ CRANK_SPEED

#define CRANK_SPEED   0U

◆ DECODER_24X

#define DECODER_24X   5

◆ DECODER_36_2_1

#define DECODER_36_2_1   17

◆ DECODER_36_2_2_2

#define DECODER_36_2_2_2   16

◆ DECODER_420A

#define DECODER_420A   18

◆ DECODER_4G63

#define DECODER_4G63   4

◆ DECODER_AUDI135

#define DECODER_AUDI135   7

◆ DECODER_BASIC_DISTRIBUTOR

#define DECODER_BASIC_DISTRIBUTOR   1

◆ DECODER_DAIHATSU_PLUS1

#define DECODER_DAIHATSU_PLUS1   14

◆ DECODER_DRZ400

#define DECODER_DRZ400   21

◆ DECODER_DUAL_WHEEL

#define DECODER_DUAL_WHEEL   2

◆ DECODER_GM7X

#define DECODER_GM7X   3

◆ DECODER_HARLEY

#define DECODER_HARLEY   15

◆ DECODER_HONDA_D17

#define DECODER_HONDA_D17   8

◆ DECODER_HONDA_J32

#define DECODER_HONDA_J32   27

◆ DECODER_JEEP2000

#define DECODER_JEEP2000   6

◆ DECODER_MAZDA_AU

#define DECODER_MAZDA_AU   10

◆ DECODER_MIATA_9905

#define DECODER_MIATA_9905   9

◆ DECODER_MISSING_TOOTH

#define DECODER_MISSING_TOOTH   0

◆ DECODER_NGC

#define DECODER_NGC   22

◆ DECODER_NISSAN_360

#define DECODER_NISSAN_360   12

◆ DECODER_NON360

#define DECODER_NON360   11

◆ DECODER_RENIX

#define DECODER_RENIX   24

◆ DECODER_ROVERMEMS

#define DECODER_ROVERMEMS   25

◆ DECODER_ST170

#define DECODER_ST170   20

◆ DECODER_SUBARU_67

#define DECODER_SUBARU_67   13

◆ DECODER_SUZUKI_K6A

#define DECODER_SUZUKI_K6A   26

◆ DECODER_VMAX

#define DECODER_VMAX   23

◆ DECODER_WEBER

#define DECODER_WEBER   19

◆ ID_TOOTH_PATTERN

#define ID_TOOTH_PATTERN   0

◆ READ_PRI_TRIGGER

#define READ_PRI_TRIGGER ( )    digitalRead(pinTrigger)

◆ READ_SEC_TRIGGER

#define READ_SEC_TRIGGER ( )    digitalRead(pinTrigger2)

◆ READ_THIRD_TRIGGER

#define READ_THIRD_TRIGGER ( )    digitalRead(pinTrigger3)

◆ SKIP_TOOTH1

#define SKIP_TOOTH1   1

◆ SKIP_TOOTH2

#define SKIP_TOOTH2   2

◆ SKIP_TOOTH3

#define SKIP_TOOTH3   3

◆ SKIP_TOOTH4

#define SKIP_TOOTH4   4

◆ TOOTH_CAM_SECONDARY

#define TOOTH_CAM_SECONDARY   1

◆ TOOTH_CAM_TERTIARY

#define TOOTH_CAM_TERTIARY   2

◆ TOOTH_CRANK

#define TOOTH_CRANK   0

◆ TRIGGER_FILTER_AGGRESSIVE

#define TRIGGER_FILTER_AGGRESSIVE   3

◆ TRIGGER_FILTER_LITE

#define TRIGGER_FILTER_LITE   1

◆ TRIGGER_FILTER_MEDIUM

#define TRIGGER_FILTER_MEDIUM   2

◆ TRIGGER_FILTER_OFF

#define TRIGGER_FILTER_OFF   0

Function Documentation

◆ triggerSec_DRZ400()

void triggerSec_DRZ400 ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ triggerSetup_DRZ400()

void triggerSetup_DRZ400 ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ checkSyncToothCount

byte checkSyncToothCount
extern

◆ curGap

volatile unsigned long curGap
extern

◆ curGap2

volatile unsigned long curGap2
extern

◆ curTime

volatile unsigned long curTime
extern

◆ curTime2

volatile unsigned long curTime2
extern

◆ decoderState

volatile uint8_t decoderState
extern

◆ elapsedTime

unsigned long elapsedTime
extern

◆ getCrankAngle

int(* getCrankAngle) (void) ( void  )
extern

Pointer to the getRPM function (Gets pointed to the relevant decoder)

◆ getRPM

uint16_t(* getRPM) (void) ( void  )
extern

Pointer for the tertiary trigger function (Gets pointed to the relevant decoder)

◆ ignition1EndTooth

uint16_t ignition1EndTooth
extern

◆ ignition2EndTooth

uint16_t ignition2EndTooth
extern

◆ ignition3EndTooth

uint16_t ignition3EndTooth
extern

◆ ignition4EndTooth

uint16_t ignition4EndTooth
extern

◆ ignition5EndTooth

uint16_t ignition5EndTooth
extern

◆ ignition6EndTooth

uint16_t ignition6EndTooth
extern

◆ ignition7EndTooth

uint16_t ignition7EndTooth
extern

◆ ignition8EndTooth

uint16_t ignition8EndTooth
extern

◆ lastCrankAngleCalc

unsigned long lastCrankAngleCalc
extern

◆ lastGap

volatile unsigned long lastGap
extern

◆ lastVVTtime

unsigned long lastVVTtime
extern

◆ revolutionOne

volatile bool revolutionOne
extern

◆ secondaryLastToothTime

volatile unsigned long secondaryLastToothTime
extern

◆ secondaryLastToothTime1

volatile unsigned long secondaryLastToothTime1
extern

◆ targetGap

volatile unsigned long targetGap
extern

◆ targetGap2

volatile unsigned long targetGap2
extern

◆ toothAngles

int16_t toothAngles[24]
extern

◆ toothCurrentCount

volatile uint16_t toothCurrentCount
extern

◆ toothLastMinusOneSecToothTime

volatile unsigned long toothLastMinusOneSecToothTime
extern

◆ toothLastMinusOneToothTime

volatile unsigned long toothLastMinusOneToothTime
extern

◆ toothLastThirdToothTime

volatile unsigned long toothLastThirdToothTime
extern

◆ toothOneMinusOneTime

volatile unsigned long toothOneMinusOneTime
extern

◆ toothOneTime

volatile unsigned long toothOneTime
extern

◆ toothSystemLastToothTime

volatile unsigned long toothSystemLastToothTime
extern

◆ triggerActualTeeth

uint16_t triggerActualTeeth
extern

◆ triggerFilterTime

volatile unsigned long triggerFilterTime
extern

◆ triggerHandler

void(* triggerHandler) (void) ( void  )
extern

◆ triggerSecFilterTime

volatile unsigned long triggerSecFilterTime
extern

◆ triggerSecFilterTime_duration

unsigned int triggerSecFilterTime_duration
extern

◆ triggerSecondaryHandler

void(* triggerSecondaryHandler) (void) ( void  )
extern

Pointer for the trigger function (Gets pointed to the relevant decoder)

◆ triggerSetEndTeeth

void(* triggerSetEndTeeth) (void) ( void  )
extern

Pointer to the getCrank Angle function (Gets pointed to the relevant decoder)

◆ triggerTertiaryHandler

void(* triggerTertiaryHandler) (void) ( void  )
extern

Pointer for the secondary trigger function (Gets pointed to the relevant decoder)

◆ triggerToothAngle

volatile uint16_t triggerToothAngle
extern