mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Update IO_EXFastclock.h
Update to support extended I2C addresses.
This commit is contained in:
parent
45e3e3d185
commit
eddd6382d9
|
@ -40,24 +40,24 @@ bool FAST_CLOCK_EXISTS = true;
|
||||||
class EXFastClock : public IODevice {
|
class EXFastClock : public IODevice {
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
EXFastClock(uint8_t I2CAddress){
|
EXFastClock(I2CAddress i2cAddress){
|
||||||
_I2CAddress = I2CAddress;
|
_I2CAddress = i2cAddress;
|
||||||
addDevice(this);
|
addDevice(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create(uint8_t _I2CAddress) {
|
static void create(I2CAddress i2cAddress) {
|
||||||
|
|
||||||
DIAG(F("Checking for Clock"));
|
DIAG(F("Checking for Clock"));
|
||||||
// Start by assuming we will find the clock
|
// Start by assuming we will find the clock
|
||||||
// Check if specified I2C address is responding (blocking operation)
|
// Check if specified I2C address is responding (blocking operation)
|
||||||
// Returns I2C_STATUS_OK (0) if OK, or error code.
|
// Returns I2C_STATUS_OK (0) if OK, or error code.
|
||||||
uint8_t _checkforclock = I2CManager.checkAddress(_I2CAddress);
|
uint8_t _checkforclock = I2CManager.checkAddress(i2cAddress);
|
||||||
DIAG(F("Clock check result - %d"), _checkforclock);
|
DIAG(F("Clock check result - %d"), _checkforclock);
|
||||||
// XXXX change thistosave2 bytes
|
// XXXX change thistosave2 bytes
|
||||||
if (_checkforclock == 0) {
|
if (_checkforclock == 0) {
|
||||||
FAST_CLOCK_EXISTS = true;
|
FAST_CLOCK_EXISTS = true;
|
||||||
//DIAG(F("I2C Fast Clock found at %s"), _I2CAddress.toString());
|
//DIAG(F("I2C Fast Clock found at %s"), i2cAddress.toString());
|
||||||
new EXFastClock(_I2CAddress);
|
new EXFastClock(i2cAddress);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FAST_CLOCK_EXISTS = false;
|
FAST_CLOCK_EXISTS = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user