Add support for Adafruit i2c 16 x 2 RGB LCD Pi Plate

This commit is contained in:
root
2016-04-17 07:11:05 -04:00
parent ff006133d4
commit 2f09a0047f
4 changed files with 43 additions and 6 deletions

View File

@@ -54,6 +54,10 @@ bool CHD44780::open()
{
::wiringPiSetup();
#ifdef ADAFRUIT_DISPLAY
adafruitLCDSetup();
#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");
@@ -67,6 +71,22 @@ bool CHD44780::open()
return true;
}
#ifdef ADAFRUIT_DISPLAY
void CHD44780::adafruitLCDSetup()
{
// The other control pins are initialised with lcdInit ()
::mcp23017Setup (AF_BASE, MCP23017);
// Backlight LEDs, Only one color (RED)
pinMode (AF_RED, OUTPUT);
digitalWrite (AF_RED, LOW); // The colour outputs are inverted.
// Control signals
pinMode (AF_RW, OUTPUT);
digitalWrite (AF_RW, LOW);
}
#endif
void CHD44780::setIdle()
{
::lcdClear(m_fd);