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

Created SH1107 driver for quantum painter #24724

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

Steve973
Copy link
Contributor

@Steve973 Steve973 commented Dec 16, 2024

Description

Created a SH1107 driver for Quantum Painter based on the existing SH1106 driver.

This is a small/simple change, since SH1107 and SH1106 are quite similar.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@github-actions github-actions bot added the core label Dec 16, 2024
@Steve973 Steve973 changed the base branch from master to develop December 16, 2024 20:58
@Steve973 Steve973 force-pushed the quantum-painter-sh1107-driver branch from a40f821 to 2889006 Compare December 16, 2024 21:17
@drashna drashna requested a review from a team December 16, 2024 21:36
@tzarc
Copy link
Member

tzarc commented Jan 1, 2025

LGTM.

Copy link
Member

@drashna drashna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, docs should be added too.

Tested on i2c, and works... but my SPI oled is fried :/

typedef struct sh1107_device_t {
oled_panel_painter_device_t oled;

uint8_t framebuffer[SURFACE_REQUIRED_BUFFER_BYTE_SIZE(128, 128, 1)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the framebuffer size hardcoded to the maximum looks wrong (even though the typical MCUs with which the QP code is used are usually not that resource restricted).

Options that I could think of:

  1. Add some defines which could default to the maximum size, but could be reduced if desired.
  2. Provide the buffer externally in make_*_device functions, similar to what [QP] Support for LS0XX displays #21844 does (but maybe with more error checking — e.g., pass the buffer size too, then check the passed size against the value calculated from the display dimensions).

Opinions?

Copy link
Contributor

@sigprof sigprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with a couple of (supposedly) SH1107 displays which I have currently (more may be coming in a couple of weeks):

  • 1.5" 128×128 SPI OLED — works (note that this particular display has a somewhat weird pinout which does not match most other 7-pin 128×64 or 64×128 SPI OLEDs);
  • 0.96" 64×128 I2C OLED (not really from that listing, but looks exactly like that, and the original listing disappeared since 2020) — works if the suggested changes are applied.

@pulsar256
Copy link

@Steve973 I am willing/offering to contribute to this PR (resolving requested changes and updating documentation) if you don't have the capacity right now to move forward here.

@drashna drashna requested a review from sigprof February 16, 2025 19:51
@drashna drashna added the breaking_change_2025q1 Targeting breaking changes Q1 2025 label Feb 16, 2025
Copy link
Contributor

@sigprof sigprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the only remaining concern is the framebuffer size which is hardcoded to the maximum possible size supported by the controller.

Do we accept the driver as it is (which also matches what the existing SH1106 driver does), and then add some way to reduce the RAM consumption for smaller displays later (updating all such drivers at the same time)?

@Steve973
Copy link
Contributor Author

I tried to make it exactly like the 1106 driver, and only introduced the single change that is needed for 1107. But I'm fine with whatever people think is best. If anyone else wants to handle any of the changes, then that's fine with me, too. I submitted this because Drashna suggested that I should.

@tzarc
Copy link
Member

tzarc commented Feb 16, 2025

Do we accept the driver as it is (which also matches what the existing SH1106 driver does), and then add some way to reduce the RAM consumption for smaller displays later (updating all such drivers at the same time)?

Given this isn't targeting AVR I'm not too concerned, so if you think it's necessary I'd suggest a follow-up PR.

@tzarc tzarc merged commit c00b0c5 into qmk:develop Feb 16, 2025
4 checks passed
johanbast pushed a commit to johanbast/qmk_firmware that referenced this pull request Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking_change_2025q1 Targeting breaking changes Q1 2025 core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants