2016-03-14 22:58:09 +00:00
|
|
|
/*
|
2020-04-11 19:42:05 +00:00
|
|
|
* Copyright (C) 2016,2017,2018,2020 by Jonathan Naylor G4KLX & Tony Corbett G0WFV
|
2016-03-14 22:58:09 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(HD44780_H)
|
|
|
|
#define HD44780_H
|
|
|
|
|
|
|
|
#include "Display.h"
|
2016-05-23 17:43:44 +00:00
|
|
|
#include "Timer.h"
|
2016-03-14 22:58:09 +00:00
|
|
|
|
|
|
|
#include <string>
|
2016-04-06 16:43:20 +00:00
|
|
|
#include <vector>
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-04-17 11:11:05 +00:00
|
|
|
#include <mcp23017.h>
|
2016-06-27 17:48:13 +00:00
|
|
|
#include <pcf8574.h>
|
2016-04-17 11:11:05 +00:00
|
|
|
|
2016-05-03 16:59:21 +00:00
|
|
|
enum ADAFRUIT_COLOUR {
|
|
|
|
AC_OFF,
|
|
|
|
AC_WHITE,
|
|
|
|
AC_RED,
|
|
|
|
AC_GREEN,
|
|
|
|
AC_BLUE,
|
|
|
|
AC_PURPLE,
|
|
|
|
AC_YELLOW,
|
|
|
|
AC_ICE
|
|
|
|
};
|
|
|
|
|
2016-04-17 11:11:05 +00:00
|
|
|
// Defines for the Adafruit Pi LCD interface board
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-06-27 17:48:13 +00:00
|
|
|
#define AF_BASE 100
|
2016-06-28 17:21:04 +00:00
|
|
|
|
|
|
|
/* Not yet used defines (for possible future use)
|
|
|
|
*
|
|
|
|
* #define AF_SELECT (AF_BASE + 0)
|
|
|
|
* #define AF_RIGHT (AF_BASE + 1)
|
|
|
|
* #define AF_DOWN (AF_BASE + 2)
|
|
|
|
* #define AF_UP (AF_BASE + 3)
|
|
|
|
* #define AF_LEFT (AF_BASE + 4)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define AF_RED (AF_BASE + 6)
|
|
|
|
#define AF_GREEN (AF_BASE + 7)
|
|
|
|
#define AF_BLUE (AF_BASE + 8)
|
|
|
|
|
|
|
|
#define AF_D3 (AF_BASE + 9)
|
|
|
|
#define AF_D2 (AF_BASE + 10)
|
|
|
|
#define AF_D1 (AF_BASE + 11)
|
|
|
|
#define AF_D0 (AF_BASE + 12)
|
|
|
|
#define AF_E (AF_BASE + 13)
|
2016-06-27 17:48:13 +00:00
|
|
|
#define AF_RW (AF_BASE + 14)
|
2016-06-28 17:21:04 +00:00
|
|
|
#define AF_RS (AF_BASE + 15)
|
|
|
|
|
|
|
|
#define AF_ON LOW
|
|
|
|
#define AF_OFF HIGH
|
|
|
|
|
2016-06-30 19:10:30 +00:00
|
|
|
// #define MCP23017 0x20
|
2016-06-27 17:48:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Define for HD44780 connected via a PCF8574 GPIO extender
|
|
|
|
#ifdef PCF8574_DISPLAY
|
|
|
|
#define AF_BASE 100
|
2016-06-28 17:21:04 +00:00
|
|
|
|
|
|
|
#define AF_RS (AF_BASE + 0)
|
|
|
|
#define AF_RW (AF_BASE + 1)
|
|
|
|
#define AF_E (AF_BASE + 2)
|
|
|
|
#define AF_BL (AF_BASE + 3)
|
|
|
|
#define AF_D0 (AF_BASE + 4)
|
|
|
|
#define AF_D1 (AF_BASE + 5)
|
|
|
|
#define AF_D2 (AF_BASE + 6)
|
|
|
|
#define AF_D3 (AF_BASE + 7)
|
|
|
|
|
2016-06-30 19:10:30 +00:00
|
|
|
// #define PCF8574 0x27
|
2016-04-17 11:11:05 +00:00
|
|
|
#endif
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
class CHD44780 : public CDisplay
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-06-30 19:35:32 +00:00
|
|
|
CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector<unsigned int>& pins, unsigned int i2cAddress, bool pwm, unsigned int pwmPin, unsigned int pwmBright, unsigned int pwmDim, bool displayClock, bool utc, bool duplex);
|
2016-03-14 22:58:09 +00:00
|
|
|
virtual ~CHD44780();
|
|
|
|
|
|
|
|
virtual bool open();
|
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
virtual void close();
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
protected:
|
|
|
|
virtual void setIdleInt();
|
|
|
|
virtual void setErrorInt(const char* text);
|
|
|
|
virtual void setLockoutInt();
|
2018-08-15 16:17:42 +00:00
|
|
|
virtual void setQuitInt();
|
2020-04-11 19:42:05 +00:00
|
|
|
virtual void setFMInt();
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
virtual void writeDStarInt(const char* my1, const char* my2, const char* your, const char* type, const char* reflector);
|
2017-01-06 21:22:47 +00:00
|
|
|
virtual void writeDStarRSSIInt(unsigned char rssi);
|
2016-05-09 17:14:27 +00:00
|
|
|
virtual void clearDStarInt();
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-05-09 17:14:27 +00:00
|
|
|
virtual void writeDMRInt(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type);
|
2017-01-06 21:22:47 +00:00
|
|
|
virtual void writeDMRRSSIInt(unsigned int slotNo, unsigned char rssi);
|
2016-05-09 17:14:27 +00:00
|
|
|
virtual void clearDMRInt(unsigned int slotNo);
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2020-08-09 14:09:08 +00:00
|
|
|
virtual void writeFusionInt(const char* source, const char* dest, unsigned char dgid, const char* type, const char* origin);
|
2017-01-06 21:22:47 +00:00
|
|
|
virtual void writeFusionRSSIInt(unsigned char rssi);
|
2016-05-09 17:14:27 +00:00
|
|
|
virtual void clearFusionInt();
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-10-19 18:58:56 +00:00
|
|
|
virtual void writeP25Int(const char* source, bool group, unsigned int dest, const char* type);
|
2017-01-06 21:22:47 +00:00
|
|
|
virtual void writeP25RSSIInt(unsigned char rssi);
|
2016-10-19 18:58:56 +00:00
|
|
|
virtual void clearP25Int();
|
2016-09-12 17:12:32 +00:00
|
|
|
|
2018-01-17 19:04:00 +00:00
|
|
|
virtual void writeNXDNInt(const char* source, bool group, unsigned int dest, const char* type);
|
|
|
|
virtual void writeNXDNRSSIInt(unsigned char rssi);
|
|
|
|
virtual void clearNXDNInt();
|
|
|
|
|
2018-06-13 11:18:32 +00:00
|
|
|
virtual void writePOCSAGInt(uint32_t ric, const std::string& message);
|
2018-06-11 20:30:49 +00:00
|
|
|
virtual void clearPOCSAGInt();
|
|
|
|
|
2016-09-15 21:03:48 +00:00
|
|
|
virtual void writeCWInt();
|
|
|
|
virtual void clearCWInt();
|
|
|
|
|
2016-05-21 11:28:09 +00:00
|
|
|
virtual void clockInt(unsigned int ms);
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
private:
|
|
|
|
unsigned int m_rows;
|
|
|
|
unsigned int m_cols;
|
2016-04-21 10:03:55 +00:00
|
|
|
std::string m_callsign;
|
2016-04-08 11:47:05 +00:00
|
|
|
unsigned int m_dmrid;
|
2016-04-06 16:43:20 +00:00
|
|
|
unsigned int m_rb;
|
|
|
|
unsigned int m_strb;
|
|
|
|
unsigned int m_d0;
|
|
|
|
unsigned int m_d1;
|
|
|
|
unsigned int m_d2;
|
|
|
|
unsigned int m_d3;
|
2016-06-30 19:35:32 +00:00
|
|
|
unsigned int m_i2cAddress;
|
2016-05-03 16:59:21 +00:00
|
|
|
bool m_pwm;
|
|
|
|
unsigned int m_pwmPin;
|
|
|
|
unsigned int m_pwmBright;
|
|
|
|
unsigned int m_pwmDim;
|
2016-05-28 20:29:30 +00:00
|
|
|
bool m_displayClock;
|
|
|
|
bool m_utc;
|
2016-05-05 16:08:23 +00:00
|
|
|
bool m_duplex;
|
2016-03-14 22:58:09 +00:00
|
|
|
int m_fd;
|
2016-04-11 11:21:46 +00:00
|
|
|
bool m_dmr;
|
2016-05-28 20:29:30 +00:00
|
|
|
CTimer m_clockDisplayTimer;
|
2017-01-06 21:22:47 +00:00
|
|
|
unsigned int m_rssiCount1;
|
|
|
|
unsigned int m_rssiCount2;
|
2016-10-02 10:38:54 +00:00
|
|
|
/*
|
2016-06-17 21:28:39 +00:00
|
|
|
CTimer m_dmrScrollTimer1;
|
|
|
|
CTimer m_dmrScrollTimer2;
|
|
|
|
CTimer m_dstarScrollTimer;
|
2016-10-02 10:38:54 +00:00
|
|
|
*/
|
2016-04-17 11:11:05 +00:00
|
|
|
|
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
2016-05-03 16:59:21 +00:00
|
|
|
void adafruitLCDSetup();
|
|
|
|
void adafruitLCDColour(ADAFRUIT_COLOUR colour);
|
2016-04-17 11:11:05 +00:00
|
|
|
#endif
|
2016-06-27 17:48:13 +00:00
|
|
|
|
|
|
|
#ifdef PCF8574_DISPLAY
|
|
|
|
void pcf8574LCDSetup();
|
|
|
|
#endif
|
2016-03-14 22:58:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|