allow input preload and state toggling
This commit is contained in:
parent
b778fb6a02
commit
4ea2122f6e
|
@ -310,4 +310,16 @@ void DigitalInputCard::loadPinMap(uint8_t pinMap[16])
|
|||
uint8_t DigitalInputCard::getType()
|
||||
{
|
||||
return CARD_TYPE_DIGITAL_INPUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Preload the previous input buffer and the input buffer
|
||||
*
|
||||
* @note This function is useful if you want to preload the input buffers with a run-time value
|
||||
*/
|
||||
void DigitalInputCard::preloadInputBuffer() {
|
||||
refreshInputBankA();
|
||||
refreshInputBankB();
|
||||
previousInputBufferA = inputBufferA;
|
||||
previousInputBufferB = inputBufferB;
|
||||
}
|
|
@ -41,6 +41,8 @@ class DigitalInputCard : public ExpansionCard {
|
|||
void unregisterCallback(uint8_t handler);
|
||||
// Load a new pin map
|
||||
void loadPinMap(uint8_t pinMap[16]);
|
||||
// Preload previousInputBuffer and inputBuffer
|
||||
void preloadInputBuffer();
|
||||
// Get type of card
|
||||
uint8_t getType();
|
||||
private:
|
||||
|
|
|
@ -306,4 +306,13 @@ void DigitalOutputCard::saveStateToFRAM() {
|
|||
if(!framBinded) return;
|
||||
uint16_t packed = packStates();
|
||||
this->fram->write16(framAddress, packed);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggle the state of the specified pin
|
||||
*
|
||||
* @param pin The pin to toggle
|
||||
*/
|
||||
void DigitalOutputCard::toggleState(uint8_t pin) {
|
||||
this->setState(pin, !this->state_buffer[pin]);
|
||||
}
|
|
@ -58,6 +58,8 @@ public:
|
|||
void setValue(uint8_t pin, uint16_t value);
|
||||
// Get the state of the specified pin
|
||||
bool getState(uint8_t pin);
|
||||
// Toggle the state of the specified pin
|
||||
void toggleState(uint8_t pin);
|
||||
// Get the pwm value of the specified pin
|
||||
uint16_t getValue(uint8_t pin);
|
||||
// Register a callback function that will be called when the state of a pin changes
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define SDK_VESRION "2.9.1"
|
||||
#define SDK_VESRION "2.9.2"
|
Loading…
Reference in New Issue