change callbacks to vector
This commit is contained in:
parent
71475ef2f1
commit
011710fe82
19 changed files with 207 additions and 109 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <ExpansionCard.hpp>
|
||||
#include <PCF8574.h>
|
||||
#include <vector>
|
||||
|
||||
#define CARD_TYPE_DIGITAL_INPUT 0x01
|
||||
|
||||
|
@ -27,7 +28,7 @@ class DigitalInputCard : public ExpansionCard {
|
|||
// Register a callback function to be called when a pin changes
|
||||
void registerCallback(std::function<void(uint8_t, bool)> callback);
|
||||
// Unregister the callback function
|
||||
void unregisterCallback();
|
||||
//void unregisterCallback(std::function<void(uint8_t, bool)> callback);
|
||||
// Load a new pin map
|
||||
void loadPinMap(uint8_t pinMap[16]);
|
||||
// Get type of card
|
||||
|
@ -47,7 +48,7 @@ class DigitalInputCard : public ExpansionCard {
|
|||
uint8_t pinMap[16];
|
||||
// A map of the virtual pin to the physical pin
|
||||
uint8_t virtualPinMap[16];
|
||||
std::function<void(uint8_t, bool)> callback;
|
||||
std::vector<std::function<void(uint8_t, bool)>> callbacks;
|
||||
void refreshInputBankA();
|
||||
void refreshInputBankB();
|
||||
void handlePinChange(int pin, uint8_t& currentBuffer, uint8_t& previousBuffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue