Initial support for I2C HD44780 displays (#225)

Initial support for I2C HD44780 displays, closes #169
Thanks @diyelectromusic
pull/227/merge
probonopd 2 years ago committed by GitHub
parent 52b8900293
commit e026ea1948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/build.yml
  2. 6
      src/config.cpp
  3. 2
      src/config.h
  4. 2
      src/minidexed.cpp
  5. 1
      src/minidexed.ini
  6. 28
      src/userinterface.cpp
  7. 4
      src/userinterface.h

@ -20,11 +20,11 @@ jobs:
run: |
set -ex
git submodule update --init --recursive
- name: Use Circle develop branch for WM8960 support until it is merged upstream
- name: Use Circle develop branch for WM8960 and i2c display support until it is merged upstream
run: |
set -ex
cd circle-stdlib/libs/circle
git checkout ae22928 # develop
git checkout c9a4815 # develop
cd -
- name: Install toolchains
run: |

@ -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),

@ -25,6 +25,7 @@ LCDPinData4=22
LCDPinData5=23
LCDPinData6=24
LCDPinData7=25
LCDI2CAddress=0x00
# KY-040 Rotary Encoder
EncoderEnabled=1

@ -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