2019-11-11 20:04:27 -08:00
|
|
|
/*
|
|
|
|
* @file digital_input.h
|
|
|
|
*
|
|
|
|
* @date Nov 11, 2019
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
#include "listener_array.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
#if HAL_USE_ICU
|
|
|
|
ICUDriver *driver;
|
|
|
|
#endif /* HAL_USE_ICU */
|
|
|
|
|
|
|
|
bool isActiveHigh = false;
|
|
|
|
volatile bool started = false;
|
|
|
|
brain_pin_e brainPin = GPIO_UNASSIGNED;
|
|
|
|
IntListenerArray<1> widthListeners;
|
|
|
|
IntListenerArray<1> periodListeners;
|
2019-11-11 20:32:09 -08:00
|
|
|
|
|
|
|
// Width/Period names are historically inherited from ICU implementation, todo: migrate to better names, high/low? rise/hall?
|
|
|
|
void setWidthCallback(VoidInt handler, void *arg);
|
2019-11-12 20:38:02 -08:00
|
|
|
void setPeriodCallback(VoidInt handler, void *arg);
|
2019-11-11 20:04:27 -08:00
|
|
|
} digital_input_s;
|