Skip to content

Commit

Permalink
IO_I2CDFPlayer.h update and test
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
kempe63 committed Jan 20, 2025
1 parent 95d90aa commit 58b1806
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ my*.h
compile_commands.json
newcode.txt.old
UserAddin.txt
platformio.ini
13 changes: 11 additions & 2 deletions IO_I2CDFPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ class I2CDFPlayer : public IODevice {
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 {
Expand Down Expand Up @@ -549,8 +550,8 @@ class I2CDFPlayer : public IODevice {
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];
}

Expand Down Expand Up @@ -616,6 +617,14 @@ class I2CDFPlayer : public IODevice {
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
Expand Down
10 changes: 5 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 = .

Expand Down
2 changes: 2 additions & 0 deletions version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58b1806

Please sign in to comment.