mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Further changes to HD44780 support on the Pi.
This commit is contained in:
@@ -427,7 +427,7 @@ bool CDMRIPSC::writeAuthorisation()
|
|||||||
|
|
||||||
bool CDMRIPSC::writeConfig()
|
bool CDMRIPSC::writeConfig()
|
||||||
{
|
{
|
||||||
char* software = "MMDVM";
|
const char* software = "MMDVM";
|
||||||
char slots = '0';
|
char slots = '0';
|
||||||
if (m_duplex) {
|
if (m_duplex) {
|
||||||
if (m_slot1 && m_slot2)
|
if (m_slot1 && m_slot2)
|
||||||
|
|||||||
72
HD44780.cpp
72
HD44780.cpp
@@ -16,8 +16,6 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(RASPBERRY_PI)
|
|
||||||
|
|
||||||
#include "HD44780.h"
|
#include "HD44780.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
@@ -27,6 +25,8 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
const char* LISTENING = "Listening ";
|
||||||
|
|
||||||
CHD44780::CHD44780(unsigned int rows, unsigned int cols) :
|
CHD44780::CHD44780(unsigned int rows, unsigned int cols) :
|
||||||
m_rows(rows),
|
m_rows(rows),
|
||||||
m_cols(cols),
|
m_cols(cols),
|
||||||
@@ -83,52 +83,75 @@ void CHD44780::setDStar()
|
|||||||
::lcdPuts(m_fd, "D-Star");
|
::lcdPuts(m_fd, "D-Star");
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPuts(m_fd, "Listening");
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::writeDStar(const char* my1, const char* my2, const char* your)
|
void CHD44780::writeDStar(const char* my1, const char* my2, const char* your)
|
||||||
{
|
{
|
||||||
|
char buffer[40U];
|
||||||
|
::sprintf(buffer, "%s/%s > %s", my1, my2, your);
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "%s/%s > %s", my1, my2, your);
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::clearDStar()
|
void CHD44780::clearDStar()
|
||||||
{
|
{
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPuts(m_fd, "Listening ");
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::setDMR()
|
void CHD44780::setDMR()
|
||||||
{
|
{
|
||||||
::lcdClear(m_fd);
|
::lcdClear(m_fd);
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 0);
|
int row = 0;
|
||||||
::lcdPuts(m_fd, "1 DMR Listening");
|
if (m_rows > 2U) {
|
||||||
|
::lcdPosition(m_fd, 0, row);
|
||||||
|
::lcdPuts(m_fd, "DMR");
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, row);
|
||||||
::lcdPuts(m_fd, "2 DMR Listening");
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
||||||
|
|
||||||
|
row++;
|
||||||
|
|
||||||
|
::lcdPosition(m_fd, 0, row);
|
||||||
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type)
|
void CHD44780::writeDMR(unsigned int slotNo, unsigned int srcId, bool group, unsigned int dstId, const char* type)
|
||||||
{
|
{
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
::lcdPosition(m_fd, 0, 0);
|
char buffer[40U];
|
||||||
::lcdPrintf(m_fd, "1 %s %u > %s%u", type, srcId, group ? "TG" : "", dstId);
|
if (m_cols > 16U)
|
||||||
}
|
::sprintf(buffer, "%s %u > %s%u", type, srcId, group ? "TG" : "", dstId);
|
||||||
else {
|
else
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::sprintf(buffer, "%u > %s%u", srcId, group ? "TG" : "", dstId);
|
||||||
::lcdPrintf(m_fd, "2 %s %u > %s%u", type, srcId, group ? "TG" : "", dstId);
|
|
||||||
|
::lcdPosition(m_fd, 0, m_rows > 2U ? 1 : 0);
|
||||||
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
|
||||||
|
} else {
|
||||||
|
char buffer[40U];
|
||||||
|
if (m_cols > 16U)
|
||||||
|
::sprintf(buffer, "%s %u > %s%u", type, srcId, group ? "TG" : "", dstId);
|
||||||
|
else
|
||||||
|
::sprintf(buffer, "%u > %s%u", srcId, group ? "TG" : "", dstId);
|
||||||
|
|
||||||
|
::lcdPosition(m_fd, 0, m_rows > 2U ? 2 : 1);
|
||||||
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::clearDMR(unsigned int slotNo)
|
void CHD44780::clearDMR(unsigned int slotNo)
|
||||||
{
|
{
|
||||||
if (slotNo == 1U) {
|
if (slotNo == 1U) {
|
||||||
::lcdPosition(m_fd, 0, 0);
|
::lcdPosition(m_fd, 0, m_rows > 2U ? 1 : 0);
|
||||||
::lcdPuts(m_fd, "1 Listening ");
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
||||||
} else {
|
} else {
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, m_rows > 2U ? 2 : 1);
|
||||||
::lcdPuts(m_fd, "2 Listening ");
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,23 +163,24 @@ void CHD44780::setFusion()
|
|||||||
::lcdPuts(m_fd, "System Fusion");
|
::lcdPuts(m_fd, "System Fusion");
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPuts(m_fd, "Listening");
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::writeFusion(const char* source, const char* dest)
|
void CHD44780::writeFusion(const char* source, const char* dest)
|
||||||
{
|
{
|
||||||
|
char buffer[40U];
|
||||||
|
::sprintf(buffer, "%s > %s", source, dest);
|
||||||
|
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPrintf(m_fd, "%s > %s", source, dest);
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::clearFusion()
|
void CHD44780::clearFusion()
|
||||||
{
|
{
|
||||||
::lcdPosition(m_fd, 0, 1);
|
::lcdPosition(m_fd, 0, 1);
|
||||||
::lcdPuts(m_fd, "Listening ");
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHD44780::close()
|
void CHD44780::close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
#if !defined(HD44780_H)
|
#if !defined(HD44780_H)
|
||||||
#define HD44780_H
|
#define HD44780_H
|
||||||
|
|
||||||
#if defined(RASPBERRY_PI)
|
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -58,5 +56,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
8
Makefile
8
Makefile
@@ -1,3 +1,5 @@
|
|||||||
|
# This makefile is for all platforms, but doesn't include support for the HD44780 display on the Raspberry Pi.
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x
|
CFLAGS = -g -O3 -Wall -std=c++0x
|
||||||
@@ -6,9 +8,9 @@ LDFLAGS = -g
|
|||||||
|
|
||||||
OBJECTS = \
|
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 DMRLC.o DMRShortLC.o \
|
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 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 \
|
DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o Log.o MMDVMHost.o Modem.o NullDisplay.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 \
|
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 \
|
||||||
YSFFICH.o YSFParrot.o YSFPayload.o
|
YSFParrot.o YSFPayload.o
|
||||||
|
|
||||||
all: MMDVMHost
|
all: MMDVMHost
|
||||||
|
|
||||||
|
|||||||
25
Makefile.Pi
Normal file
25
Makefile.Pi
Normal 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.
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CXX = g++
|
||||||
|
CFLAGS = -g -O3 -Wall -std=c++0x -DRASPBERRY_PI -I/usr/local/include
|
||||||
|
LIBS = -lwiringPi
|
||||||
|
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 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 \
|
||||||
|
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 *~
|
||||||
|
|
||||||
Reference in New Issue
Block a user