Implements rotation and mirroring options for SSD1306 displays (only). (#420)

Requires an update to circle (PR submitted to develop branch)

Co-authored-by: diyelectromusic <68612569+diyelectromusic@users.noreply.github.com>
pull/423/head
probonopd 2 years ago committed by GitHub
parent ab8deb09c6
commit 29193db631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/config.cpp
  2. 4
      src/config.h
  3. 2
      src/minidexed.ini
  4. 4
      src/userinterface.cpp

@ -84,6 +84,8 @@ void CConfig::Load (void)
m_nSSD1306LCDI2CAddress = m_Properties.GetNumber ("SSD1306LCDI2CAddress", 0);
m_nSSD1306LCDWidth = m_Properties.GetNumber ("SSD1306LCDWidth", 128);
m_nSSD1306LCDHeight = m_Properties.GetNumber ("SSD1306LCDHeight", 32);
m_bSSD1306LCDRotate = m_Properties.GetNumber ("SSD1306LCDRotate", 0) != 0;
m_bSSD1306LCDMirror = m_Properties.GetNumber ("SSD1306LCDMirror", 0) != 0;
m_nLCDColumns = m_Properties.GetNumber ("LCDColumns", 16);
m_nLCDRows = m_Properties.GetNumber ("LCDRows", 2);
@ -231,6 +233,16 @@ unsigned CConfig::GetSSD1306LCDHeight (void) const
return m_nSSD1306LCDHeight;
}
bool CConfig::GetSSD1306LCDRotate (void) const
{
return m_bSSD1306LCDRotate;
}
bool CConfig::GetSSD1306LCDMirror (void) const
{
return m_bSSD1306LCDMirror;
}
unsigned CConfig::GetLCDColumns (void) const
{
return m_nLCDColumns;

@ -93,6 +93,8 @@ public:
unsigned GetSSD1306LCDI2CAddress (void) const;
unsigned GetSSD1306LCDWidth (void) const;
unsigned GetSSD1306LCDHeight (void) const;
bool GetSSD1306LCDRotate (void) const;
bool GetSSD1306LCDMirror (void) const;
unsigned GetLCDColumns (void) const;
unsigned GetLCDRows (void) const;
@ -167,6 +169,8 @@ private:
unsigned m_nSSD1306LCDI2CAddress;
unsigned m_nSSD1306LCDWidth;
unsigned m_nSSD1306LCDHeight;
bool m_bSSD1306LCDRotate;
bool m_bSSD1306LCDMirror;
unsigned m_nLCDColumns;
unsigned m_nLCDRows;

@ -34,6 +34,8 @@ LCDI2CAddress=0x00
SSD1306LCDI2CAddress=0x0
SSD1306LCDWidth=128
SSD1306LCDHeight=32
SSD1306LCDRotate=0
SSD1306LCDMirror=0
# Default is 16x2 display (e.g. HD44780)
LCDColumns=16

@ -58,7 +58,9 @@ bool CUserInterface::Initialize (void)
unsigned i2caddr = m_pConfig->GetLCDI2CAddress ();
unsigned ssd1306addr = m_pConfig->GetSSD1306LCDI2CAddress ();
if (ssd1306addr != 0) {
m_pSSD1306 = new CSSD1306Device (m_pConfig->GetSSD1306LCDWidth (), m_pConfig->GetSSD1306LCDHeight (), m_pI2CMaster, ssd1306addr);
m_pSSD1306 = new CSSD1306Device (m_pConfig->GetSSD1306LCDWidth (), m_pConfig->GetSSD1306LCDHeight (),
m_pI2CMaster, ssd1306addr,
m_pConfig->GetSSD1306LCDRotate (), m_pConfig->GetSSD1306LCDMirror ());
LOGDBG ("LCD: SSD1306");
if (!m_pSSD1306->Initialize ())
{

Loading…
Cancel
Save