binary frame buffer for SSD1306 OLED?

I want to use the “image” object to draw stuff to a 128x64 OLED that uses the SSD1306 chipset. I see that there’s a 3rd party library already, but the link from the docs just link to the source code.

It’s not too hard to understand but I can’t find an example, so I just want to confirm here:

i2c = pyb.I2C(2, pyb.I2C.MASTER) 
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
oled.framebuf = image.Image(126, 64, sensor.binary)
oled.framebuf.draw_circle(...)
oled.show()

The above code doesn’t make sense, because the init of SSD1306 will have already called .show() and .framebuf would be undefined, causing an exception. This would not happen with SPI because the SPI init creates a frame buffer, the I2C init does not create a frame buffer.

That’s why I’m asking here. What’s the right way of using that library?

Thanks

That’s a third party driver that is driving a low res lcd screen. I don’t think the driver couples into our vision system. So, it has features are just MicroPython specific but not in anyway tied to OpenMV image code.

I.e it appears you are trying to use an OpenMV library with it. I don’t think the driver works for that. But, maybe it does? You should read the source for it.

OK I think I got it, the “official” micropython framebuf class has primitive line drawing functions, rectangles, and pixel font text, but no circles, which is what I really wanted but there are a billion workarounds for that.

I was also kind of hoping I can swap between the OpenMV LCD shield and the OLED with the same frame buffer but I can also work around that with just a pixel-for-pixel copy.