Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[display] Support SH1106 Display, Improve SSD1306 Display #624

Closed

Conversation

TomSaw
Copy link
Contributor

@TomSaw TomSaw commented Apr 27, 2021

Support SH1106

Various SSD1306 Displays sold today do actually integrate the cheaper SH1106. This thing is said to be compatible with SSD1306 what's not 100% the case: SH1106 does only support Page MemoryMode. thus requires a different writeDisplay() routine than actually used for modm::Ssd1306.

Current result using modm::Ssd1306 with SH1106

When sending a frame, one has to alternate between setting the incremented page-address and sending page-data.

However, SSD1306 can also be driven in MemoryMode::PAGE but would result in worse performance vs. transmitting the whole frame aSh1106t once like it is now, thanks to MemoryMode::VERTICAL / MemoryMode::HORIZONTAL.

Solutions

  1. Create a class Sh1106 inheriting Ssd1306 and override for the differences.
  2. Pass MemoryMode as template parameter to Ssd1306 and specialize for the differences.
  3. Pass Ssd1306_I2cWriteTransaction as template parameter and handle the differences there.

I've choosen 1. because:

  • SH1106 is a different IC and deserves it's own class. The compatibility to SSD1306 is expressed by the strong inheritance on `Ssd1306
  • Solution 3. sounds elegant but results in more complex code cause way more binding is required between SSD1306 and Ssd1306_I2cWriteTransaction.
  • One does not want to drive SSD1306 in MemoryMode::PAGE due to worse performance. This excludes 2. and 3.

Improved SSD1306

Structure

  • Detailed Registers in own header ′ssd1306_register.hpp′
  • Renamed DataTranmissionAdapter -> Ssd1306_I2cWriteTransaction for clarification
  • removed numerous cumbersome WriteData() methods

Performance

  • Bulk data transmissions
    • Much faster Initialize() and slightly faster writeDisplay()
    • Size of commandBuffer could be halfed
  • Simplified Ssd1306_I2cWriteTransaction

Flipped buffer[x][y] to buffer[y][x]

The current layout of MonochromeGraphicDisplay::buffer is not directly compatible with the memory-order requested by SH1106. For SH1106 we need the rows ( x-dimension) being ordered behind each other rather than the columns.
SH1106 unfortunately offers no other options for MemoryMode to adjust for the current buffer-layout.
Kindly Ssd1306 comes to meet the constraints of SH106. We can switch from MemoryMode::VERTICAL -> MemoryMode::HORIZONTAL in Ssd1306::initialisation(). Now SSD1306 also receives the rows in a line so the buffer dimensions could be flipped: buffer[x][y] -> buffer[y][x].

@TomSaw TomSaw force-pushed the support-sh1106-and-improve-ssd1306 branch from dce15e9 to 65825b2 Compare April 27, 2021 10:16
@TomSaw TomSaw changed the title [display] Support SH1106 Display, Improve SSD1306 Display driver [display] Support SH1106 Display, Improve SSD1306 Display Apr 27, 2021
@TomSaw TomSaw force-pushed the support-sh1106-and-improve-ssd1306 branch 9 times, most recently from 3c137ee to 986b7d9 Compare April 27, 2021 13:36
@TomSaw TomSaw force-pushed the support-sh1106-and-improve-ssd1306 branch 2 times, most recently from 47e7f58 to 87d1570 Compare May 4, 2021 15:38
@TomSaw TomSaw closed this May 4, 2021
@TomSaw TomSaw force-pushed the support-sh1106-and-improve-ssd1306 branch from 87d1570 to db3cc85 Compare May 4, 2021 15:40
@salkinium
Copy link
Member

Did you mean to close this PR?

@TomSaw
Copy link
Contributor Author

TomSaw commented May 4, 2021

I broke my branch due to bad stashing-strategy. This closed the PR and for the ease, i've just made a new one #627

@salkinium
Copy link
Member

Ok, no problem.
Just FYI: the semester has begun and we all busy with exercises and lectures, so expect some delay in reviews…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants