rusefi-1/firmware/hw_layer/digital_input/trigger/trigger_input.h

49 lines
1.3 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file trigger_input.h
* @brief Position sensor hardware layer
*
* @date Dec 30, 2012
2020-01-07 21:02:40 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2015-07-10 06:01:56 -07:00
*/
2020-04-01 18:32:21 -07:00
#pragma once
2015-07-10 06:01:56 -07:00
2019-11-11 19:19:35 -08:00
#include "trigger_structure.h"
#include "trigger_central.h"
2015-07-10 06:01:56 -07:00
#define TRIGGER_BAIL_IF_DISABLED \
if (!engine->hwTriggerInputEnabled) { \
return; \
}
#define TRIGGER_BAIL_IF_SELF_STIM \
if (engine->directSelfStimulation) { \
/* sensor noise + self-stim = loss of trigger sync */ \
return; \
}
2019-11-11 18:25:40 -08:00
#define TRIGGER_SUPPORTED_CHANNELS 2
void turnOnTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void applyNewTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void startTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void stopTriggerInputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2015-07-10 06:01:56 -07:00
void stopTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void startTriggerDebugPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2020-09-09 07:21:14 -07:00
#if HAL_TRIGGER_USE_ADC && HAL_USE_ADC
// This detector has 2 modes for low-RPM (ADC) and fast-RPM (EXTI)
enum triggerAdcMode_t {
TRIGGER_NONE = 0,
TRIGGER_ADC,
TRIGGER_EXTI,
};
adc_channel_e getAdcChannelForTrigger(void);
void addAdcChannelForTrigger(void);
void triggerAdcCallback(adcsample_t value);
#endif /* HAL_USE_ADC */