1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-01-28 21:23:06 +01:00

IO_I2CDFPlayer.h update and test

- Test: IO_I2CDFPlayer.h inserted 10mS deleay in Init_SC16IS752() just after soft-reset for board with 1.8432 Mhz xtal
- IO_I2CDFPlayer.h: fixed 2 compiler errors as the compilers are getting stricter
This commit is contained in:
kempe63 2025-01-20 19:10:20 +00:00
parent 95d90aa337
commit 58b180603a
4 changed files with 19 additions and 7 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ my*.h
compile_commands.json
newcode.txt.old
UserAddin.txt
platformio.ini

View File

@ -511,6 +511,7 @@ public:
if (pin == 0) { // Do nothing if not vPin 0
return _playing;
}
return _playing; // fix for compile error: "control reaches end of non-void function [-Wreturn-type]"
}
void _display() override {
@ -549,8 +550,8 @@ private:
setChecksum(out);
// Prepend the DFPlayer command with REG address and UART Channel in _outbuffer
_outbuffer[0] = REG_THR << 3 | _UART_CH << 1; //TX FIFO and UART Channel
for ( int i = 1; i < sizeof(out)+1 ; i++){
_outbuffer[0] = REG_THR << 3 | _UART_CH << 1; //TX FIFO and UART Channel
for ( uint8_t i = 1; i < sizeof(out)+1 ; i++){
_outbuffer[i] = out[i-1];
}
@ -616,6 +617,14 @@ private:
uint16_t _divisor = (_sc16is752_xtal_freq/PRESCALER)/(BAUD_RATE * 16); // Calculate _divisor for baudrate
TEMP_REG_VAL = 0x08; // UART Software reset
UART_WriteRegister(REG_IOCONTROL, TEMP_REG_VAL);
// Extra delay when using low frequency xtal after soft reset
// Test when using 1.8432 Mhz xtal
if(_sc16is752_xtal_freq == SC16IS752_XTAL_FREQ_LOW){
_timeoutTime = micros() + 10000UL; // 10mS timeout
_awaitingResponse = true;
}
TEMP_REG_VAL = 0x00; // Set pins to GPIO mode
UART_WriteRegister(REG_IOCONTROL, TEMP_REG_VAL);
TEMP_REG_VAL = 0xFF; //Set all pins as output

View File

@ -11,11 +11,11 @@
[platformio]
default_envs =
mega2560
uno
nano
ESP32
Nucleo-F411RE
Nucleo-F446RE
; uno
; nano
; ESP32
; Nucleo-F411RE
; Nucleo-F446RE
src_dir = .
include_dir = .

View File

@ -6,6 +6,8 @@
#define VERSION "5.5.8"
// 5.5.8 - EXSensorCam clean up to match other filters and
// - avoid need for config.h settings
// - Test: IO_I2CDFPlayer.h inserted 10mS deleay in Init_SC16IS752() just after soft-reset for board with 1.8432 Mhz xtal
// - IO_I2CDFPlayer.h: fixed 2 compiler errors as the compilers are getting stricter
// 5.5.7 - ESP32 bugfix packet buffer race (as 5.4.1)
// 5.5.6 - Fix ESP32 build bug caused by include reference loop
// 5.5.5 - Railcom implementation with IO_I2CRailcom driver