2016-03-14 22:58:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "HD44780.h"
|
|
|
|
#include "Log.h"
|
|
|
|
|
|
|
|
#include <wiringPi.h>
|
|
|
|
#include <lcd.h>
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cassert>
|
2016-04-16 19:59:31 +00:00
|
|
|
#include <cstring>
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-04-14 20:52:03 +00:00
|
|
|
const char* LISTENING = "Listening ";
|
2016-03-15 07:12:52 +00:00
|
|
|
|
2016-04-21 10:03:55 +00:00
|
|
|
CHD44780::CHD44780(unsigned int rows, unsigned int cols, const std::string& callsign, unsigned int dmrid, const std::vector<unsigned int>& pins) :
|
2016-03-14 22:58:09 +00:00
|
|
|
m_rows(rows),
|
|
|
|
m_cols(cols),
|
2016-04-08 11:47:05 +00:00
|
|
|
m_callsign(callsign),
|
|
|
|
m_dmrid(dmrid),
|
2016-04-06 16:43:20 +00:00
|
|
|
m_rb(pins.at(0U)),
|
|
|
|
m_strb(pins.at(1U)),
|
|
|
|
m_d0(pins.at(2U)),
|
|
|
|
m_d1(pins.at(3U)),
|
|
|
|
m_d2(pins.at(4U)),
|
|
|
|
m_d3(pins.at(5U)),
|
2016-04-11 11:21:46 +00:00
|
|
|
m_fd(-1),
|
|
|
|
m_dmr(false)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-03-15 17:20:10 +00:00
|
|
|
assert(rows > 1U);
|
|
|
|
assert(cols > 15U);
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CHD44780::~CHD44780()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CHD44780::open()
|
|
|
|
{
|
2016-03-15 09:39:04 +00:00
|
|
|
::wiringPiSetup();
|
2016-03-15 09:38:15 +00:00
|
|
|
|
2016-04-17 11:11:05 +00:00
|
|
|
#ifdef ADAFRUIT_DISPLAY
|
|
|
|
adafruitLCDSetup();
|
|
|
|
#endif
|
|
|
|
|
2016-04-06 16:43:20 +00:00
|
|
|
m_fd = ::lcdInit(m_rows, m_cols, 4, m_rb, m_strb, m_d0, m_d1, m_d2, m_d3, 0, 0, 0, 0);
|
2016-03-14 22:58:09 +00:00
|
|
|
if (m_fd == -1) {
|
|
|
|
LogError("Unable to open the HD44780");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
::lcdDisplay(m_fd, 1);
|
|
|
|
::lcdCursor(m_fd, 0);
|
|
|
|
::lcdCursorBlink(m_fd, 0);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-17 11:11:05 +00:00
|
|
|
#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
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
void CHD44780::setIdle()
|
|
|
|
{
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
2016-04-21 10:03:55 +00:00
|
|
|
::lcdPrintf(m_fd, "%-6s / %u", m_callsign.c_str(), m_dmrid);
|
2016-03-14 22:58:09 +00:00
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
2016-04-08 11:47:05 +00:00
|
|
|
::lcdPuts(m_fd, "MMDVM Idle");
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-03-21 22:47:58 +00:00
|
|
|
void CHD44780::setError(const char* text)
|
|
|
|
{
|
|
|
|
assert(text != NULL);
|
|
|
|
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%s ERROR", text);
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2016-03-21 22:47:58 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
void CHD44780::setLockout()
|
|
|
|
{
|
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "MMDVM");
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPuts(m_fd, "Lockout");
|
|
|
|
|
2016-04-11 11:21:46 +00:00
|
|
|
m_dmr = false;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 19:45:49 +00:00
|
|
|
void CHD44780::writeDStar(const char* my1, const char* my2, const char* your, const char* type, const char* reflector)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-03-15 17:20:10 +00:00
|
|
|
assert(my1 != NULL);
|
|
|
|
assert(my2 != NULL);
|
|
|
|
assert(your != NULL);
|
2016-04-12 16:46:48 +00:00
|
|
|
assert(type != NULL);
|
2016-04-16 19:45:49 +00:00
|
|
|
assert(reflector != NULL);
|
2016-03-15 17:20:10 +00:00
|
|
|
|
2016-04-11 11:21:46 +00:00
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "D-Star");
|
|
|
|
|
2016-04-14 20:44:42 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
char buffer[16U];
|
|
|
|
::sprintf(buffer, "%s %.8s/%.4s", type, my1, my2);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
char buffer[16U];
|
|
|
|
::sprintf(buffer, "%s %.8s/%.4s", type, my1, my2);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
|
|
|
|
|
|
|
if (strcmp(reflector, " ") == 0) {
|
|
|
|
::sprintf(buffer, "%.8s", your);
|
|
|
|
} else {
|
2016-04-18 06:47:49 +00:00
|
|
|
::sprintf(buffer, "%.8s<%.8s", your, reflector);
|
2016-04-18 06:43:17 +00:00
|
|
|
}
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
2016-04-14 20:44:42 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
char buffer[20U];
|
2016-04-11 22:12:07 +00:00
|
|
|
::sprintf(buffer, "%s %.8s/%.4s >", type, my1, my2);
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
|
|
|
|
2016-04-16 19:45:49 +00:00
|
|
|
if (strcmp(reflector, " ") == 0) {
|
|
|
|
::sprintf(buffer, "%.8s", your);
|
|
|
|
} else {
|
|
|
|
::sprintf(buffer, "%.8s <- %.8s", your, reflector);
|
|
|
|
}
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
2016-04-14 20:44:42 +00:00
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
char buffer[40U];
|
2016-04-16 20:13:06 +00:00
|
|
|
if (strcmp(reflector, " ") == 0) {
|
|
|
|
::sprintf(buffer, "%s %.8s/%.4s > %.8s", type, my1, my2, your);
|
|
|
|
} else {
|
|
|
|
::sprintf(buffer, "%s %.8s/%.4s > %.8s via %.8s", type, my1, my2, your, reflector);
|
|
|
|
}
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
|
|
|
}
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearDStar()
|
|
|
|
{
|
2016-04-14 20:52:03 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
2016-04-18 06:43:17 +00:00
|
|
|
} 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, " ");
|
2016-04-14 20:52:03 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
2016-04-14 20:52:03 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
2016-04-21 12:01:53 +00:00
|
|
|
void CHD44780::writeDMR(unsigned int slotNo, const std::string& src, bool group, const std::string& dst, const char* type)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-04-11 11:21:46 +00:00
|
|
|
assert(type != NULL);
|
|
|
|
|
2016-04-12 16:46:48 +00:00
|
|
|
if (!m_dmr) {
|
|
|
|
::lcdClear(m_fd);
|
2016-03-14 22:58:09 +00:00
|
|
|
|
2016-04-14 21:21:52 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
if (slotNo == 1U) {
|
2016-04-15 11:40:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
2016-04-14 21:21:52 +00:00
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
|
|
|
|
}
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "DMR");
|
|
|
|
if (slotNo == 1U) {
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-04-14 21:21:52 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
2016-04-12 16:46:48 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "DMR");
|
2016-04-14 21:21:52 +00:00
|
|
|
if (slotNo == 1U) {
|
2016-04-15 11:40:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
2016-04-14 21:21:52 +00:00
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-04-14 21:57:20 +00:00
|
|
|
} else if (m_rows == 2U && m_cols == 40U) {
|
2016-04-14 21:21:52 +00:00
|
|
|
if (slotNo == 1U) {
|
2016-04-15 11:40:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
2016-04-14 21:21:52 +00:00
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-04-11 11:21:46 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-15 17:20:10 +00:00
|
|
|
|
2016-04-14 21:31:57 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
char buffer[16U];
|
|
|
|
if (slotNo == 1U) {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s > %s%s", src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-14 21:31:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
|
|
|
|
} else {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s > %s%s", src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-14 21:31:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
|
|
|
}
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
char buffer[16U];
|
|
|
|
if (slotNo == 1U) {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-18 06:43:17 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
|
|
|
|
} else {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-18 06:43:17 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
|
|
|
}
|
2016-04-14 21:31:57 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
char buffer[20U];
|
|
|
|
if (slotNo == 1U) {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-14 21:31:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
|
|
|
|
} else {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-14 21:31:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
|
|
|
}
|
2016-04-14 21:57:20 +00:00
|
|
|
} else if (m_rows == 2U && m_cols == 40U) {
|
2016-03-15 07:12:52 +00:00
|
|
|
char buffer[40U];
|
2016-04-14 21:31:57 +00:00
|
|
|
if (slotNo == 1U) {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-14 21:31:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, buffer);
|
|
|
|
} else {
|
2016-04-21 12:01:53 +00:00
|
|
|
::sprintf(buffer, "%s %s > %s%s", type, src.c_str(), group ? "TG" : "", dst.c_str());
|
2016-04-14 21:31:57 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, buffer);
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = true;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearDMR(unsigned int slotNo)
|
|
|
|
{
|
2016-04-14 21:09:00 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
if (slotNo == 1U) {
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
if (slotNo == 1U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-04-14 21:09:00 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
if (slotNo == 1U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-04-14 21:57:20 +00:00
|
|
|
} else if (m_rows == 2U && m_cols == 40U) {
|
2016-04-14 21:09:00 +00:00
|
|
|
if (slotNo == 1U) {
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPrintf(m_fd, "1 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
} else {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "2 %.*s", m_cols - 2U, LISTENING);
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-11 11:21:46 +00:00
|
|
|
void CHD44780::writeFusion(const char* source, const char* dest)
|
2016-03-14 22:58:09 +00:00
|
|
|
{
|
2016-04-11 11:21:46 +00:00
|
|
|
assert(source != NULL);
|
|
|
|
assert(dest != NULL);
|
|
|
|
|
2016-03-14 22:58:09 +00:00
|
|
|
::lcdClear(m_fd);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 0);
|
|
|
|
::lcdPuts(m_fd, "System Fusion");
|
|
|
|
|
2016-04-14 21:01:04 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
char buffer[16U];
|
|
|
|
::sprintf(buffer, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
2016-04-18 06:43:17 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 16U) {
|
|
|
|
char buffer[16U];
|
|
|
|
::sprintf(buffer, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
|
|
|
|
|
|
|
::sprintf(buffer, "%.10s", dest);
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
2016-04-14 21:01:04 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
|
|
|
char buffer[20U];
|
2016-03-15 11:42:36 +00:00
|
|
|
::sprintf(buffer, "%.10s >", source);
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
|
|
|
|
|
|
|
::sprintf(buffer, "%.10s", dest);
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
2016-04-14 21:01:04 +00:00
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
char buffer[40U];
|
|
|
|
::sprintf(buffer, "%.10s > %.10s", source, dest);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, buffer);
|
|
|
|
}
|
2016-04-11 11:21:46 +00:00
|
|
|
|
|
|
|
m_dmr = false;
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::clearFusion()
|
|
|
|
{
|
2016-04-14 20:57:23 +00:00
|
|
|
if (m_rows == 2U && m_cols == 16U) {
|
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
2016-04-18 06:43:17 +00:00
|
|
|
} 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, " ");
|
2016-04-14 20:57:23 +00:00
|
|
|
} else if (m_rows == 4U && m_cols == 20U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
|
|
|
|
::lcdPosition(m_fd, 0, 2);
|
2016-04-14 20:57:23 +00:00
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, " ");
|
|
|
|
} else if (m_rows == 2 && m_cols == 40U) {
|
2016-03-15 11:42:36 +00:00
|
|
|
::lcdPosition(m_fd, 0, 1);
|
|
|
|
::lcdPrintf(m_fd, "%.*s", m_cols, LISTENING);
|
|
|
|
}
|
2016-03-14 22:58:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CHD44780::close()
|
|
|
|
{
|
|
|
|
}
|