Initial support for I2C HD44780 displays based on new support withing Circle.

pull/223/head
Kevin 3 years ago
parent 52b8900293
commit 959cf38660
  1. 6
      src/config.cpp
  2. 2
      src/config.h
  3. 2
      src/minidexed.cpp
  4. 28
      src/userinterface.cpp
  5. 4
      src/userinterface.h

@ -79,6 +79,7 @@ void CConfig::Load (void)
m_nLCDPinData5 = m_Properties.GetNumber ("LCDPinData5", 23);
m_nLCDPinData6 = m_Properties.GetNumber ("LCDPinData6", 24);
m_nLCDPinData7 = m_Properties.GetNumber ("LCDPinData7", 25);
m_nLCDI2CAddress = m_Properties.GetNumber ("LCDI2CAddress", 0);
m_bEncoderEnabled = m_Properties.GetNumber ("EncoderEnabled", 0) != 0;
m_nEncoderPinClock = m_Properties.GetNumber ("EncoderPinClock", 10);
@ -174,6 +175,11 @@ unsigned CConfig::GetLCDPinData7 (void) const
return m_nLCDPinData7;
}
unsigned CConfig::GetLCDI2CAddress (void) const
{
return m_nLCDI2CAddress;
}
bool CConfig::GetEncoderEnabled (void) const
{
return m_bEncoderEnabled;

@ -86,6 +86,7 @@ public:
unsigned GetLCDPinData5 (void) const;
unsigned GetLCDPinData6 (void) const;
unsigned GetLCDPinData7 (void) const;
unsigned GetLCDI2CAddress (void) const;
// KY-040 Rotary Encoder
// GPIO pin numbers are chip numbers, not header positions
@ -120,6 +121,7 @@ private:
unsigned m_nLCDPinData5;
unsigned m_nLCDPinData6;
unsigned m_nLCDPinData7;
unsigned m_nLCDI2CAddress;
bool m_bEncoderEnabled;
unsigned m_nEncoderPinClock;

@ -37,7 +37,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
CMultiCoreSupport (CMemorySystem::Get ()),
#endif
m_pConfig (pConfig),
m_UI (this, pGPIOManager, pConfig),
m_UI (this, pGPIOManager, pI2CMaster, pConfig),
m_PerformanceConfig (pFileSystem),
m_PCKeyboard (this, pConfig),
m_SerialMIDI (this, pInterrupt, pConfig),

@ -27,9 +27,10 @@
LOGMODULE ("ui");
CUserInterface::CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CConfig *pConfig)
CUserInterface::CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CI2CMaster *pI2CMaster, CConfig *pConfig)
: m_pMiniDexed (pMiniDexed),
m_pGPIOManager (pGPIOManager),
m_pI2CMaster (pI2CMaster),
m_pConfig (pConfig),
m_pLCD (0),
m_pLCDBuffered (0),
@ -52,14 +53,23 @@ bool CUserInterface::Initialize (void)
if (m_pConfig->GetLCDEnabled ())
{
m_pLCD = new CHD44780Device (CConfig::LCDColumns, CConfig::LCDRows,
m_pConfig->GetLCDPinData4 (),
m_pConfig->GetLCDPinData5 (),
m_pConfig->GetLCDPinData6 (),
m_pConfig->GetLCDPinData7 (),
m_pConfig->GetLCDPinEnable (),
m_pConfig->GetLCDPinRegisterSelect (),
m_pConfig->GetLCDPinReadWrite ());
unsigned i2caddr = m_pConfig->GetLCDI2CAddress ();
if (i2caddr == 0)
{
m_pLCD = new CHD44780Device (CConfig::LCDColumns, CConfig::LCDRows,
m_pConfig->GetLCDPinData4 (),
m_pConfig->GetLCDPinData5 (),
m_pConfig->GetLCDPinData6 (),
m_pConfig->GetLCDPinData7 (),
m_pConfig->GetLCDPinEnable (),
m_pConfig->GetLCDPinRegisterSelect (),
m_pConfig->GetLCDPinReadWrite ());
}
else
{
m_pLCD = new CHD44780Device (m_pI2CMaster, i2caddr,
CConfig::LCDColumns, CConfig::LCDRows);
}
assert (m_pLCD);
if (!m_pLCD->Initialize ())

@ -26,13 +26,14 @@
#include <display/hd44780device.h>
#include <circle/gpiomanager.h>
#include <circle/writebuffer.h>
#include <circle/i2cmaster.h>
class CMiniDexed;
class CUserInterface
{
public:
CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CConfig *pConfig);
CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManager, CI2CMaster *pI2CMaster, CConfig *pConfig);
~CUserInterface (void);
bool Initialize (void);
@ -58,6 +59,7 @@ private:
private:
CMiniDexed *m_pMiniDexed;
CGPIOManager *m_pGPIOManager;
CI2CMaster *m_pI2CMaster;
CConfig *m_pConfig;
CHD44780Device *m_pLCD;

Loading…
Cancel
Save