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
Add SH1106 OLED support #5787
Add SH1106 OLED support #5787
Conversation
Awesome! However, if you could add to the OLED driver documentation, as well? Also, @XScorpion2, if you wanted to double check the code? |
yup, looking up SH1106 & reviewing now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to read the spec sheet a bit, but looks good. Only downside is that looking at the list of available commands in the specs, SH1106 won't be able to do 90 degree rendering as there is no way to specify a stopping column address to get the ram location you are writing at to wrap back to the beginning of the column, and advance to the next page.
Thanks very much for the code review @XScorpion2! I've made the requested changes and a couple more small improvements:
I'm still having some issues with my 128x64 OLED display, however. I can't yet tell if these are bugs my changes introduced (and thus might affect SSD1306 users)... but I don't think they are. Still investigating.
|
@datagrok hmm, those bugs do sound like they might cause issues with SSD1306 users. Let me review those areas of the code a bit closer. and I can also pull this down and test it on a few 128x32 boards at least. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to go
Ok, looking at the code, everything should be operating as expected as there really isn't any surprises. The page 7 issue might be the usage side causing issues, can you provide a link to your usage? Edit: Pulled it down and all my tests pass on device locally. |
@XScorpion2 thanks again, and for testing my changes with your hardware! I added some commits to address the minor issues you mentioned.
Here it is. I'm rendering the QMK logo (3 pages), then three pages representing the key layout, then one page for the numlock status, and I should have one more page to use, but it breaks: If you pull that code, note that you'd have to compile with Edit: I believe I've found my problem. The example code that outputs the num + caps + scroll lock status consumes the entire page, so I was adding a newline unnecessarily. Removing the newline makes it behave correctly and I can use all 8 pages. So please disregard the "page 7" problem I mentioned. |
@drashna I've updated the docs, and @XScorpion2 has approved the majority of the changes. One of the "issues" I mentioned in conversation above was my own fault; the other can be worked around. If these minor changes made after approval look okay, I think this PR should be ready to merge? Thanks! 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@drashna who else needs to review this in order to allow it to merge? Or did you just want @XScorpion2 to approve the change introduced by those last two commits? |
waiting on @jackhumbert or @skullydazed or others to review this. |
also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver
Rebased my work on master to incorporate @XScorpion2's improvements to the OLED driver from #6085. |
👍 still approved |
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
* modify oled_driver to support SH1106 also: - improve mechanism to specify which OLED IC we use - comment calc_bounds() - give OLED_COLUMN_OFFSET a default value - inline comment re: OLED MEMORY_MODE and SH1106 - update docs/feature_oled_driver.h for SH1106 support and related changes - docs: OLED: note we have tested SSD1306 on ARM boards (per @XScorpion2) - define out MEMORY_MODE when using SH1106 OLED driver * document that SSD1306 128x64 on AVR works Per @XScorpion2: qmk#5787 (comment)
Description
This patch adds rudimentary support for the SH1106 OLED driver IC, and some minor enhancements to better support my particular OLED module.
The SH1106 chip is quite similar to but not the same as the SSD1306 that
drivers/oled/oled_driver.c
was written to support. In particular:oled_driver.c
assumes Horizontal Addressing.)Regarding my particular OLED module:
I purchased a cheap 128x64 I2C OLED module claiming to use SSD1306, but it turned out to have an SH1106 instead. Recall that the SH1106 at 132x64 has a wider buffer than the physical display at 128x64. The vendor of my OLED module elected to connect the display such that the first two columns of display ram are not mapped to the display hardware. To accommodate this, I added
#define OLED_COLUMN_OFFSET
.Since other full-featured graphics libraries exist that support many different chips, my goal for this patch was only to add basic support to QMK's
oled_driver.c
with a minimum of code changes.It does not yet support 90 degree rotation (because I don't yet understand the algorithm implementing it), and it will probably never support scrolling (since that feature is missing from SH1106 hardware.)
This discussion in the Arduino forums helped me troubleshoot my OLED module enough to make these changes.
Types of Changes
Issues Fixed or Closed by This PR
Checklist