Merge pull request #17 from N4IRS/master

Add support for the Adafruit 16 x 2
This commit is contained in:
Jonathan Naylor 2016-04-17 16:27:12 +01:00
commit 63c6affa07
4 changed files with 63 additions and 1 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);

View file

@ -24,6 +24,16 @@
#include <string>
#include <vector>
#include <mcp23017.h>
// Defines for the Adafruit Pi LCD interface board
#ifdef ADAFRUIT_DISPLAY
#define AF_BASE 100
#define AF_RED (AF_BASE + 6)
#define AF_RW (AF_BASE + 14)
#define MCP23017 0x20
#endif
class CHD44780 : public IDisplay
{
public:
@ -61,6 +71,11 @@ private:
unsigned int m_d3;
int m_fd;
bool m_dmr;
#ifdef ADAFRUIT_DISPLAY
void adafruitLCDSetup();
#endif
};
#endif

View file

@ -85,7 +85,9 @@ Brightness=50
Rows=2
Columns=16
# rs, strb, d0, d1, d2, d3
Pins=11,10,0,1,2,3
# Pins=11,10,0,1,2,3
# Adafruit i2c HD44780
Pins=115,113,112,111,110,109
[Nextion]
Port=/dev/ttyAMA0

25
Makefile.Pi.Adafruit Normal file
View file

@ -0,0 +1,25 @@
# This makefile is for use with the Raspberry Pi when using an HD44780 compatible display. The wiringpi library is needed.
# Support for the Adafruit i2c 16 x 2 RGB LCD Pi Plate
CC = gcc
CXX = g++
CFLAGS = -g -O3 -Wall -std=c++0x -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev
LDFLAGS = -g -L/usr/local/lib
OBJECTS = \
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLookup.o DMRLC.o \
DMRShortLC.o DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o Log.o MMDVMHost.o \
Modem.o Nextion.o NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o Trellis.o UDPSocket.o Utils.o YSFControl.o \
YSFConvolution.o YSFFICH.o YSFParrot.o YSFPayload.o
all: MMDVMHost
MMDVMHost: $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
clean:
$(RM) MMDVMHost *.o *.d *.bak *~