Add support for SSD1305 OLEDs via temporary hack

This commit is contained in:
Dale Whinham committed 2022-06-13 22:40:02 +01:00
1 parent 5ed828a7b0
commit 07a6abe75e
3 files changed
+15 -4

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Support for SSD1305 displays via a temporary hack (assume SSD1305 when `width` is set to 132). Further details in the wiki.
### Changed
- Update to circle-stdlib v15.13/Circle Step 44.5.
+4 -1
View File
@@ -373,7 +373,10 @@ type = none
# Note that not all dimension settings are valid; see documentation for valid
# configurations for each LCD driver.
#
# Values: 20-128 (128*)
# If set to 132, assume this display is an SSD1305 (see wiki).
# Note: the correct settings for the SSD1305 may change in future.
#
# Values: 20-132 (128*)
width = 128
# Set the height of the LCD.
+7 -3
View File
@@ -165,12 +165,16 @@ bool CSSD1306::Initialize()
{
assert(m_pI2CMaster != nullptr);
// Validate dimensions - only 128x32 and 128x64 supported for now
if (!(m_nHeight == 32 || m_nHeight == 64) || m_nWidth != 128)
// Validate dimensions - only 128x32, 128x64, and 132x{32, 64} (SSD1305) supported for now
if (!(m_nHeight == 32 || m_nHeight == 64) || !(m_nWidth == 128 || m_nWidth == 132))
return false;
// HACK: Assume SSD1305 if width is 132 (visible width is usually 128 on these modules)
// TODO: Some kind of abstraction between visible size and pixel memory size?
const bool bIsSSD1305 = m_nWidth == 132;
const u8 nMultiplexRatio = m_nHeight - 1;
const u8 nCOMPins = m_nHeight == 32 ? 0x02 : 0x12;
const u8 nCOMPins = (m_nHeight == 32 && !bIsSSD1305) ? 0x02 : 0x12;
const u8 nColumnAddrRange = m_nWidth - 1;
const u8 nPageAddrRange = m_nHeight / 8 - 1;
// https://www.buydisplay.com/download/ic/SSD1312_Datasheet.pdf Pg. 51 Section 2.1.19