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

Improve display driver sample for very small monochrome displays #67090

Conversation

rexut
Copy link
Contributor

@rexut rexut commented Jan 1, 2024

The current implementation of samples/drivers/display is good enough for colorful LCD or OLED displays with standard resolution, e.g. 128x64 or larger. But in case of monochromatic or RGB colorful LED panels with very small resolution (below 64x24 or down to 3x3), the internal calculation will fail. Then it results in wrong dimensions or scaling values for the rendered blocks in the corners (TOP/BOTTOM, LEFT/RIGHT).

This PR will also deal with these display types, so anyone can use this example as an initial evaluation example for the full range of possible displays in the wild.

rexut added 3 commits January 1, 2024 16:23
Rounding errors due to the division of non-integrally divisible
buffer sizes lead to the loss of one byte. This can be avoided
with the DIV_ROUND_UP() macro.

Signed-off-by: Stephan Linz <linz@li-pro.net>
In exceptional cases, monochrome displays can deviate from the
general interpretation (PIXEL_FORMAT_MONO01) of a logical 1 as
pixel on (white) and 0 as pixel off (black) and instead set the
capability to PIXEL_FORMAT_MONO10. This small but significant
difference has been ignored so far, resulting in an inverse
display for those displays. In order to be technically correct
here, the buffers for a "white" background should be set to 0
instead of 1 and for "black" to 1 instead of 0.

Signed-off-by: Stephan Linz <linz@li-pro.net>
With extremely small displays (much smaller than 64x24), the
calculation of the blocks in the four corners fails. These
might then be too large and no longer fit into the available
area of the small displays.

Signed-off-by: Stephan Linz <linz@li-pro.net>
@MaureenHelm MaureenHelm merged commit 162a8f0 into zephyrproject-rtos:main Jan 12, 2024
18 checks passed
@rexut rexut deleted the contrib/samples/drivers/display/small-monochrome branch February 4, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants