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

A few more name changes to more generic names

This commit is contained in:
Neil McKechnie 2023-02-12 09:01:16 +00:00
parent 35f3cca9b3
commit ec73ac69d9
9 changed files with 22 additions and 21 deletions

View File

@ -67,12 +67,12 @@ size_t Display::write(uint8_t b) {
}
void Display::loop() {
if (!lcdDisplay) return;
lcdDisplay->loop2(false);
if (!displayHandler) return;
displayHandler->loop2(false);
}
Display *Display::loop2(bool force) {
if (!lcdDisplay) return NULL;
if (!displayHandler) return NULL;
// If output device is busy, don't do anything on this loop
// This avoids blocking while waiting for the device to complete.

View File

@ -21,4 +21,4 @@
#include "DisplayInterface.h"
DisplayInterface *DisplayInterface::lcdDisplay = 0;
DisplayInterface *DisplayInterface::displayHandler = 0;

View File

@ -41,7 +41,7 @@ public:
if (!displayNo) clear();
}
static DisplayInterface *lcdDisplay;
static DisplayInterface *displayHandler;
};
#endif

View File

@ -40,14 +40,14 @@
// LiquidCrystal_I2C for I2C LCD driver for HD44780 with PCF8574 'backpack'.
#if defined(OLED_DRIVER)
#define CONDITIONAL_LCD_START for (DisplayInterface * dummy=new SSD1306AsciiWire(OLED_DRIVER);dummy!=NULL; dummy=dummy->loop2(true))
#define CONDITIONAL_DISPLAY_START for (DisplayInterface * dummy=new SSD1306AsciiWire(OLED_DRIVER);dummy!=NULL; dummy=dummy->loop2(true))
#elif defined(LCD_DRIVER)
#define CONDITIONAL_LCD_START for (DisplayInterface * dummy=new LiquidCrystal_I2C(LCD_DRIVER);dummy!=NULL; dummy=dummy->loop2(true))
#define CONDITIONAL_DISPLAY_START for (DisplayInterface * dummy=new LiquidCrystal_I2C(LCD_DRIVER);dummy!=NULL; dummy=dummy->loop2(true))
#else
// Create null display handler just in case someone calls lcdDisplay->something without checking if lcdDisplay is NULL!
#define CONDITIONAL_LCD_START { new DisplayInterface(); }
// Create null display handler just in case someone calls displayHandler->something without checking if displayHandler is NULL!
#define CONDITIONAL_DISPLAY_START { new DisplayInterface(); }
#endif
#endif // LCD_Implementation_h

View File

@ -110,11 +110,11 @@ protected:
oled = new SSD1306AsciiWire();
// Store pointer to this object into CS display hook, so that we
// will intercept any subsequent calls to lcdDisplay methods.
// will intercept any subsequent calls to displayHandler methods.
// Make a note of the existing display reference, to that we can
// pass on anything we're not interested in.
_nextDisplay = DisplayInterface::lcdDisplay;
DisplayInterface::lcdDisplay = this;
_nextDisplay = DisplayInterface::displayHandler;
DisplayInterface::displayHandler = this;
addDevice(this);
}

View File

@ -57,7 +57,7 @@ LiquidCrystal_I2C::LiquidCrystal_I2C(I2CAddress lcd_Addr, uint8_t lcd_cols,
_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
begin();
backlight();
lcdDisplay = this;
displayHandler = this;
}
}

View File

@ -160,7 +160,7 @@ SSD1306AsciiWire::SSD1306AsciiWire(int width, int height) {
if (I2CManager.exists(address)) {
begin(address, width, height);
// Set singleton Address so CS is able to call it.
lcdDisplay = this;
displayHandler = this;
return;
}
}

View File

@ -45,19 +45,19 @@ void StringFormatter::lcd(byte row, const FSH* input...) {
send2(&USB_SERIAL,input,args);
send(&USB_SERIAL,F(" *>\n"));
if (!Display::lcdDisplay) return;
Display::lcdDisplay->setRow(row);
if (!Display::displayHandler) return;
Display::displayHandler->setRow(row);
va_start(args, input);
send2(Display::lcdDisplay,input,args);
send2(Display::displayHandler,input,args);
}
void StringFormatter::lcd2(uint8_t display, byte row, const FSH* input...) {
va_list args;
if (!Display::lcdDisplay) return;
Display::lcdDisplay->setRow(display, row);
if (!Display::displayHandler) return;
Display::displayHandler->setRow(display, row);
va_start(args, input);
send2(Display::lcdDisplay,input,args);
send2(Display::displayHandler,input,args);
}
void StringFormatter::send(Print * stream, const FSH* input...) {

View File

@ -13,7 +13,8 @@
// PCF8575 I2C GPIO driver added.
// EX-RAIL ANOUT function for triggering analogue
// HAL drivers (e.g. analogue outputs, DFPlayer, PWM).
// Installable HAL OLED Display Driver.
// Installable HAL OLED Display Driver, with
// support for multiple displays.
// Layered HAL Drivers PCA9685pwm and Servo added for
// (1) native PWM on PCA9685 module and
// (2) animations of servo movement via PCA9685pwm.