mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
6c0fec4c8e
commit
8f968c3014
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "datalogging.h"
|
#include "datalogging.h"
|
||||||
|
|
||||||
#include "wave_analyzer_hw.h"
|
#include "digital_input_hw.h"
|
||||||
#include "wave_chart.h"
|
#include "wave_chart.h"
|
||||||
|
|
||||||
#define WA_CHANNEL_1 "input1"
|
#define WA_CHANNEL_1 "input1"
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
WaveReader();
|
WaveReader();
|
||||||
void onFallEvent();
|
void onFallEvent();
|
||||||
|
|
||||||
WaveReaderHw *hw;
|
digital_input_s *hw;
|
||||||
const char *name;
|
const char *name;
|
||||||
volatile int eventCounter;
|
volatile int eventCounter;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* @file wave_analyzer_hw.cpp
|
* @file digital_input_hw.cpp
|
||||||
* @brief Helper methods related to Input Capture Unit (ICU)
|
* @brief Helper methods related to Input Capture Unit (ICU)
|
||||||
*
|
*
|
||||||
* @date Jun 23, 2013
|
* @date Jun 23, 2013
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2015
|
* @author Andrey Belomutskiy, (c) 2012-2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wave_analyzer_hw.h"
|
#include "digital_input_hw.h"
|
||||||
#include "mpu_util.h"
|
#include "mpu_util.h"
|
||||||
#include "fl_stack.h"
|
#include "fl_stack.h"
|
||||||
|
|
||||||
|
@ -26,16 +26,16 @@ static void icuPeriordCallBack(ICUDriver *driver);
|
||||||
static ICUConfig wave_icucfg = { ICU_INPUT_ACTIVE_LOW, CORE_CLOCK / 100, icuWidthCallback, icuPeriordCallBack, 0,
|
static ICUConfig wave_icucfg = { ICU_INPUT_ACTIVE_LOW, CORE_CLOCK / 100, icuWidthCallback, icuPeriordCallBack, 0,
|
||||||
ICU_CHANNEL_1, 0 };
|
ICU_CHANNEL_1, 0 };
|
||||||
|
|
||||||
static ArrayList<WaveReaderHw, 8> registeredIcus;
|
static ArrayList<digital_input_s, 8> registeredIcus;
|
||||||
|
|
||||||
static WaveReaderHw * findWaveReaderHw(ICUDriver *driver) {
|
static digital_input_s * finddigital_input_s(ICUDriver *driver) {
|
||||||
for (int i = 0; i < registeredIcus.size; i++) {
|
for (int i = 0; i < registeredIcus.size; i++) {
|
||||||
if (registeredIcus.elements[i].driver == driver) {
|
if (registeredIcus.elements[i].driver == driver) {
|
||||||
return ®isteredIcus.elements[i];
|
return ®isteredIcus.elements[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
firmwareError("reader not found");
|
firmwareError("reader not found");
|
||||||
return (WaveReaderHw *) NULL;
|
return (digital_input_s *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void icuWidthCallback(ICUDriver *driver) {
|
static void icuWidthCallback(ICUDriver *driver) {
|
||||||
|
@ -43,7 +43,7 @@ static void icuWidthCallback(ICUDriver *driver) {
|
||||||
* see comment in icuPeriordCallBack
|
* see comment in icuPeriordCallBack
|
||||||
int rowWidth = icuGetWidth(driver);
|
int rowWidth = icuGetWidth(driver);
|
||||||
*/
|
*/
|
||||||
WaveReaderHw * hw = findWaveReaderHw(driver);
|
digital_input_s * hw = finddigital_input_s(driver);
|
||||||
hw->widthListeners.invokeJustArgCallbacks();
|
hw->widthListeners.invokeJustArgCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static void icuPeriordCallBack(ICUDriver *driver) {
|
||||||
* int period = icuGetPeriod(driver);
|
* int period = icuGetPeriod(driver);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WaveReaderHw * hw = findWaveReaderHw(driver);
|
digital_input_s * hw = finddigital_input_s(driver);
|
||||||
hw->periodListeners.invokeJustArgCallbacks();
|
hw->periodListeners.invokeJustArgCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,17 +151,17 @@ void turnOnCapturePin(brain_pin_e brainPin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveReaderHw * initWaveAnalyzerDriver(brain_pin_e brainPin) {
|
digital_input_s * initWaveAnalyzerDriver(brain_pin_e brainPin) {
|
||||||
ICUDriver *driver = getInputCaptureDriver(brainPin);
|
ICUDriver *driver = getInputCaptureDriver(brainPin);
|
||||||
|
|
||||||
WaveReaderHw *hw = registeredIcus.add();
|
digital_input_s *hw = registeredIcus.add();
|
||||||
|
|
||||||
hw->driver = driver;
|
hw->driver = driver;
|
||||||
turnOnCapturePin(brainPin);
|
turnOnCapturePin(brainPin);
|
||||||
return hw;
|
return hw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh) {
|
void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
|
||||||
hw->isActiveHigh = isActiveHigh;
|
hw->isActiveHigh = isActiveHigh;
|
||||||
if (hw->isActiveHigh) {
|
if (hw->isActiveHigh) {
|
||||||
wave_icucfg.mode = ICU_INPUT_ACTIVE_HIGH;
|
wave_icucfg.mode = ICU_INPUT_ACTIVE_HIGH;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* @file wave_analyzer_hw.h
|
* @file digital_input_hw.h
|
||||||
*
|
*
|
||||||
* @date Jun 23, 2013
|
* @date Jun 23, 2013
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2015
|
* @author Andrey Belomutskiy, (c) 2012-2015
|
||||||
|
@ -23,11 +23,11 @@ typedef struct {
|
||||||
// todo: would one listener be enough?
|
// todo: would one listener be enough?
|
||||||
IntListenerArray widthListeners;
|
IntListenerArray widthListeners;
|
||||||
IntListenerArray periodListeners;
|
IntListenerArray periodListeners;
|
||||||
} WaveReaderHw;
|
} digital_input_s;
|
||||||
|
|
||||||
void turnOnCapturePin(brain_pin_e brainPin);
|
void turnOnCapturePin(brain_pin_e brainPin);
|
||||||
WaveReaderHw *initWaveAnalyzerDriver(brain_pin_e brainPin);
|
digital_input_s *initWaveAnalyzerDriver(brain_pin_e brainPin);
|
||||||
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh);
|
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
|
||||||
ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
|
ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -12,7 +12,7 @@ HW_LAYER_EMS = $(HW_LAYER_EGT) \
|
||||||
HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \
|
HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \
|
||||||
$(PROJECT_DIR)/hw_layer/pin_repository.cpp \
|
$(PROJECT_DIR)/hw_layer/pin_repository.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/microsecond_timer.cpp \
|
$(PROJECT_DIR)/hw_layer/microsecond_timer.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/wave_analyzer_hw.cpp \
|
$(PROJECT_DIR)/hw_layer/digital_input_hw.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/hardware.cpp \
|
$(PROJECT_DIR)/hw_layer/hardware.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/neo6m.cpp \
|
$(PROJECT_DIR)/hw_layer/neo6m.cpp \
|
||||||
$(PROJECT_DIR)/hw_layer/mmc_card.cpp \
|
$(PROJECT_DIR)/hw_layer/mmc_card.cpp \
|
||||||
|
|
|
@ -11,12 +11,11 @@
|
||||||
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
|
||||||
|
|
||||||
#include "trigger_input.h"
|
#include "trigger_input.h"
|
||||||
#include "wave_analyzer_hw.h"
|
#include "digital_input_hw.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
#include "trigger_structure.h"
|
#include "trigger_structure.h"
|
||||||
#include "trigger_central.h"
|
#include "trigger_central.h"
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "wave_analyzer_hw.h"
|
|
||||||
|
|
||||||
#define TRIGGER_SUPPORTED_CHANNELS 2
|
#define TRIGGER_SUPPORTED_CHANNELS 2
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__)
|
#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__)
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "wave_analyzer_hw.h"
|
#include "digital_input_hw.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
|
@ -54,7 +54,7 @@ void initVehicleSpeed(Logging *l) {
|
||||||
logger = l;
|
logger = l;
|
||||||
if (boardConfiguration->vehicleSpeedSensorInputPin == GPIO_UNASSIGNED)
|
if (boardConfiguration->vehicleSpeedSensorInputPin == GPIO_UNASSIGNED)
|
||||||
return;
|
return;
|
||||||
WaveReaderHw* vehicleSpeedInput = initWaveAnalyzerDriver(boardConfiguration->vehicleSpeedSensorInputPin);
|
digital_input_s* vehicleSpeedInput = initWaveAnalyzerDriver(boardConfiguration->vehicleSpeedSensorInputPin);
|
||||||
startInputDriver(vehicleSpeedInput, true);
|
startInputDriver(vehicleSpeedInput, true);
|
||||||
|
|
||||||
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
|
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
|
||||||
|
|
Loading…
Reference in New Issue