mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Update IO_RotaryEncoder.h
Update to support extended I2C addresses.
This commit is contained in:
parent
5e9ae4a0ac
commit
45e3e3d185
|
@ -45,14 +45,14 @@
|
||||||
class RotaryEncoder : public IODevice {
|
class RotaryEncoder : public IODevice {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
RotaryEncoder(VPIN firstVpin, int nPins, uint8_t I2CAddress){
|
RotaryEncoder(VPIN firstVpin, int nPins, I2CAddress i2cAddress){
|
||||||
_firstVpin = firstVpin;
|
_firstVpin = firstVpin;
|
||||||
_nPins = nPins;
|
_nPins = nPins;
|
||||||
_I2CAddress = I2CAddress;
|
_I2CAddress = i2cAddress;
|
||||||
addDevice(this);
|
addDevice(this);
|
||||||
}
|
}
|
||||||
static void create(VPIN firstVpin, int nPins, uint8_t I2CAddress) {
|
static void create(VPIN firstVpin, int nPins, I2CAddress i2cAddress) {
|
||||||
if (checkNoOverlap(firstVpin, nPins, I2CAddress)) new RotaryEncoder(firstVpin, nPins, I2CAddress);
|
if (checkNoOverlap(firstVpin, nPins, i2cAddress)) new RotaryEncoder(firstVpin, nPins, i2cAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -108,7 +108,6 @@ private:
|
||||||
(int)_firstVpin, _firstVpin+_nPins-1, (_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F(""));
|
(int)_firstVpin, _firstVpin+_nPins-1, (_deviceState==DEVSTATE_FAILED) ? F("OFFLINE") : F(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t _I2CAddress;
|
|
||||||
int8_t _position;
|
int8_t _position;
|
||||||
int8_t _previousPosition = 0;
|
int8_t _previousPosition = 0;
|
||||||
uint8_t _versionBuffer[3];
|
uint8_t _versionBuffer[3];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user