diff --git a/HD44780.cpp b/HD44780.cpp index 29e320b..2f5609b 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -53,6 +53,90 @@ m_dmr(false) assert(cols > 15U); } +unsigned char fmChar[8] = +{ + 0b11100, + 0b10000, + 0b11000, + 0b10000, + 0b00101, + 0b00111, + 0b00101, + 0b00101 +}; + +unsigned char toChar[8] = +{ + 0b11100, + 0b01000, + 0b01000, + 0b01000, + 0b00010, + 0b00101, + 0b00101, + 0b00010 +}; + +unsigned char mChar[8] = +{ + 0b10001, + 0b11011, + 0b10101, + 0b10001, + 0b10001, + 0b00000, + 0b11111, + 0b11111 +}; + +unsigned char dChar[8] = +{ + 0b11110, + 0b10001, + 0b10001, + 0b10001, + 0b11110, + 0b00000, + 0b11111, + 0b11111 +}; + +unsigned char vChar[8] = +{ + 0b10001, + 0b10001, + 0b10001, + 0b01010, + 0b00100, + 0b00000, + 0b11111, + 0b11111 +}; + +unsigned char rfChar[8] = +{ + 0b11100, + 0b10100, + 0b11000, + 0b10100, + 0b00111, + 0b00100, + 0b00110, + 0b00100 +}; + +unsigned char ipChar[8] = +{ + 0b01000, + 0b01000, + 0b01000, + 0b01000, + 0b00110, + 0b00101, + 0b00110, + 0b00100 +}; + CHD44780::~CHD44780() { } @@ -84,6 +168,13 @@ bool CHD44780::open() ::lcdDisplay(m_fd, 1); ::lcdCursor(m_fd, 0); ::lcdCursorBlink(m_fd, 0); + ::lcdCharDef(m_fd, 0, fmChar); + ::lcdCharDef(m_fd, 1, toChar); + ::lcdCharDef(m_fd, 2, mChar); + ::lcdCharDef(m_fd, 3, dChar); + ::lcdCharDef(m_fd, 4, vChar); + ::lcdCharDef(m_fd, 5, rfChar); + ::lcdCharDef(m_fd, 6, ipChar); return true; } @@ -172,7 +263,12 @@ void CHD44780::setIdleInt() ::lcdPrintf(m_fd, "%-6s / %u", m_callsign.c_str(), m_dmrid); ::lcdPosition(m_fd, 0, 1); - ::lcdPuts(m_fd, "MMDVM Idle"); + ::lcdPutchar(m_fd, 2); + ::lcdPutchar(m_fd, 2); + ::lcdPutchar(m_fd, 3); + ::lcdPutchar(m_fd, 4); + ::lcdPutchar(m_fd, 2); + ::lcdPuts(m_fd, " Idle"); m_dmr = false; } @@ -195,7 +291,11 @@ void CHD44780::setErrorInt(const char* text) } ::lcdPosition(m_fd, 0, 0); - ::lcdPuts(m_fd, "MMDVM"); + ::lcdPutchar(m_fd, 2); + ::lcdPutchar(m_fd, 2); + ::lcdPutchar(m_fd, 3); + ::lcdPutchar(m_fd, 4); + ::lcdPutchar(m_fd, 2); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%s ERROR", text); @@ -219,7 +319,11 @@ void CHD44780::setLockoutInt() } ::lcdPosition(m_fd, 0, 0); - ::lcdPuts(m_fd, "MMDVM"); + ::lcdPutchar(m_fd, 2); + ::lcdPutchar(m_fd, 2); + ::lcdPutchar(m_fd, 3); + ::lcdPutchar(m_fd, 4); + ::lcdPutchar(m_fd, 2); ::lcdPosition(m_fd, 0, 1); ::lcdPuts(m_fd, "Lockout"); @@ -354,7 +458,6 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPosition(m_fd, 0, 0); ::lcdPuts(m_fd, "DMR "); ::lcdPosition(m_fd, 0, 1); -// ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); ::lcdPrintf(m_fd, "%-16s", "Listening"); } } else if (m_rows == 4U && m_cols == 16U) { @@ -390,11 +493,12 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro } } - if (m_rows == 2U && m_cols == 16U) { + #ifdef ADAFRUIT_DISPLAY adafruitLCDColour(AC_RED); #endif + if (m_rows == 2U && m_cols == 16U) { char buffer[16U]; if (m_duplex) { if (slotNo == 1U) { @@ -407,21 +511,19 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } } else { - ::sprintf(buffer, "From: %s", src.c_str()); ::lcdPosition(m_fd, 0, 0); -// ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); - ::lcdPrintf(m_fd, "%-16s", buffer); + ::lcdPutchar(m_fd, 0); + ::sprintf(buffer, " %s", src.c_str()); + ::lcdPrintf(m_fd, "%-14s", buffer); + ::lcdPutchar(m_fd, strcmp(type, "R") == 0 ? 5 : 6); - ::sprintf(buffer, "To : %s%s", group ? "TG" : "", dst.c_str()); ::lcdPosition(m_fd, 0, 1); -// ::lcdPrintf(m_fd, "%.*s", m_cols, buffer); - ::lcdPrintf(m_fd, "%-16s", buffer); + ::lcdPutchar(m_fd, 1); + ::sprintf(buffer, " %s%s", group ? "TG" : "", dst.c_str()); + ::lcdPrintf(m_fd, "%-14s", buffer); + ::lcdPutchar(m_fd, strcmp(type, "R") == 0 ? 5 : 6); } } else if (m_rows == 4U && m_cols == 16U) { -#ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); -#endif - char buffer[16U]; if (slotNo == 1U) { ::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str()); @@ -433,10 +535,6 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } } else if (m_rows == 4U && m_cols == 20U) { -#ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); -#endif - char buffer[20U]; if (slotNo == 1U) { ::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str()); @@ -448,10 +546,6 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer); } } else if (m_rows == 2U && m_cols == 40U) { -#ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); -#endif - char buffer[40U]; if (slotNo == 1U) { ::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str()); diff --git a/HD44780.md b/HD44780.md new file mode 100644 index 0000000..37d31c6 --- /dev/null +++ b/HD44780.md @@ -0,0 +1,18 @@ +G0WFV's HD44780 todo list ... + +As I only have a 2x16 screen at the moment, development has been done based +on this size screen. + +Some additions I can translate to the other size screens without connecting +the physical screen (and I will do eventually once I get the code working +for the 2x16!) I am however getting some 4x16 screens to play with so +expect more reliable progress in this area! + +Here's a list of things I need to accomplish in the near future ... + +- Propagate non-duplex (DVMega) screen usage changes to other size screens + as appropriate. + +- Propagate custom characters for rf and ip sources to other screens + Currently only states "R" or "N" for RF or network traffic, which is nice + but there are now custom characters for this!