mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-25 05:31:24 +01:00
Analogue inputs functioning
This commit is contained in:
parent
459904e5dd
commit
20b3e9064c
@ -143,14 +143,13 @@ private:
|
|||||||
|
|
||||||
int _readAnalogue(VPIN vpin) override {
|
int _readAnalogue(VPIN vpin) override {
|
||||||
if (vpin < _firstVpin + _numDigitalPins) return false;
|
if (vpin < _firstVpin + _numDigitalPins) return false;
|
||||||
int pin = vpin - _firstVpin;
|
int pin = vpin - _firstVpin - _numDigitalPins;
|
||||||
// _analogueOutBuffer[0] = EXIORDAN;
|
// _analogueOutBuffer[0] = EXIORDAN;
|
||||||
// _analogueOutBuffer[1] = pin;
|
// _analogueOutBuffer[1] = pin;
|
||||||
// I2CManager.read(_i2cAddress, _analogueInBuffer, 2, _analogueOutBuffer, 2);
|
// I2CManager.read(_i2cAddress, _analogueInBuffer, 2, _analogueOutBuffer, 2);
|
||||||
// return (_analogueInBuffer[1] << 8) + _analogueInBuffer[0];
|
// return (_analogueInBuffer[1] << 8) + _analogueInBuffer[0];
|
||||||
uint8_t _pinLSBByte = pin * 2;
|
uint8_t _pinLSBByte = pin * 2;
|
||||||
uint8_t _pinMSBByte = _pinLSBByte + 1;
|
uint8_t _pinMSBByte = _pinLSBByte + 1;
|
||||||
// DIAG(F("Vpin %d LSB %d MSB %d"), vpin, _analogueInputStates[_pinLSBByte], _analogueInputStates[_pinMSBByte]);
|
|
||||||
return (_analogueInputStates[_pinMSBByte] << 8) + _analogueInputStates[_pinLSBByte];
|
return (_analogueInputStates[_pinMSBByte] << 8) + _analogueInputStates[_pinLSBByte];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user