2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file digital_input_hw.h
|
|
|
|
*
|
|
|
|
* @date Jun 23, 2013
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2018-12-15 22:13:44 -08:00
|
|
|
#ifndef DIGITAL_INPUT_HW_H_
|
|
|
|
#define DIGITAL_INPUT_HW_H_
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-09-16 19:26:57 -07:00
|
|
|
#include "global.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#if HAL_USE_ICU || defined(__DOXYGEN__)
|
|
|
|
|
|
|
|
#include "listener_array.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ICUDriver *driver;
|
2016-01-11 16:02:19 -08:00
|
|
|
bool isActiveHigh; // false for ICU_INPUT_ACTIVE_LOW, true for ICU_INPUT_ACTIVE_HIGH
|
|
|
|
volatile bool started;
|
2017-02-06 17:02:18 -08:00
|
|
|
brain_pin_e brainPin;
|
2016-07-05 17:02:56 -07:00
|
|
|
IntListenerArray<1> widthListeners;
|
|
|
|
IntListenerArray<1> periodListeners;
|
2015-07-10 06:01:56 -07:00
|
|
|
} digital_input_s;
|
|
|
|
|
|
|
|
void turnOnCapturePin(const char *msg, brain_pin_e brainPin);
|
2018-01-01 08:27:15 -08:00
|
|
|
|
|
|
|
digital_input_s *addWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
2015-07-10 06:01:56 -07:00
|
|
|
void startInputDriver(digital_input_s *hw, bool isActiveHigh);
|
2018-01-01 08:27:15 -08:00
|
|
|
void removeWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
|
|
|
|
|
2017-02-06 16:03:19 -08:00
|
|
|
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
|
2016-08-16 19:05:36 -07:00
|
|
|
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2018-12-15 22:13:44 -08:00
|
|
|
#endif /* DIGITAL_INPUT_HW_H_ */
|