mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
FastClock BUG
serial is working I2C is wrong First, the initialization was incorrect. The FastClock was initialized before the I2C Manager was initialized Second: FastClock Functions are missing
This commit is contained in:
parent
c55fa9f9d2
commit
fb8cca8d35
|
@ -48,6 +48,10 @@
|
||||||
static const FSH * guessI2CDeviceType(uint8_t address) {
|
static const FSH * guessI2CDeviceType(uint8_t address) {
|
||||||
if (address >= 0x20 && address <= 0x26)
|
if (address >= 0x20 && address <= 0x26)
|
||||||
return F("GPIO Expander");
|
return F("GPIO Expander");
|
||||||
|
#ifdef FAST_CLOCK_I2C
|
||||||
|
else if (address == FAST_CLOCK_I2C)
|
||||||
|
return F("Fast Clock");
|
||||||
|
#endif
|
||||||
else if (address == 0x27)
|
else if (address == 0x27)
|
||||||
return F("GPIO Expander or LCD Display");
|
return F("GPIO Expander or LCD Display");
|
||||||
else if (address == 0x29)
|
else if (address == 0x29)
|
||||||
|
@ -363,4 +367,4 @@ void I2CAddress::toHex(const uint8_t value, char *buffer) {
|
||||||
|
|
||||||
/* static */ bool I2CAddress::_addressWarningDone = false;
|
/* static */ bool I2CAddress::_addressWarningDone = false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
12
IODevice.cpp
12
IODevice.cpp
|
@ -27,6 +27,12 @@
|
||||||
#include "IO_MCP23017.h"
|
#include "IO_MCP23017.h"
|
||||||
#include "DCCTimer.h"
|
#include "DCCTimer.h"
|
||||||
|
|
||||||
|
#if !defined(IO_NO_HAL)
|
||||||
|
#ifdef FAST_CLOCK_I2C
|
||||||
|
#include "IO_EXFastClock.h" // FastClock driver
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
|
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR)
|
||||||
#define USE_FAST_IO
|
#define USE_FAST_IO
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,6 +81,11 @@ void IODevice::begin() {
|
||||||
} else {
|
} else {
|
||||||
DIAG(F("Default PCA9685 at I2C 0x41 disabled due to configured user device"));
|
DIAG(F("Default PCA9685 at I2C 0x41 disabled due to configured user device"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FAST_CLOCK_I2C
|
||||||
|
EXFastClock::create(FAST_CLOCK_I2C);
|
||||||
|
DIAG(F("EXFastClock::create"));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Predefine two MCP23017 module 0x20/0x21 if no conflicts
|
// Predefine two MCP23017 module 0x20/0x21 if no conflicts
|
||||||
// Allocates 32 pins 164-195
|
// Allocates 32 pins 164-195
|
||||||
|
@ -582,4 +593,3 @@ bool ArduinoPins::fastReadDigital(uint8_t pin) {
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,12 @@ static void create(I2CAddress i2cAddress) {
|
||||||
// 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;
|
||||||
//DIAG(F("No Fast Clock found"));
|
DIAG(F("No Fast Clock found"));
|
||||||
LCD(6,F("CLOCK NOT FOUND"));
|
LCD(6,F("CLOCK NOT FOUND"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user