WVGA HDMI+VGA 8bpp Graphics Driver (works with the Parallax 7" HDMI LCD) in Spin2
Rayman
Posts: 14,646
I turned a little example from another thread into this graphics driver.
It's just a beginning of something but can do some things already.
It shows a splash screen and then some simple graphics.
This is in Spin2 and compiles with the Propeller Tool
(But, it's likely to be turned into FlexC shortly)
Update: I've fixed the circles and added text in the attached zip.
Update1c: Now with better line drawing routine from @dgately
Update2a: Now can do both either analog VGA or digital HDMI or both at the same time
Update3b: Now with mouse cursor and also moved basepin and cog settings to top level file. Demonstrates screen painting with mouse.
Note: You will likely have to edit the basepine settings (like "hdmi_base") in the HDMI driver (main file for Ver.3) to match the physical pins you are using for the HDMI adapter.
It's just a beginning of something but can do some things already.
It shows a splash screen and then some simple graphics.
This is in Spin2 and compiles with the Propeller Tool
(But, it's likely to be turned into FlexC shortly)
Update: I've fixed the circles and added text in the attached zip.
Update1c: Now with better line drawing routine from @dgately
Update2a: Now can do both either analog VGA or digital HDMI or both at the same time
Update3b: Now with mouse cursor and also moved basepin and cog settings to top level file. Demonstrates screen painting with mouse.
Note: You will likely have to edit the basepine settings (like "hdmi_base") in the HDMI driver (main file for Ver.3) to match the physical pins you are using for the HDMI adapter.
Comments
Thanks for this!
Wikipedia sure helped with Bresenham's line algorithm for me (I used basically the same)
Not getting DrawCircle() to work and DrawFilledCircle() works only partially:
I had success earlier today with this to plot a circle's circumference:
dgately
The font looks a bit small on this screen...
Possible issue with DrawLine() function...
with "PUB Main()| cz": When lines are drawn with X parameters close together, line does not draw as expected (if they draw at all)
DrawLine():
PlotLine():
My Spin2 PlotLine() code uses a pseudo-code example (from: https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm#Algorithm_for_integer_arithmetic):
dgately
I didn’t actually test mine beyond that one line...
Doc
Drawing UI-type items (non-functioning):
Converted (to spin2) this graphic drawing code from Cornell: https://people.ece.cornell.edu/land/courses/ece4760/PIC32/TFT_display/tft_gfx.c
dgately
I can do HDMI and analog VGA output at the same time. Or, you can pick just one.
Could probably do multiple HDMI and/or VGA at same time, but haven't tried that.
Took some work to get the VGA driver to take the basepin as a parameter. Fortunately, could steal some of that from Chip's code.
Demonstrates a Paint type app where you can draw on screen with mouse.
Basepins and cogs all in top level file now.