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) {
|
||||
if (address >= 0x20 && address <= 0x26)
|
||||
return F("GPIO Expander");
|
||||
#ifdef FAST_CLOCK_I2C
|
||||
else if (address == FAST_CLOCK_I2C)
|
||||
return F("Fast Clock");
|
||||
#endif
|
||||
else if (address == 0x27)
|
||||
return F("GPIO Expander or LCD Display");
|
||||
else if (address == 0x29)
|
||||
|
@ -363,4 +367,4 @@ void I2CAddress::toHex(const uint8_t value, char *buffer) {
|
|||
|
||||
/* static */ bool I2CAddress::_addressWarningDone = false;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
12
IODevice.cpp
12
IODevice.cpp
|
@ -27,6 +27,12 @@
|
|||
#include "IO_MCP23017.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)
|
||||
#define USE_FAST_IO
|
||||
#endif
|
||||
|
@ -75,6 +81,11 @@ void IODevice::begin() {
|
|||
} else {
|
||||
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
|
||||
// Allocates 32 pins 164-195
|
||||
|
@ -582,4 +593,3 @@ bool ArduinoPins::fastReadDigital(uint8_t pin) {
|
|||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,12 +56,12 @@ static void create(I2CAddress i2cAddress) {
|
|||
// XXXX change thistosave2 bytes
|
||||
if (_checkforclock == 0) {
|
||||
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);
|
||||
}
|
||||
else {
|
||||
FAST_CLOCK_EXISTS = false;
|
||||
//DIAG(F("No Fast Clock found"));
|
||||
DIAG(F("No Fast Clock found"));
|
||||
LCD(6,F("CLOCK NOT FOUND"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user