From 116e257f904a8a590e723ef3406164436dc5a4b8 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 21 Oct 2021 20:53:00 +0100 Subject: [PATCH] Add M17 to the HD44780 display. --- HD44780.cpp | 298 +++++++++++++++++++++++++++++++++------------------- HD44780.h | 70 ++++++------ 2 files changed, 226 insertions(+), 142 deletions(-) diff --git a/HD44780.cpp b/HD44780.cpp index da2d577..a8122b8 100644 --- a/HD44780.cpp +++ b/HD44780.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX & Tony Corbett G0WFV + * Copyright (C) 2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX & Tony Corbett G0WFV * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,6 +41,7 @@ const unsigned int DMR_RSSI_COUNT = 4U; // 4 * 360ms = 1440ms const unsigned int YSF_RSSI_COUNT = 13U; // 13 * 100ms = 1300ms const unsigned int P25_RSSI_COUNT = 7U; // 7 * 180ms = 1260ms const unsigned int NXDN_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms +const unsigned int M17_RSSI_COUNT = 28U; // 28 * 40ms = 1120ms CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, unsigned int i2cAddress, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool displayClock, bool utc, bool duplex) : CDisplay(), @@ -211,12 +212,12 @@ void CHD44780::adafruitLCDSetup() ::pinMode(AF_RW, OUTPUT); ::digitalWrite(AF_RW, LOW); - m_rb = AF_RS; - m_strb = AF_E; - m_d0 = AF_D0; - m_d1 = AF_D1; - m_d2 = AF_D2; - m_d3 = AF_D3; + m_rb = AF_RS; + m_strb = AF_E; + m_d0 = AF_D0; + m_d1 = AF_D1; + m_d2 = AF_D2; + m_d3 = AF_D3; } void CHD44780::adafruitLCDColour(ADAFRUIT_COLOUR colour) @@ -275,12 +276,12 @@ void CHD44780::pcf8574LCDSetup() ::pcf8574Setup(AF_BASE, m_i2cAddress); // Turn on backlight - ::pinMode (AF_BL, OUTPUT); - ::digitalWrite (AF_BL, 1); + ::pinMode(AF_BL, OUTPUT); + ::digitalWrite(AF_BL, 1); // Set LCD to write mode. - ::pinMode (AF_RW, OUTPUT); - ::digitalWrite (AF_RW, 0); + ::pinMode(AF_RW, OUTPUT); + ::digitalWrite(AF_RW, 0); m_rb = AF_RS; m_strb = AF_E; @@ -297,7 +298,7 @@ void CHD44780::setIdleInt() ::lcdClear(m_fd); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_WHITE); + adafruitLCDColour(AC_WHITE); #endif if (m_pwm) { @@ -327,7 +328,7 @@ void CHD44780::setErrorInt(const char* text) assert(text != NULL); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); + adafruitLCDColour(AC_RED); #endif m_clockDisplayTimer.stop(); // Stop the clock display @@ -405,7 +406,7 @@ void CHD44780::setFMInt() ::lcdClear(m_fd); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_WHITE); + adafruitLCDColour(AC_WHITE); #endif if (m_pwm) { @@ -439,7 +440,7 @@ void CHD44780::writeDStarInt(const char* my1, const char* my2, const char* your, assert(reflector != NULL); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); + adafruitLCDColour(AC_RED); #endif m_clockDisplayTimer.stop(); // Stop the clock display @@ -463,11 +464,10 @@ void CHD44780::writeDStarInt(const char* my1, const char* my2, const char* your, ::lcdPrintf(m_fd, " %.8s/%.4s", my1, my2); ::lcdPosition(m_fd, m_cols - 1, (m_rows / 2) - 1); - if (strcmp(type, "R") == 0) { + if (strcmp(type, "R") == 0) ::lcdPutchar(m_fd, 2); - } else { + else ::lcdPutchar(m_fd, 3); - } ::sprintf(m_buffer1, "%.8s", your); @@ -493,19 +493,19 @@ void CHD44780::writeDStarInt(const char* my1, const char* my2, const char* your, ::lcdPrintf(m_fd, " %.*s", m_cols, m_buffer1); m_dmr = false; - m_rssiCount1 = 0U; + m_rssiCount1 = 0U; } void CHD44780::writeDStarRSSIInt(unsigned char rssi) { - if (m_rssiCount1 == 0U && m_rows > 2) { + if (m_rssiCount1 == 0U && m_rows > 2) { ::lcdPosition(m_fd, 0, 3); ::lcdPrintf(m_fd, "-%3udBm", rssi); - } + } - m_rssiCount1++; - if (m_rssiCount1 >= DSTAR_RSSI_COUNT) - m_rssiCount1 = 0U; + m_rssiCount1++; + if (m_rssiCount1 >= DSTAR_RSSI_COUNT) + m_rssiCount1 = 0U; } void CHD44780::clearDStarInt() @@ -599,21 +599,20 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPosition(m_fd, m_cols - 3U, (m_rows / 2) - 1); ::lcdPuts(m_fd, " "); - if (group) { + if (group) ::lcdPutchar(m_fd, 5); - } else { + else ::lcdPutchar(m_fd, 4); - } - if (strcmp(type, "R") == 0) { + if (strcmp(type, "R") == 0) ::lcdPutchar(m_fd, 2); - } else { + else ::lcdPutchar(m_fd, 3); - } } else { ::lcdPosition(m_fd, 0, (m_rows / 2)); ::lcdPuts(m_fd, "2 "); - if (m_cols > 16 ) + + if (m_cols > 16) ::sprintf(m_buffer2, "%s > %s%s%s", src.c_str(), group ? "TG" : "", dst.c_str(), DEADSPACE); else ::sprintf(m_buffer2, "%s>%s%s", src.c_str(), dst.c_str(), DEADSPACE); @@ -622,17 +621,15 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPosition(m_fd, m_cols - 3U, (m_rows / 2)); ::lcdPuts(m_fd, " "); - if (group) { + if (group) ::lcdPutchar(m_fd, 5); - } else { + else ::lcdPutchar(m_fd, 4); - } - if (strcmp(type, "R") == 0) { + if (strcmp(type, "R") == 0) ::lcdPutchar(m_fd, 2); - } else { + else ::lcdPutchar(m_fd, 3); - } } } else { if (m_rows > 2U) { @@ -647,11 +644,10 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "%.*s", m_cols - 4U, m_buffer2); ::lcdPosition(m_fd, m_cols - 1U, (m_rows / 2) - 1); - if (strcmp(type, "R") == 0) { + if (strcmp(type, "R") == 0) ::lcdPutchar(m_fd, 2); - } else { + else ::lcdPutchar(m_fd, 3); - } ::lcdPosition(m_fd, 0, (m_rows / 2)); ::lcdPutchar(m_fd, 1); @@ -659,38 +655,38 @@ void CHD44780::writeDMRInt(unsigned int slotNo, const std::string& src, bool gro ::lcdPrintf(m_fd, "%.*s", m_cols - 4U, m_buffer2); ::lcdPosition(m_fd, m_cols - 1U, (m_rows / 2)); - if (group) { + if (group) ::lcdPutchar(m_fd, 5); - } else { + else ::lcdPutchar(m_fd, 4); - } } + m_dmr = true; m_rssiCount1 = 0U; - m_rssiCount2 = 0U; + m_rssiCount2 = 0U; } void CHD44780::writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi) { if (m_rows > 2) { - if (slotNo == 1U) { - if (m_rssiCount1 == 0U) { + if (slotNo == 1U) { + if (m_rssiCount1 == 0U) { ::lcdPosition(m_fd, 0, 3); ::lcdPrintf(m_fd, "-%3udBm", rssi); - } + } - m_rssiCount1++; - if (m_rssiCount1 >= DMR_RSSI_COUNT) - m_rssiCount1 = 0U; - } else { - if (m_rssiCount2 == 0U) { + m_rssiCount1++; + if (m_rssiCount1 >= DMR_RSSI_COUNT) + m_rssiCount1 = 0U; + } else { + if (m_rssiCount2 == 0U) { ::lcdPosition(m_fd, (m_cols / 2), 3); ::lcdPrintf(m_fd, "-%3udBm", rssi); - } + } - m_rssiCount2++; - if (m_rssiCount2 >= DMR_RSSI_COUNT) - m_rssiCount2 = 0U; + m_rssiCount2++; + if (m_rssiCount2 >= DMR_RSSI_COUNT) + m_rssiCount2 = 0U; } } } @@ -722,7 +718,6 @@ void CHD44780::clearDMRInt(unsigned int slotNo) } } } else { - if (m_rows > 2U) { ::lcdPosition(m_fd, 0, (m_rows / 2) - 2); ::sprintf(m_buffer1, "%s", DEADSPACE); @@ -745,7 +740,7 @@ void CHD44780::writeFusionInt(const char* source, const char* dest, unsigned cha assert(origin != NULL); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); + adafruitLCDColour(AC_RED); #endif m_clockDisplayTimer.stop(); // Stop the clock display @@ -762,12 +757,10 @@ void CHD44780::writeFusionInt(const char* source, const char* dest, unsigned cha ::lcdPuts(m_fd, "System Fusion"); if (m_rows == 2U && m_cols == 16U) { - char m_buffer1[16U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 4U && m_cols == 16U) { - char m_buffer1[16U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); @@ -776,7 +769,6 @@ void CHD44780::writeFusionInt(const char* source, const char* dest, unsigned cha ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 4U && m_cols == 20U) { - char m_buffer1[20U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); @@ -785,7 +777,6 @@ void CHD44780::writeFusionInt(const char* source, const char* dest, unsigned cha ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 2 && m_cols == 40U) { - char m_buffer1[40U]; ::sprintf(m_buffer1, "%.10s > DG-ID %u", source, dgid); ::lcdPosition(m_fd, 0, 1); @@ -848,7 +839,7 @@ void CHD44780::writeP25Int(const char* source, bool group, unsigned int dest, co assert(type != NULL); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); + adafruitLCDColour(AC_RED); #endif m_clockDisplayTimer.stop(); // Stop the clock display @@ -865,12 +856,10 @@ void CHD44780::writeP25Int(const char* source, bool group, unsigned int dest, co ::lcdPuts(m_fd, "P25"); if (m_rows == 2U && m_cols == 16U) { - char m_buffer1[16U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 4U && m_cols == 16U) { - char m_buffer1[16U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); @@ -879,7 +868,6 @@ void CHD44780::writeP25Int(const char* source, bool group, unsigned int dest, co ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 4U && m_cols == 20U) { - char m_buffer1[20U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); @@ -888,7 +876,6 @@ void CHD44780::writeP25Int(const char* source, bool group, unsigned int dest, co ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 2 && m_cols == 40U) { - char m_buffer1[40U]; ::sprintf(m_buffer1, "%.10s > %s%u", source, group ? "TG" : "", dest); ::lcdPosition(m_fd, 0, 1); @@ -896,19 +883,19 @@ void CHD44780::writeP25Int(const char* source, bool group, unsigned int dest, co } m_dmr = false; - m_rssiCount1 = 0U; + m_rssiCount1 = 0U; } void CHD44780::writeP25RSSIInt(unsigned char rssi) -{ - if (m_rssiCount1 == 0U && m_rows > 2) { +{ + if (m_rssiCount1 == 0U && m_rows > 2) { ::lcdPosition(m_fd, 0, 3); ::lcdPrintf(m_fd, "-%3udBm", rssi); - } - - m_rssiCount1++; - if (m_rssiCount1 >= P25_RSSI_COUNT) - m_rssiCount1 = 0U; + } + + m_rssiCount1++; + if (m_rssiCount1 >= P25_RSSI_COUNT) + m_rssiCount1 = 0U; } void CHD44780::clearP25Int() @@ -952,7 +939,7 @@ void CHD44780::writeNXDNInt(const char* source, bool group, unsigned int dest, c assert(type != NULL); #ifdef ADAFRUIT_DISPLAY - adafruitLCDColour(AC_RED); + adafruitLCDColour(AC_RED); #endif m_clockDisplayTimer.stop(); // Stop the clock display @@ -969,12 +956,10 @@ void CHD44780::writeNXDNInt(const char* source, bool group, unsigned int dest, c ::lcdPuts(m_fd, "NXDN"); if (m_rows == 2U && m_cols == 16U) { - char m_buffer1[16U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 4U && m_cols == 16U) { - char m_buffer1[16U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); @@ -983,7 +968,6 @@ void CHD44780::writeNXDNInt(const char* source, bool group, unsigned int dest, c ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 4U && m_cols == 20U) { - char m_buffer1[20U]; ::sprintf(m_buffer1, "%.10s >", source); ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); @@ -992,27 +976,25 @@ void CHD44780::writeNXDNInt(const char* source, bool group, unsigned int dest, c ::lcdPosition(m_fd, 0, 2); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } else if (m_rows == 2 && m_cols == 40U) { - char m_buffer1[40U]; ::sprintf(m_buffer1, "%.10s > %s%u", source, group ? "TG" : "", dest); - ::lcdPosition(m_fd, 0, 1); ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); } m_dmr = false; - m_rssiCount1 = 0U; + m_rssiCount1 = 0U; } void CHD44780::writeNXDNRSSIInt(unsigned char rssi) -{ - if (m_rssiCount1 == 0U && m_rows > 2) { +{ + if (m_rssiCount1 == 0U && m_rows > 2) { ::lcdPosition(m_fd, 0, 3); ::lcdPrintf(m_fd, "-%3udBm", rssi); - } + } - m_rssiCount1++; - if (m_rssiCount1 >= NXDN_RSSI_COUNT) - m_rssiCount1 = 0U; + m_rssiCount1++; + if (m_rssiCount1 >= NXDN_RSSI_COUNT) + m_rssiCount1 = 0U; } void CHD44780::clearNXDNInt() @@ -1050,6 +1032,105 @@ void CHD44780::clearNXDNInt() } } +void CHD44780::writeM17Int(const char* source, const char* dest, const char* type) +{ + assert(source != NULL); + assert(dest != NULL); + assert(type != NULL); + +#ifdef ADAFRUIT_DISPLAY + adafruitLCDColour(AC_RED); +#endif + + m_clockDisplayTimer.stop(); // Stop the clock display + ::lcdClear(m_fd); + + if (m_pwm) { + if (m_pwmPin != 1U) + ::softPwmWrite(m_pwmPin, m_pwmBright); + else + ::pwmWrite(m_pwmPin, (m_pwmBright / 100) * 1024); + } + + ::lcdPosition(m_fd, 0, 0); + ::lcdPuts(m_fd, "M17"); + + ::sprintf(m_buffer1, "%.9s", source); + ::sprintf(m_buffer2, "%.9s", dest); + + if (m_rows == 2U && m_cols == 16U) { + ::lcdPosition(m_fd, 5, 0); + ::lcdPrintf(m_fd, "%.*s", m_cols - 5, m_buffer1); + ::lcdPosition(m_fd, 5, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols - 5, m_buffer2); + } else if (m_rows == 4U && m_cols == 16U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer2); + } else if (m_rows == 4U && m_cols == 20U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); + } else if (m_rows == 2 && m_cols == 40U) { + ::sprintf(m_buffer1, "%.9s > %.9s", source, dest); + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, m_buffer1); + } + + m_dmr = false; + m_rssiCount1 = 0U; +} + +void CHD44780::writeFusionM17Int(unsigned char rssi) +{ + if (m_rssiCount1 == 0U && m_rows > 2) { + ::lcdPosition(m_fd, 0, 3); + ::lcdPrintf(m_fd, "-%3udBm", rssi); + } + + m_rssiCount1++; + if (m_rssiCount1 >= M17_RSSI_COUNT) + m_rssiCount1 = 0U; +} + +void CHD44780::clearM17Int() +{ +#ifdef ADAFRUIT_DISPLAY + adafruitLCDColour(AC_PURPLE); +#endif + m_clockDisplayTimer.stop(); // Stop the clock display + + if (m_rows == 2U && m_cols == 16U) { + ::lcdPosition(m_fd, 5, 0); + ::lcdPrintf(m_fd, "%.*s", m_cols - 5, LISTENING); + ::lcdPosition(m_fd, 5, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols - 5, " "); + } else if (m_rows == 4U && m_cols == 16U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, " "); + + ::lcdPosition(m_fd, 0, 3); + ::lcdPrintf(m_fd, "%.*s", m_cols, " "); + } else if (m_rows == 4U && m_cols == 20U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + + ::lcdPosition(m_fd, 0, 2); + ::lcdPrintf(m_fd, "%.*s", m_cols, " "); + + ::lcdPosition(m_fd, 0, 3); + ::lcdPrintf(m_fd, "%.*s", m_cols, " "); + } else if (m_rows == 2 && m_cols == 40U) { + ::lcdPosition(m_fd, 0, 1); + ::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING); + } +} + void CHD44780::writePOCSAGInt(uint32_t ric, const std::string& message) { ::lcdPosition(m_fd, m_cols - 5, m_rows - 1); @@ -1080,31 +1161,30 @@ void CHD44780::clockInt(unsigned int ms) // Idle clock display if (m_displayClock && m_clockDisplayTimer.isRunning() && m_clockDisplayTimer.hasExpired()) { - time_t currentTime; - struct tm *Time; - time(¤tTime); + time_t currentTime; + struct tm *Time; + ::time(¤tTime); - if (m_utc) { - Time = gmtime(¤tTime); - } else { - Time = localtime(¤tTime); - } + if (m_utc) + Time = ::gmtime(¤tTime); + else + Time = ::localtime(¤tTime); - setlocale(LC_TIME,""); - strftime(m_buffer1, 128, "%X", Time); // Time - strftime(m_buffer2, 128, "%x", Time); // Date + setlocale(LC_TIME,""); + ::strftime(m_buffer1, 128, "%X", Time); // Time + ::strftime(m_buffer2, 128, "%x", Time); // Date - if (m_cols == 16U && m_rows == 2U) { - ::lcdPosition(m_fd, m_cols - 10, 1); - ::lcdPrintf(m_fd, "%s%.*s", strlen(m_buffer1) > 8 ? "" : " ", 10, m_buffer1); - } else { - ::lcdPosition(m_fd, (m_cols - (strlen(m_buffer1) == 8 ? 8 : 10)) / 2, m_rows == 2 ? 1 : 2); - ::lcdPrintf(m_fd, "%.*s", strlen(m_buffer1) == 8 ? 8 : 10, m_buffer1); - ::lcdPosition(m_fd, (m_cols - strlen(m_buffer2)) / 2, m_rows == 2 ? 0 : 1); - ::lcdPrintf(m_fd, "%s", m_buffer2); - } + if (m_cols == 16U && m_rows == 2U) { + ::lcdPosition(m_fd, m_cols - 10, 1); + ::lcdPrintf(m_fd, "%s%.*s", strlen(m_buffer1) > 8 ? "" : " ", 10, m_buffer1); + } else { + ::lcdPosition(m_fd, (m_cols - (strlen(m_buffer1) == 8 ? 8 : 10)) / 2, m_rows == 2 ? 1 : 2); + ::lcdPrintf(m_fd, "%.*s", strlen(m_buffer1) == 8 ? 8 : 10, m_buffer1); + ::lcdPosition(m_fd, (m_cols - strlen(m_buffer2)) / 2, m_rows == 2 ? 0 : 1); + ::lcdPrintf(m_fd, "%s", m_buffer2); + } - m_clockDisplayTimer.start(); + m_clockDisplayTimer.start(); } } diff --git a/HD44780.h b/HD44780.h index 89335a9..308f50d 100644 --- a/HD44780.h +++ b/HD44780.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX & Tony Corbett G0WFV + * Copyright (C) 2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX & Tony Corbett G0WFV * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -89,47 +89,51 @@ enum ADAFRUIT_COLOUR { class CHD44780 : public CDisplay { public: - CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, unsigned int i2cAddress, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool displayClock, bool utc, bool duplex); - virtual ~CHD44780(); + CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector& pins, unsigned int i2cAddress, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool displayClock, bool utc, bool duplex); + virtual ~CHD44780(); - virtual bool open(); + virtual bool open(); - virtual void close(); + virtual void close(); protected: - virtual void setIdleInt(); - virtual void setErrorInt(const char* text); - virtual void setLockoutInt(); - virtual void setQuitInt(); - virtual void setFMInt(); + virtual void setIdleInt(); + virtual void setErrorInt(const char* text); + virtual void setLockoutInt(); + virtual void setQuitInt(); + virtual void setFMInt(); - virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); - virtual void writeDStarRSSIInt(unsigned char rssi); - virtual void clearDStarInt(); + virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector); + virtual void writeDStarRSSIInt(unsigned char rssi); + virtual void clearDStarInt(); - virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type); - virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi); - virtual void clearDMRInt(unsigned int slotNo); + virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type); + virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi); + virtual void clearDMRInt(unsigned int slotNo); - virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin); - virtual void writeFusionRSSIInt(unsigned char rssi); - virtual void clearFusionInt(); + virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin); + virtual void writeFusionRSSIInt(unsigned char rssi); + virtual void clearFusionInt(); - virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type); - virtual void writeP25RSSIInt(unsigned char rssi); - virtual void clearP25Int(); + virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type); + virtual void writeP25RSSIInt(unsigned char rssi); + virtual void clearP25Int(); - virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type); - virtual void writeNXDNRSSIInt(unsigned char rssi); - virtual void clearNXDNInt(); + virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type); + virtual void writeNXDNRSSIInt(unsigned char rssi); + virtual void clearNXDNInt(); - virtual void writePOCSAGInt(uint32_t ric, const std::string& message); - virtual void clearPOCSAGInt(); + virtual void writeM17Int(const char* source, const char* dest, const char* type); + virtual void writeM17RSSIInt(unsigned char rssi); + virtual void clearM17Int(); - virtual void writeCWInt(); - virtual void clearCWInt(); + virtual void writePOCSAGInt(uint32_t ric, const std::string& message); + virtual void clearPOCSAGInt(); - virtual void clockInt(unsigned int ms); + virtual void writeCWInt(); + virtual void clearCWInt(); + + virtual void clockInt(unsigned int ms); private: unsigned int m_rows; @@ -162,12 +166,12 @@ private: */ #ifdef ADAFRUIT_DISPLAY - void adafruitLCDSetup(); - void adafruitLCDColour(ADAFRUIT_COLOUR colour); + void adafruitLCDSetup(); + void adafruitLCDColour(ADAFRUIT_COLOUR colour); #endif #ifdef PCF8574_DISPLAY - void pcf8574LCDSetup(); + void pcf8574LCDSetup(); #endif };