Skip to content

Added built-in display bringup for Badger2040 #6143

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

Merged
merged 3 commits into from
Mar 15, 2022

Conversation

ZodiusInfuser
Copy link

This is in response to @tannewt suggestion in #6074 (comment)

I believe I have set it up correctly (certainly the sequences match what we do in C++ and MP). One query though, what is the default background color meant to be?

As it currently stands with our config it is white, but that means that to draw black text with displayio I have to do label.Label(font, text=text, color=0xFFFFFF) which seems backwards, but I cannot figure out a way to invert it without also inverting the background. Any input would be appreciated 🙂

@tannewt
Copy link
Member

tannewt commented Mar 12, 2022

I believe the background should be black by default. That way it'll match displayio on TFTs.

@ZodiusInfuser
Copy link
Author

Thanks for the clarification. So the CircuitPy mini REPL that appears on screen should be classic terminal style of white text on black?

I'll get that inverted then. A related question, how can I easily draw a white background from python code with display IO? I found some guides but it suggested that the only way to do it is to create a white bitmap that is then shown to the screen, but if feels like there's got to be a simpler way. Maybe I've been spoilt by our freedom with the custom Micropython builds we make that simply have a display.clear(color) function 😅 .

@FoamyGuy
Copy link
Collaborator

@ZodiusInfuser AFAIK the way to make a blank white screen with displayio is to make a white something and add it as the first element in the group that you show() on the display, you could then stack more things on top of it.

There is some flexibility with what the white something can be though... It could be a Bitmap that is the same size as the display filled with white pixels. Or it could be a Bitmap that is an even multiple smaller than the display and then use the Group object to scale it up by that multiple. This allows you to use a Bitmap smaller than the physical size of the display which can save some RAM. i.e. if your display is 296x128 pixels you could make a bitmap sized at 37x16 and then put it into a Group that is scaled 8x and it would then match the full display.

Another option is to use a vectorio object instead of a Bitmap. https://docs.circuitpython.org/en/latest/shared-bindings/vectorio/index.html Rectangle probably being the most fitting for this purpose.

There is no display.fill() or display.clear() style function like you mentioned with displayio because the core concept of displayio revolves around adding objects to the display to be shown rather than lower level pixel manipulations.

@ZodiusInfuser
Copy link
Author

Thanks for the vectorio suggestion @FoamyGuy! That seems simple enough to set up.

I'm getting this twitter user to try a build with these changes in, and if it checks out I'll take this PR out of being a draft.
https://twitter.com/BeBoXoS/status/1503147248472973318?s=20&t=w7q_tvnk14GlHRFtjeUSsA

@ZodiusInfuser ZodiusInfuser marked this pull request as ready for review March 14, 2022 22:26
@ZodiusInfuser
Copy link
Author

@tannewt I'm happy to push this forward now 🙂

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Works for me!

@tannewt tannewt merged commit fd17ba6 into adafruit:main Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants