2023-04-08 00:56:20 +00:00
|
|
|
#pragma once
|
|
|
|
#include "Gpio.h"
|
|
|
|
#include <thread>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
class PinMonitor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PinMonitor(unsigned int pinNum, std::function<void(int)> call_back);
|
|
|
|
~PinMonitor();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void monitor();
|
2023-05-02 01:50:55 +00:00
|
|
|
|
2023-04-08 00:56:20 +00:00
|
|
|
Gpio pin;
|
|
|
|
std::function<void(unsigned int)> call_back;
|
|
|
|
std::thread thread_monitor;
|
|
|
|
volatile bool bMonitor = true;
|
|
|
|
};
|