auto-sync

This commit is contained in:
rusEfi 2014-12-27 22:03:27 -06:00
parent 40c6109873
commit ed83729bcc
3 changed files with 7 additions and 7 deletions

View File

@ -102,7 +102,7 @@ static void waIcuPeriodCallback(WaveReader *reader) {
static void setWaveModeSilent(int index, int mode) {
WaveReader *reader = &readers[index];
setWaveReaderMode(&reader->hw, mode);
startInputDriver(&reader->hw, mode);
}
//static int getEventCounter(int index) {
@ -130,7 +130,7 @@ static void initWave(const char *name, int index) {
initWaveAnalyzerDriver(hw, brainPin);
print("wave%d input on %s%d\r\n", index, portname(reader->hw.port), reader->hw.pin);
setWaveReaderMode(hw, mode);
startInputDriver(hw, mode);
}
#endif

View File

@ -158,9 +158,9 @@ void initWaveAnalyzerDriver(WaveReaderHw *hw, brain_pin_e brainPin) {
}
}
void setWaveReaderMode(WaveReaderHw *hw, bool mode) {
hw->activeMode = mode;
if (hw->activeMode) {
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh) {
hw->isActiveHigh = isActiveHigh;
if (hw->isActiveHigh) {
wave_icucfg.mode = ICU_INPUT_ACTIVE_HIGH;
} else {
wave_icucfg.mode = ICU_INPUT_ACTIVE_LOW;

View File

@ -18,7 +18,7 @@ typedef struct {
ICUDriver *driver;
GPIO_TypeDef *port;
int pin;
int activeMode; // 0 for ICU_INPUT_ACTIVE_LOW, 1 for ICU_INPUT_ACTIVE_HIGH
bool_t isActiveHigh; // false for ICU_INPUT_ACTIVE_LOW, true for ICU_INPUT_ACTIVE_HIGH
volatile int started;
// todo: make this a template & reduce number of listeners?
@ -33,7 +33,7 @@ extern "C"
#endif /* __cplusplus */
void initWaveAnalyzerDriver(WaveReaderHw *hw, brain_pin_e brainPin);
void setWaveReaderMode(WaveReaderHw *hw, bool mode);
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh);
ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
#ifdef __cplusplus