changes for generial input/output via mqtt
This commit is contained in:
14
Gpio.h
14
Gpio.h
@@ -19,7 +19,9 @@ enum class PinRole
|
||||
OutputHighMotorBlocked,
|
||||
OutputHighRtoActive,
|
||||
OutputHighCmActive,
|
||||
OutputHighRtoOrCmActive
|
||||
OutputHighRtoOrCmActive,
|
||||
GeneralOutput,
|
||||
GeneralInput
|
||||
};
|
||||
|
||||
enum class GpioAction
|
||||
@@ -30,7 +32,8 @@ enum class GpioAction
|
||||
ElectricStrikeActuation,
|
||||
ActivateRTO,
|
||||
ActivateCM,
|
||||
DeactivateRtoCm
|
||||
DeactivateRtoCm,
|
||||
GeneralInput
|
||||
};
|
||||
|
||||
struct PinEntry
|
||||
@@ -47,7 +50,7 @@ public:
|
||||
|
||||
void migrateObsoleteSetting();
|
||||
|
||||
void addCallback(std::function<void(const GpioAction&)> callback);
|
||||
void addCallback(std::function<void(const GpioAction&, const int&)> callback);
|
||||
|
||||
void loadPinConfiguration();
|
||||
void savePinConfiguration(const std::vector<PinEntry>& pinConfiguration);
|
||||
@@ -63,7 +66,8 @@ public:
|
||||
void setPinOutput(const uint8_t& pin, const uint8_t& state);
|
||||
|
||||
private:
|
||||
void notify(const GpioAction& action);
|
||||
void IRAM_ATTR notify(const GpioAction& action, const int& pin);
|
||||
static void inputCallback(const int & pin);
|
||||
|
||||
const std::vector<uint8_t> _availablePins = { 2, 4, 5, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 32, 33 };
|
||||
const std::vector<PinRole> _allRoles =
|
||||
@@ -94,7 +98,7 @@ private:
|
||||
static void IRAM_ATTR isrActivateCM();
|
||||
static void IRAM_ATTR isrDeactivateRtoCm();
|
||||
|
||||
std::vector<std::function<void(const GpioAction&)>> _callbacks;
|
||||
std::vector<std::function<void(const GpioAction&, const int&)>> _callbacks;
|
||||
|
||||
static Gpio* _inst;
|
||||
static unsigned long _debounceTs;
|
||||
|
||||
Reference in New Issue
Block a user