Add modem I2C/OLED support.

This commit is contained in:
Jonathan Naylor 2020-11-17 16:56:12 +00:00
parent ed4929f28a
commit 76ee3045bc
18 changed files with 243 additions and 45 deletions

View file

@ -301,6 +301,7 @@ m_nextionUTC(false),
m_nextionIdleBrightness(20U), m_nextionIdleBrightness(20U),
m_nextionScreenLayout(0U), m_nextionScreenLayout(0U),
m_nextionTempInFahrenheit(false), m_nextionTempInFahrenheit(false),
m_oledPort(),
m_oledType(3U), m_oledType(3U),
m_oledBrightness(0U), m_oledBrightness(0U),
m_oledInvert(false), m_oledInvert(false),
@ -1030,7 +1031,9 @@ bool CConf::read()
else if (::strcmp(key, "DisplayTempInFahrenheit") == 0) else if (::strcmp(key, "DisplayTempInFahrenheit") == 0)
m_nextionTempInFahrenheit = ::atoi(value) == 1; m_nextionTempInFahrenheit = ::atoi(value) == 1;
} else if (section == SECTION_OLED) { } else if (section == SECTION_OLED) {
if (::strcmp(key, "Type") == 0) if (::strcmp(key, "Port") == 0)
m_oledPort = value;
else if (::strcmp(key, "Type") == 0)
m_oledType = (unsigned char)::atoi(value); m_oledType = (unsigned char)::atoi(value);
else if (::strcmp(key, "Brightness") == 0) else if (::strcmp(key, "Brightness") == 0)
m_oledBrightness = (unsigned char)::atoi(value); m_oledBrightness = (unsigned char)::atoi(value);
@ -2243,6 +2246,11 @@ unsigned int CConf::getNextionScreenLayout() const
return m_nextionScreenLayout; return m_nextionScreenLayout;
} }
std::string CConf::getOLEDPort() const
{
return m_oledPort;
}
unsigned char CConf::getOLEDType() const unsigned char CConf::getOLEDType() const
{ {
return m_oledType; return m_oledType;

4
Conf.h
View file

@ -324,6 +324,7 @@ public:
bool getNextionTempInFahrenheit() const; bool getNextionTempInFahrenheit() const;
// The OLED section // The OLED section
std::string getOLEDPort() const;
unsigned char getOLEDType() const; unsigned char getOLEDType() const;
unsigned char getOLEDBrightness() const; unsigned char getOLEDBrightness() const;
bool getOLEDInvert() const; bool getOLEDInvert() const;
@ -613,7 +614,8 @@ private:
unsigned int m_nextionIdleBrightness; unsigned int m_nextionIdleBrightness;
unsigned int m_nextionScreenLayout; unsigned int m_nextionScreenLayout;
bool m_nextionTempInFahrenheit; bool m_nextionTempInFahrenheit;
std::string m_oledPort;
unsigned char m_oledType; unsigned char m_oledType;
unsigned char m_oledBrightness; unsigned char m_oledBrightness;
bool m_oledInvert; bool m_oledInvert;

View file

@ -25,6 +25,8 @@
#include "LCDproc.h" #include "LCDproc.h"
#include "Nextion.h" #include "Nextion.h"
#include "CASTInfo.h" #include "CASTInfo.h"
#include "I2CModem.h"
#include "I2CPort.h""
#include "Conf.h" #include "Conf.h"
#include "Modem.h" #include "Modem.h"
#include "OLED.h" #include "OLED.h"
@ -34,6 +36,10 @@
#include "HD44780.h" #include "HD44780.h"
#endif #endif
#if defined(OLED)
#include "I2CPi.h""
#endif
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>
#include <cstring> #include <cstring>
@ -666,6 +672,7 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, IModem* modem)
} }
#endif #endif
} else if (type == "OLED") { } else if (type == "OLED") {
std::string port = conf.getOLEDPort();
unsigned char type = conf.getOLEDType(); unsigned char type = conf.getOLEDType();
unsigned char brightness = conf.getOLEDBrightness(); unsigned char brightness = conf.getOLEDBrightness();
bool invert = conf.getOLEDInvert(); bool invert = conf.getOLEDInvert();
@ -673,7 +680,15 @@ CDisplay* CDisplay::createDisplay(const CConf& conf, IModem* modem)
bool rotate = conf.getOLEDRotate(); bool rotate = conf.getOLEDRotate();
bool logosaver = conf.getOLEDLogoScreensaver(); bool logosaver = conf.getOLEDLogoScreensaver();
display = new COLED(type, brightness, invert, scroll, rotate, logosaver, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2()); if (port == "modem") {
II2CPort* i2c = new CI2CModem(modem);
display = new COLED(i2c, type, brightness, invert, scroll, rotate, logosaver, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2());
#if defined(OLED)
} else {
II2CPort* i2c = new CI2CPi;
display = new COLED(i2c, type, brightness, invert, scroll, rotate, logosaver, conf.getDMRNetworkSlot1(), conf.getDMRNetworkSlot2());
#endif
}
} else if (type == "CAST") { } else if (type == "CAST") {
display = new CCASTInfo(modem); display = new CCASTInfo(modem);
} else { } else {

45
I2CModem.cpp Normal file
View file

@ -0,0 +1,45 @@
/*
* Copyright (C) 2020 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 "I2CModem.h"
#include <cassert>
CI2CModem::CI2CModem(IModem* modem) :
m_modem(modem)
{
assert(modem != NULL);
}
CI2CModem::~CI2CModem()
{
}
bool CI2CModem::open()
{
return true;
}
bool CI2CModem::write(const uint8_t* data, uint16_t length)
{
return m_modem->writeI2C(data, length);
}
void CI2CModem::close()
{
}

40
I2CModem.h Normal file
View file

@ -0,0 +1,40 @@
/*
* Copyright (C) 2020 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.
*/
#ifndef I2CMODEM_H
#define I2CMODEM_H
#include "I2CPort.h"
#include "Modem.h"
class CI2CModem : public II2CPort {
public:
CI2CModem(IModem* modem);
virtual ~CI2CModem();
virtual bool open();
virtual bool write(const uint8_t* data, uint16_t length);
virtual void close();
private:
IModem* m_modem;
};
#endif

23
I2CPort.cpp Normal file
View file

@ -0,0 +1,23 @@
/*
* Copyright (C) 2020 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 "I2CPort.h"
II2CPort::~II2CPort()
{
}

35
I2CPort.h Normal file
View file

@ -0,0 +1,35 @@
/*
* Copyright (C) 2020 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.
*/
#ifndef I2CPORT_H
#define I2CPORT_H
#include <cstdint>
class II2CPort {
public:
virtual ~II2CPort() = 0;
virtual bool open() = 0;
virtual bool write(const uint8_t* data, uint16_t length) = 0;
virtual void close() = 0;
};
#endif

View file

@ -303,6 +303,8 @@ ScreenLayout=2
IdleBrightness=20 IdleBrightness=20
[OLED] [OLED]
# Port=Pi
Port=Modem
Type=3 Type=3
Brightness=0 Brightness=0
Invert=0 Invert=0

View file

@ -190,6 +190,8 @@
<ClInclude Include="Golay24128.h" /> <ClInclude Include="Golay24128.h" />
<ClInclude Include="Hamming.h" /> <ClInclude Include="Hamming.h" />
<ClInclude Include="DMRLookup.h" /> <ClInclude Include="DMRLookup.h" />
<ClInclude Include="I2CModem.h" />
<ClInclude Include="I2CPort.h" />
<ClInclude Include="IIRDirectForm1Filter.h" /> <ClInclude Include="IIRDirectForm1Filter.h" />
<ClInclude Include="LCDproc.h" /> <ClInclude Include="LCDproc.h" />
<ClInclude Include="Log.h" /> <ClInclude Include="Log.h" />
@ -297,6 +299,8 @@
<ClCompile Include="Golay2087.cpp" /> <ClCompile Include="Golay2087.cpp" />
<ClCompile Include="Golay24128.cpp" /> <ClCompile Include="Golay24128.cpp" />
<ClCompile Include="Hamming.cpp" /> <ClCompile Include="Hamming.cpp" />
<ClCompile Include="I2CModem.cpp" />
<ClCompile Include="I2CPort.cpp" />
<ClCompile Include="IIRDirectForm1Filter.cpp" /> <ClCompile Include="IIRDirectForm1Filter.cpp" />
<ClCompile Include="LCDproc.cpp" /> <ClCompile Include="LCDproc.cpp" />
<ClCompile Include="Log.cpp" /> <ClCompile Include="Log.cpp" />

View file

@ -338,6 +338,12 @@
<ClInclude Include="OLED.h"> <ClInclude Include="OLED.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="I2CPort.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="I2CModem.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="BPTC19696.cpp"> <ClCompile Include="BPTC19696.cpp">
@ -634,5 +640,11 @@
<ClCompile Include="OLED.cpp"> <ClCompile Include="OLED.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="I2CPort.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="I2CModem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -10,12 +10,12 @@ OBJECTS = \
AMBEFEC.o BCH.o AX25Control.o AX25Network.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \ AMBEFEC.o BCH.o AX25Control.o AX25Network.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \
DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \ DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \
DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o I2CController.o \ DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o I2CController.o \
IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o Modem.o ModemSerialPort.o \ I2CPort.o I2CModem.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \ Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \ NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o \
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \ P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \ RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o \
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand all: MMDVMHost RemoteCommand

View file

@ -10,12 +10,12 @@ OBJECTS = \
AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \
DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \ DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \
DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o I2CController.o \ DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o I2CController.o \
IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o Modem.o ModemSerialPort.o \ I2CPort.o I2CModem.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \ Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \ NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o \
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \ P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \ RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o \
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand all: MMDVMHost RemoteCommand

View file

@ -11,12 +11,12 @@ OBJECTS = \
AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \
DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \ DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \
DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o \ DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o \
IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o Modem.o ModemSerialPort.o \ I2CPort.o I2CModem.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \ Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \ NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o \
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \ P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \ RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o \
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand all: MMDVMHost RemoteCommand

View file

@ -10,12 +10,12 @@ OBJECTS = \
AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \
DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \ DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \
DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o \ DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o \
IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o Modem.o ModemSerialPort.o \ I2CPort.o I2CModem.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \ Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \ NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o \
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \ P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \ RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o \
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand all: MMDVMHost RemoteCommand

View file

@ -14,12 +14,12 @@ OBJECTS = \
AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \
DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \ DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \
DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o I2CController.o \ DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o I2CController.o \
IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o Modem.o ModemSerialPort.o \ I2CPi.o I2CPort.o I2CModem.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o \
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \ MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o OLED.o P25Audio.o P25Control.o P25Data.o \ NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o OLED.o P25Audio.o \
P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o \ P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o \
RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o \ RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o \
UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o UDPSocket.o UserDB.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand all: MMDVMHost RemoteCommand

View file

@ -11,12 +11,12 @@ OBJECTS = \
AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \ AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o \
DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \ DMREmbeddedData.o DMRFullLC.o DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o \
DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o \ DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o FMControl.o FMNetwork.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o \
IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o Modem.o ModemSerialPort.o \ I2CPort.o I2CModem.o IIRDirectForm1Filter.o LCDproc.o Log.o M17Control.o M17Convolution.o M17CRC.o M17LICH.o M17Network.o M17Utils.o MMDVMHost.o \
Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \ Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \ NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o \
P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o \ P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o P25Utils.o PseudoTTYController.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o \
RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o UserDBentry.o \ RS241213.o RSSIInterpolator.o SerialController.o SerialModem.o SerialPort.o StopWatch.o Sync.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UserDB.o \
Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o UserDBentry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand all: MMDVMHost RemoteCommand

View file

@ -20,6 +20,8 @@
#include "Log.h" #include "Log.h"
#include "NetworkInfo.h" #include "NetworkInfo.h"
#include <cassert>
const uint16_t BLACK = 0U; const uint16_t BLACK = 0U;
const uint16_t WHITE = 1U; const uint16_t WHITE = 1U;
@ -471,7 +473,8 @@ const unsigned char logo_POCSAG_bmp [] = {
0xFFU, 0xFFU, 0xFFU, 0xE6U, 0x7FU, 0xFEU, 0x07U, 0xFFU, 0xF6U, 0xFFU, 0xDFU, 0xF6U, 0x00U, 0xFBU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xE6U, 0x7FU, 0xFEU, 0x07U, 0xFFU, 0xF6U, 0xFFU, 0xDFU, 0xF6U, 0x00U, 0xFBU, 0xFFU, 0xFFU,
0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU}; 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU};
COLED::COLED(unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled) : COLED::COLED(II2CPort* port, unsigned char displayType, unsigned char displayBrightness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled) :
m_port(port),
m_mode(MODE_IDLE), m_mode(MODE_IDLE),
m_displayType(displayType), m_displayType(displayType),
m_displayBrightness(displayBrightness), m_displayBrightness(displayBrightness),
@ -493,6 +496,7 @@ m_textSize(1U),
m_textColor(0xFFFFU), m_textColor(0xFFFFU),
m_textBGColor(0xFFFFU) m_textBGColor(0xFFFFU)
{ {
assert(port != NULL);
} }
COLED::~COLED() COLED::~COLED()
@ -505,6 +509,10 @@ bool COLED::open()
if (!m_display.init(OLED_I2C_RESET, m_displayType)) if (!m_display.init(OLED_I2C_RESET, m_displayType))
return false; return false;
bool ret = m_port->open();
if (!ret)
return false;
m_display.begin(); m_display.begin();
m_oledBuffer = new uint8_t[m_width * m_height]; m_oledBuffer = new uint8_t[m_width * m_height];
@ -1073,6 +1081,8 @@ void COLED::close()
m_display.close(); m_display.close();
m_port->close();
delete[] m_oledBuffer; delete[] m_oledBuffer;
} }
@ -1304,7 +1314,7 @@ void COLED::display(void)
for (uint8_t x = 1U; x <= 16U; x++) for (uint8_t x = 1U; x <= 16U; x++)
buff[x] = *p++; buff[x] = *p++;
fastI2Cwrite(buff, 17U); m_port->write(buff, 17U);
} }
} }
} else { } else {
@ -1314,21 +1324,21 @@ void COLED::display(void)
for (uint8_t x = 1U; x <= 16U; x++) for (uint8_t x = 1U; x <= 16U; x++)
buff[x] = *p++; buff[x] = *p++;
fastI2Cwrite(buff, 17U); m_port->write(buff, 17U);
} }
} }
} }
void COLED::sendCommand(uint8_t c) void COLED::sendCommand(uint8_t c)
{ {
char buff[2U]; uint8_t buff[2U];
// Clear D/C to switch to command mode // Clear D/C to switch to command mode
buff[0] = SSD_Command_Mode; buff[0] = SSD_Command_Mode;
buff[1] = c; buff[1] = c;
// Write Data on I2C // Write Data on I2C
fastI2Cwrite(buff, 2U); m_port->write(buff, 2U);
} }
size_t COLED::write(uint8_t c) size_t COLED::write(uint8_t c)

4
OLED.h
View file

@ -22,13 +22,14 @@
#include "Display.h" #include "Display.h"
#include "Defines.h" #include "Defines.h"
#include "UserDBentry.h" #include "UserDBentry.h"
#include "I2CPort.h"
#include <string> #include <string>
class COLED : public CDisplay class COLED : public CDisplay
{ {
public: public:
COLED(unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled); COLED(II2CPort* port, unsigned char displayType, unsigned char displayBrighness, bool displayInvert, bool displayScroll, bool displayRotate, bool displayLogoScreensaver, bool slot1Enabled, bool slot2Enabled);
virtual ~COLED(); virtual ~COLED();
virtual bool open(); virtual bool open();
@ -69,6 +70,7 @@ public:
virtual void close(); virtual void close();
private: private:
II2CPort* m_port;
unsigned char m_mode; unsigned char m_mode;
unsigned char m_displayType; unsigned char m_displayType;
unsigned char m_displayBrightness; unsigned char m_displayBrightness;