Newhaven 3.12" OLED display code in Spin2
Rayman
Posts: 14,633
in Propeller 2
Converted Newhaven's example Arduino code to Spin2 and added support for 6800 and 8080 and both SPI interface modes.
Little Eval breakout board makes it easy to connect, only one jumper wire needed.
Product page is here:
https://newhavendisplay.com/3-12-inch-blue-graphic-oled-module/
They call it "monochrome", but it's really 4-bit (16) shades of one color.
Comments
Nice, Ray!
Seems like you might be able to save a bit of code space by merge the data() and command() methods into a unified write() method that takes your byte and a value for the mode.
Took a stab at improving their examples logo with Photoshop.
Made a 4bpp grayscale image of the logo in datasheet.
It's much better, although hard to get good photos that show it...
If you by any chance need a 256x64 Parallax logo (that I manually optimized for 2bpp tiled display ages ago), uh, well, here.
Ok, guessed I should try it... A bit better in 4 bpp although color limited...
My iPhone doesn't seem able to get a good photo of the screen. The contrast ratio is perfect, despite how the photo looks...
Also, the color is off and the X is actually darker than the rest...
Next, need to work on speeding up the code with some inline assembly...
Got the data and command code now as inline assembly.
Maybe it's faster, but it was already pretty fast with this small display.
Now thinking about how to do things like set individual pixels.
Problem is that you need to set/read at least two pixels at a time. Might be 8, not quite clear in manual...
Seems some people draw to a screen buffer first and then send the whole buffer to display.
Thinking that's the way to go...
Hello.
I have added graphics functionality to the Rayman code.
some code in assembler HUB.
Added rectangles/fills, circles/fills, lines and points
Also several fonts with background color.
It's simple and not finished, but I think it's a container for using the oled with graphics and text.
I'm starting with propeller 2 so it's not a very good code, it's a beginner's code.
It works in SPI mode, I think that in 8bit mode the data transfer would be faster but I really value the free pins, that's why it works in SPI a bit slow, this is because of the screen, not the code.
Excuse me if there is "Spanglish" in the code. My English is basic and Google doesn't always have the best translation.