rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
trigger_input_exti.cpp File Reference

Detailed Description

Position sensor hardware layer - PAL version.

todo: VVT implementation is a nasty copy-paste :(

see digital_input_icu.cp

Date
Dec 30, 2012
Author
Andrey Belomutskiy, (c) 2012-2021

Definition in file trigger_input_exti.cpp.

Functions

static void shaft_callback (void *arg, efitick_t stamp)
 
static void cam_callback (void *arg, efitick_t stamp)
 
int extiTriggerTurnOnInputPin (const char *msg, int index, bool isTriggerShaft)
 
void extiTriggerTurnOffInputPin (brain_pin_e brainPin)
 

Variables

static ioline_t shaftLines [TRIGGER_INPUT_PIN_COUNT]
 
static ioline_t camLines [CAM_INPUTS_COUNT]
 

Function Documentation

◆ cam_callback()

static void cam_callback ( void *  arg,
efitick_t  stamp 
)
static

Definition at line 39 of file trigger_input_exti.cpp.

39 {
40 int index = (int)arg;
41 ioline_t pal_line = camLines[index];
42
43 bool rise = (palReadLine(pal_line) == PAL_HIGH);
44
45 hwHandleVvtCamSignal(rise, stamp, index);
46}
uint32_t ioline_t
Type of an I/O line.
Definition hal_pal_lld.h:88
void hwHandleVvtCamSignal(bool isRising, efitick_t nowNt, int index)
static ioline_t camLines[CAM_INPUTS_COUNT]

Referenced by extiTriggerTurnOnInputPin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extiTriggerTurnOffInputPin()

void extiTriggerTurnOffInputPin ( brain_pin_e  brainPin)

Definition at line 75 of file trigger_input_exti.cpp.

75 {
76 efiExtiDisablePin(brainPin);
77}
void efiExtiDisablePin(brain_pin_e brainPin)

Referenced by turnOffTriggerInputPin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extiTriggerTurnOnInputPin()

int extiTriggerTurnOnInputPin ( const char msg,
int  index,
bool  isTriggerShaft 
)

Definition at line 52 of file trigger_input_exti.cpp.

52 {
53 brain_pin_e brainPin = isTriggerShaft ? engineConfiguration->triggerInputPins[index] : engineConfiguration->camInputs[index];
54
55 efiPrintf("extiTriggerTurnOnInputPin %s %s", msg, hwPortname(brainPin));
56
57 /* TODO:
58 * * do not set to both edges if we need only one
59 * * simplify callback in case of one edge */
60 if (efiExtiEnablePin(msg, brainPin, PAL_EVENT_MODE_BOTH_EDGES,
61 isTriggerShaft ? shaft_callback : cam_callback, (void *)index) < 0) {
62 return -1;
63 }
64
65 ioline_t pal_line = PAL_LINE(getHwPort("trg", brainPin), getHwPin("trg", brainPin));
66 if (isTriggerShaft) {
67 shaftLines[index] = pal_line;
68 } else {
69 camLines[index] = pal_line;
70 }
71
72 return 0;
73}
int efiExtiEnablePin(const char *msg, brain_pin_e brainPin, uint32_t mode, ExtiCallback cb, void *cb_data)
ioportid_t getHwPort(const char *msg, brain_pin_e brainPin)
ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin)
static constexpr engine_configuration_s * engineConfiguration
const char * hwPortname(brain_pin_e brainPin)
brain_input_pin_e triggerInputPins[TRIGGER_INPUT_PIN_COUNT]
static void shaft_callback(void *arg, efitick_t stamp)
static void cam_callback(void *arg, efitick_t stamp)
static ioline_t shaftLines[TRIGGER_INPUT_PIN_COUNT]
Here is the call graph for this function:

◆ shaft_callback()

static void shaft_callback ( void *  arg,
efitick_t  stamp 
)
static

Definition at line 27 of file trigger_input_exti.cpp.

27 {
28 // do the time sensitive things as early as possible!
29 int index = (int)arg;
30 ioline_t pal_line = shaftLines[index];
31 bool rise = (palReadLine(pal_line) == PAL_HIGH);
32
33 // todo: support for 3rd trigger input channel
34 // todo: start using real event time from HW event, not just software timer?
35
36 hwHandleShaftSignal(index, rise, stamp);
37}
void hwHandleShaftSignal(int signalIndex, bool isRising, efitick_t timestamp)

Referenced by extiTriggerTurnOnInputPin().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ camLines

ioline_t camLines[CAM_INPUTS_COUNT]
static

Definition at line 25 of file trigger_input_exti.cpp.

Referenced by cam_callback(), and extiTriggerTurnOnInputPin().

◆ shaftLines

ioline_t shaftLines[TRIGGER_INPUT_PIN_COUNT]
static

Definition at line 24 of file trigger_input_exti.cpp.

Referenced by extiTriggerTurnOnInputPin(), and shaft_callback().

Go to the source code of this file.