-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
CircuitPython version
8.1.0-beta.1-39-gd078bc3aeCode/REPL
#Trying to draw in the framebuffer using adafruit_framebuf
import displayio
displayio.release_displays()
import time
import board
import picodvi
import framebufferio
w=640
h=480
fb = picodvi.Framebuffer(
width=w, height=h, color_depth=1,
clk_dp=board.CKP, clk_dn=board.CKN,
red_dp=board.D0P, red_dn=board.D0N,
green_dp=board.D1P, green_dn=board.D1N,
blue_dp=board.D2P, blue_dn=board.D2N)
import adafruit_framebuf
afb=adafruit_framebuf.FrameBuffer(fb,w,h, adafruit_framebuf.MVLSB)
display = framebufferio.FramebufferDisplay(fb) # Goes to safe mode if using (afb) ok with (fb)
afb.circle(center_x=100,center_y=100,radius=90,color=1)
#]0;🐍code.py | 8.1.0-beta.1-39-gd078bc3ae\Traceback (most recent call last):
# File "code.py", line 26, in <module>
# File "adafruit_framebuf.py", line 378, in circle
# File "adafruit_framebuf.py", line 358, in pixel
# File "adafruit_framebuf.py", line 147, in set_pixel
#TypeError: 'Framebuffer' object isn't subscriptable
while True:
time.sleep(1)Behavior
The expected behavior, or objective is to be able to draw directly in the picodvi framebuffer and that this result in displaying on the DVI connected screen.
I totally don't know what I am doing, or if I am doing that right, but I try to put together what I think is the normal or CP way of doing this... without using displayio.
So I try to use adafruit_framebuf and the drawing function available there, but working directly on the display framebuffer.
Description
3 problems:
Problem 1: picodvi.Framebuffer vs adafruit_framebuf.FrameBuffer
picodvi does not use an upper case B for FrameBuffer, and that is hurting since previous usage have established the use of FrameBuffer ...
Problem 2: Feather RP2040 DVI goes in safe mode
if line 24 is written: display = framebufferio.FramebufferDisplay(afb)
Where afb is an adafruit_framebuf.FrameBuffer rather than the expected picodvi.Framebuffer.
Problem 3: a Framebuffer created by picodvi.Framebuffer is not subscritable
This is breaking all of my hopes to using existing function from adafruit_framebuf to draw something on the DVI screen.
Additional information
I might totally misunderstand the various framebuffer and how to use those... so maybe it is not a bug but:
A) a misunderstanding... and I should discuss that on discord or in the weed
B) a feature request... because it is desirable and would save memory for some usecase
C) totally possible another efficient way... and I would like to learn