auto-sync

This commit is contained in:
rusEfi 2014-08-31 17:02:50 -05:00
parent b6d642fb79
commit 405b669490
7 changed files with 27 additions and 9 deletions

View File

@ -336,6 +336,9 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
boardConfiguration->logicAnalyzerPins[0] = GPIOA_8;
boardConfiguration->logicAnalyzerPins[1] = GPIOE_7; // todo: E7 is not timer input, that's a bug!
boardConfiguration->logicAnalyzerMode[0] = false;
boardConfiguration->logicAnalyzerMode[1] = false;
boardConfiguration->idleThreadPeriod = 100;
boardConfiguration->consoleLoopPeriod = 200;
boardConfiguration->lcdThreadPeriod = 300;

View File

@ -159,8 +159,10 @@ typedef struct {
adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
// todo: we should have up to three trigger input channels
brain_pin_e triggerInputPins[2];
brain_pin_e logicAnalyzerPins[2];
// todo: we should have up to four login input channels
brain_pin_e logicAnalyzerPins[LOGIC_ANALYZER_CHANNEL_COUNT];
int idleThreadPeriod;
int consoleLoopPeriod;
@ -186,7 +188,9 @@ typedef struct {
unsigned int is_enabled_spi_2 : 1;
unsigned int is_enabled_spi_3 : 1;
int unused2[7];
int unused2[6];
uint8_t logicAnalyzerMode[4];
} board_configuration_s;

View File

@ -19,6 +19,8 @@
#define DIGIPOT_COUNT 4
#define LOGIC_ANALYZER_CHANNEL_COUNT 2
typedef enum {
AUDI_AAN = 1,
#if EFI_SUPPORT_DODGE_NEON

View File

@ -115,7 +115,15 @@ int getEventCounter(int index) {
return reader->eventCounter;
}
static void initWave(const char *name, int index, ICUDriver *driver, ioportid_t port, ioportmask_t pin, int mode) {
static void initWave(const char *name, int index) {
brain_pin_e brainPin = boardConfiguration->logicAnalyzerPins[index];
ioportid_t port = getHwPort(brainPin);
ioportmask_t pin = getHwPin(brainPin);
ICUDriver *driver = getInputCaptureDriver(brainPin);
bool mode = boardConfiguration->logicAnalyzerMode[index];
waveReaderCount++;
efiAssertVoid(index < MAX_ICU_COUNT, "too many ICUs");
WaveReader *reader = &readers[index];
@ -246,13 +254,12 @@ void initWaveAnalyzer(void) {
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
initLogging(&logger, "wave");
initWave(WA_CHANNEL_1, 0, getInputCaptureDriver(boardConfiguration->logicAnalyzerPins[0]), getHwPort(boardConfiguration->logicAnalyzerPins[0]), getHwPin(boardConfiguration->logicAnalyzerPins[0]), 1);
initWave(WA_CHANNEL_2, 1, getInputCaptureDriver(boardConfiguration->logicAnalyzerPins[1]), getHwPort(boardConfiguration->logicAnalyzerPins[1]), getHwPin(boardConfiguration->logicAnalyzerPins[1]), 1);
// initWave("input0 C6", 2, &WAVE_TIMER, WAVE_INPUT_PORT, WAVE_INPUT_PIN, 0);
initWave(WA_CHANNEL_1, 0);
initWave(WA_CHANNEL_2, 1);
addTriggerEventListener(&onWaveShaftSignal, "wave analyzer", (void*)NULL);
addConsoleActionII("wm", setWaveModeSilent);
addConsoleActionII("set_logic_input_mode", setWaveModeSilent);
chThdCreateStatic(waThreadStack, sizeof(waThreadStack), NORMALPRIO, waThread, (void*)NULL);

View File

@ -17,6 +17,8 @@
#define WA_CHANNEL_1 "input1"
#define WA_CHANNEL_2 "input2"
#define WA_CHANNEL_3 "input3"
#define WA_CHANNEL_4 "input4"
typedef struct {
WaveReaderHw hw;

View File

@ -150,7 +150,7 @@ void initWaveAnalyzerDriver(WaveReaderHw *hw, ICUDriver *driver, ioportid_t port
}
}
void setWaveReaderMode(WaveReaderHw *hw, int mode) {
void setWaveReaderMode(WaveReaderHw *hw, bool mode) {
hw->activeMode = mode;
if (hw->activeMode) {
wave_icucfg.mode = ICU_INPUT_ACTIVE_HIGH;

View File

@ -29,7 +29,7 @@ extern "C"
void initWaveAnalyzerDriver(WaveReaderHw *hw, ICUDriver *driver,
ioportid_t port, ioportmask_t pin);
void setWaveReaderMode(WaveReaderHw *hw, int mode);
void setWaveReaderMode(WaveReaderHw *hw, bool mode);
ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
#ifdef __cplusplus