auto-sync

This commit is contained in:
rusEfi 2015-05-28 22:06:28 -04:00
parent 6c0fec4c8e
commit 8f968c3014
6 changed files with 20 additions and 21 deletions

View File

@ -15,7 +15,7 @@
#include "datalogging.h"
#include "wave_analyzer_hw.h"
#include "digital_input_hw.h"
#include "wave_chart.h"
#define WA_CHANNEL_1 "input1"
@ -28,7 +28,7 @@ public:
WaveReader();
void onFallEvent();
WaveReaderHw *hw;
digital_input_s *hw;
const char *name;
volatile int eventCounter;

View File

@ -1,12 +1,12 @@
/*
* @file wave_analyzer_hw.cpp
* @file digital_input_hw.cpp
* @brief Helper methods related to Input Capture Unit (ICU)
*
* @date Jun 23, 2013
* @author Andrey Belomutskiy, (c) 2012-2015
*/
#include "wave_analyzer_hw.h"
#include "digital_input_hw.h"
#include "mpu_util.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,
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++) {
if (registeredIcus.elements[i].driver == driver) {
return &registeredIcus.elements[i];
}
}
firmwareError("reader not found");
return (WaveReaderHw *) NULL;
return (digital_input_s *) NULL;
}
static void icuWidthCallback(ICUDriver *driver) {
@ -43,7 +43,7 @@ static void icuWidthCallback(ICUDriver *driver) {
* see comment in icuPeriordCallBack
int rowWidth = icuGetWidth(driver);
*/
WaveReaderHw * hw = findWaveReaderHw(driver);
digital_input_s * hw = finddigital_input_s(driver);
hw->widthListeners.invokeJustArgCallbacks();
}
@ -54,7 +54,7 @@ static void icuPeriordCallBack(ICUDriver *driver) {
* int period = icuGetPeriod(driver);
*/
WaveReaderHw * hw = findWaveReaderHw(driver);
digital_input_s * hw = finddigital_input_s(driver);
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);
WaveReaderHw *hw = registeredIcus.add();
digital_input_s *hw = registeredIcus.add();
hw->driver = driver;
turnOnCapturePin(brainPin);
return hw;
}
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh) {
void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
hw->isActiveHigh = isActiveHigh;
if (hw->isActiveHigh) {
wave_icucfg.mode = ICU_INPUT_ACTIVE_HIGH;

View File

@ -1,5 +1,5 @@
/**
* @file wave_analyzer_hw.h
* @file digital_input_hw.h
*
* @date Jun 23, 2013
* @author Andrey Belomutskiy, (c) 2012-2015
@ -23,11 +23,11 @@ typedef struct {
// todo: would one listener be enough?
IntListenerArray widthListeners;
IntListenerArray periodListeners;
} WaveReaderHw;
} digital_input_s;
void turnOnCapturePin(brain_pin_e brainPin);
WaveReaderHw *initWaveAnalyzerDriver(brain_pin_e brainPin);
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh);
digital_input_s *initWaveAnalyzerDriver(brain_pin_e brainPin);
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
#endif

View File

@ -12,7 +12,7 @@ HW_LAYER_EMS = $(HW_LAYER_EGT) \
HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \
$(PROJECT_DIR)/hw_layer/pin_repository.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/neo6m.cpp \
$(PROJECT_DIR)/hw_layer/mmc_card.cpp \

View File

@ -11,12 +11,11 @@
#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__)
#include "trigger_input.h"
#include "wave_analyzer_hw.h"
#include "digital_input_hw.h"
#include "pin_repository.h"
#include "trigger_structure.h"
#include "trigger_central.h"
#include "engine_configuration.h"
#include "wave_analyzer_hw.h"
#define TRIGGER_SUPPORTED_CHANNELS 2

View File

@ -10,7 +10,7 @@
#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__)
#include "engine.h"
#include "wave_analyzer_hw.h"
#include "digital_input_hw.h"
#include "pin_repository.h"
EXTERN_ENGINE
@ -54,7 +54,7 @@ void initVehicleSpeed(Logging *l) {
logger = l;
if (boardConfiguration->vehicleSpeedSensorInputPin == GPIO_UNASSIGNED)
return;
WaveReaderHw* vehicleSpeedInput = initWaveAnalyzerDriver(boardConfiguration->vehicleSpeedSensorInputPin);
digital_input_s* vehicleSpeedInput = initWaveAnalyzerDriver(boardConfiguration->vehicleSpeedSensorInputPin);
startInputDriver(vehicleSpeedInput, true);
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);