mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 15:46:14 +01:00
Add IO_PCA9554.h to IODevice.h
This commit is contained in:
parent
3b35537c68
commit
11c5638782
|
@ -544,6 +544,7 @@ protected:
|
|||
#include "IO_PCF8574.h"
|
||||
#include "IO_PCF8575.h"
|
||||
#include "IO_PCA9555.h"
|
||||
#include "IO_PCA9554.h"
|
||||
#include "IO_duinoNodes.h"
|
||||
#include "IO_EXIOExpander.h"
|
||||
#include "IO_trainbrains.h"
|
||||
|
|
12
IO_PCA9554.h
12
IO_PCA9554.h
|
@ -40,8 +40,10 @@ private:
|
|||
PCA9554(VPIN vpin, uint8_t nPins, I2CAddress I2CAddress, int interruptPin=-1)
|
||||
: GPIOBase<uint8_t>((FSH *)F("PCA9554"), vpin, nPins, I2CAddress, interruptPin)
|
||||
{
|
||||
if (nPins > 8)
|
||||
if (nPins > 8) {
|
||||
DIAG(F("PCA9554 nPins %d larger than allowed!"));
|
||||
nPins = 8;
|
||||
}
|
||||
requestBlock.setRequestParams(_I2CAddress, inputBuffer, sizeof(inputBuffer),
|
||||
outputBuffer, sizeof(outputBuffer));
|
||||
outputBuffer[0] = REG_INPUT_P0;
|
||||
|
@ -81,8 +83,12 @@ private:
|
|||
}
|
||||
// This function is invoked when an I/O operation on the requestBlock completes.
|
||||
void _processCompletion(uint8_t status) override {
|
||||
if (status == I2C_STATUS_OK)
|
||||
_portInputState = inputBuffer[0];
|
||||
if (status == I2C_STATUS_OK)
|
||||
{
|
||||
if (_portInputState != (inputBuffer[0] | _portMode))
|
||||
DIAG(F("PCA9554 inputs changed, value now %x"), inputBuffer[0]);
|
||||
_portInputState = inputBuffer[0] | _portMode;
|
||||
}
|
||||
else
|
||||
_portInputState = 0xff;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user