1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Starting on driver feedback

This commit is contained in:
peteGSX 2023-03-13 05:29:22 +10:00
parent 5e60fb4e27
commit 0cc07ed1df

View File

@ -156,10 +156,15 @@ private:
void _loop(unsigned long currentMicros) override {
(void)currentMicros; // remove warning
if (_deviceState == DEVSTATE_FAILED) return;
_command1Buffer[0] = EXIORDD;
I2CManager.read(_i2cAddress, _digitalInputStates, _digitalPinBytes, _command1Buffer, 1, &_i2crb);
_command1Buffer[0] = EXIORDAN;
I2CManager.read(_i2cAddress, _analogueInputStates, _analoguePinBytes, _command1Buffer, 1, &_i2crb);
if (_i2crb.isBusy()) return;
if (_commandFlag) {
_command1Buffer[0] = EXIORDD;
I2CManager.read(_i2cAddress, _digitalInputStates, _digitalPinBytes, _command1Buffer, 1, &_i2crb);
} else {
_command1Buffer[0] = EXIORDAN;
I2CManager.read(_i2cAddress, _analogueInputStates, _analoguePinBytes, _command1Buffer, 1, &_i2crb);
}
_commandFlag = !_commandFlag;
}
// Obtain the correct analogue input value
@ -243,6 +248,7 @@ private:
byte _servoBuffer[7];
uint8_t* _analoguePinMap;
I2CRB _i2crb;
bool _commandFlag = 0;
// EX-IOExpander protocol flags
enum {