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

accessing the framebuffer? #58

Open
air-eat opened this issue Oct 22, 2023 · 0 comments
Open

accessing the framebuffer? #58

air-eat opened this issue Oct 22, 2023 · 0 comments

Comments

@air-eat
Copy link

air-eat commented Oct 22, 2023

i wanted to see if i can somehow get the framebuffer of the badger's display (mainly to create a function that inverts a small section of the display)

there is a set_framebuffer function that works with a bytearray, e.g.

import badger2040
display = badger2040.Badger2040()

fb = bytearray(4736) # (4736 = number of pixels on badger (296*128 = 37888) divided by 8)
display.set_framebuffer(fb) # fills the screen with black since the bytearray is full of 0x00s

display.update()

and picographics does seem to have a get_framebuffer function that is omitted from from the badger (was this deliberate?)

i feel like reading and modifying the framebuffer directly could have some uses, like creating interesting effects or being able to draw patterns faster (the example above is faster than setting the pen to 0 and clearing the screen, albeit by only 9 milliseconds)

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

No branches or pull requests

1 participant