Support for HD44780 via PCF8574

This commit is contained in:
Tony Corbett G0WFV
2016-06-27 18:48:13 +01:00
parent 084e39c1de
commit 04b297de20
3 changed files with 85 additions and 8 deletions

View File

@@ -206,12 +206,16 @@ bool CHD44780::open()
adafruitLCDSetup();
#endif
#ifdef PCF8574_DISPLAY
pcf8574LCDSetup();
#endif
m_fd = ::lcdInit(m_rows, m_cols, 4, m_rb, m_strb, m_d0, m_d1, m_d2, m_d3, 0, 0, 0, 0);
if (m_fd == -1) {
LogError("Unable to open the HD44780");
return false;
}
::lcdDisplay(m_fd, 1);
::lcdCursor(m_fd, 0);
::lcdCursorBlink(m_fd, 0);
@@ -296,6 +300,36 @@ void CHD44780::adafruitLCDColour(ADAFRUIT_COLOUR colour)
}
#endif
#ifdef PCF8574_DISPLAY
void CHD44780::pcf8574LCDSetup()
{
// Initalize PFC8574
::pcf8574Setup(AF_BASE, PCF8574);
// Initialise LCD
m_fd = ::lcdInit(m_rows, m_cols, 4, AF_RS, AF_E, AF_D1, AF_D2, AF_D3, AF_D4, 0, 0, 0, 0);
if (m_fd == -1) {
LogError("Unable to open the HD44780 via I2C");
return false;
}
m_rb = AF_RS;
m_strb = AF_E;
m_d0 = AF_D1;
m_d1 = AF_D2;
m_d2 = AF_D3;
m_d3 = AF_D4;
// Turn on backlight
::pinMode (AF_BL, OUTPUT);
::digitalWrite (AF_BL, 1);
// Set LCD to write mode.
::pinMode (AF_RW, OUTPUT);
::digitalWrite (AF_RW, 0);
}
#endif
void CHD44780::setIdleInt()
{
m_dmrScrollTimer1.stop(); // Stop the scroll timer on slot 1