1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Make LCD Display I2C calls synchronous.

This commit is contained in:
Neil McKechnie 2021-08-25 00:29:57 +01:00
parent d0fed2dd38
commit 80fc9e8a68
2 changed files with 5 additions and 4 deletions

View File

@ -200,7 +200,7 @@ void LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) {
outputBuffer[len++] = highnib; outputBuffer[len++] = highnib;
outputBuffer[len++] = lownib|En; outputBuffer[len++] = lownib|En;
outputBuffer[len++] = lownib; outputBuffer[len++] = lownib;
I2CManager.write(_Addr, outputBuffer, len); I2CManager.write(_Addr, outputBuffer, len); // Write command synchronously
} }
// write 4 data bits to the HD44780 LCD controller. // write 4 data bits to the HD44780 LCD controller.
@ -214,7 +214,7 @@ void LiquidCrystal_I2C::write4bits(uint8_t value) {
uint8_t len = 0; uint8_t len = 0;
outputBuffer[len++] = _data|En; outputBuffer[len++] = _data|En;
outputBuffer[len++] = _data; outputBuffer[len++] = _data;
I2CManager.write(_Addr, outputBuffer, len); I2CManager.write(_Addr, outputBuffer, len); // Write command synchronously
} }
// write a byte to the PCF8574 I2C interface. We don't need to set // write a byte to the PCF8574 I2C interface. We don't need to set
@ -223,5 +223,5 @@ void LiquidCrystal_I2C::expanderWrite(uint8_t value) {
// Wait for previous request to complete before writing to outputbuffer. // Wait for previous request to complete before writing to outputbuffer.
requestBlock.wait(); requestBlock.wait();
outputBuffer[0] = value | _backlightval; outputBuffer[0] = value | _backlightval;
I2CManager.write(_Addr, outputBuffer, 1); I2CManager.write(_Addr, outputBuffer, 1); // Write command synchronously
} }

View File

@ -90,7 +90,8 @@ private:
I2CRB requestBlock; I2CRB requestBlock;
uint8_t outputBuffer[4]; uint8_t outputBuffer[4];
bool isBusy() { return requestBlock.isBusy(); } // I/O is synchronous, so if this is called we're not busy!
bool isBusy() { return false; }
}; };
#endif #endif