57 using Clock = std::chrono::steady_clock;
76 return std::chrono::duration_cast<std::chrono::milliseconds>(
108 : scheduler{scheduler}, pollInterval{pollInterval}
125 uint32_t detectionThreshold = 1,
126 bool reverted =
false);
145 void periodicPinValueCheck(miosix::GpioPin pin);
148 uint32_t pollInterval;
160 std::map<miosix::GpioPin, PinEntry, GpioPinCompare> callbacks;
std::chrono::steady_clock Clock
std::function< void(PinTransition transition, const PinData &data)> PinCallback
Callback function type for pin transitions.
Clock::time_point TimePoint
void resetPinChangesCount(miosix::GpioPin pin)
Resets the changes counter for the specified pin.
PinObserver(TaskScheduler &scheduler, uint32_t pollInterval=20)
Construct a new PinObserver object.
bool registerPinCallback(miosix::GpioPin pin, PinCallback callback, uint32_t detectionThreshold=1, bool reverted=false)
PinData getPinData(miosix::GpioPin pin)
Returns the information for the specified pin.
The Task Scheduler allow to manage simple tasks with a single thread. All the task added must not tak...
Driver for the VN100S IMU.
PinTransition
Pin transition.
@ FALLING_EDGE
The pin goes from high to low.
@ RISING_EDGE
The pin goes from low to high.
PinObserver::PinCallback callback
The callback function.
uint32_t threshold
Number of periods to trigger an event.
bool reverted
Whether to revert the pin state.
bool lastState
The last detected pin state.
std::chrono::milliseconds getLastDetectionDelay() const
PinObserver::TimePoint lastTransitionTs
uint32_t changesCount
Incremental count of the pin changes.
PinObserver::TimePoint lastStateChangeTs