I2C commands
Posted: Tue Aug 14, 2018 7:00 am
@dhylands Have you seen PR4020? This addresses the issue of efficiently prepending a command to a buffer such that an I2C stop does not occur between command and data.
Please see the new forum at
https://forum.micropython.org/
The second problem is self-inflicted and can be easily solved by adding a bit of C code to the framebuf module that will send the data efficiently. There is absolutely no technical reason why all the data needs to be in a single continuous buffer in memory, it's just a weirdness of the python api.
This is another workaround that only solves the visible problem, but doesn't even try to get into the actual issue. It still forces you to use the same representation internally in the framebuf as the display you are driving, making it necessary to have a zillion kinds of framebufs, each with its own optimized graphical functions and its own bugs. Instead, there should be a single framebuf format for each color resolution, and the conversion to the format appropriate for a particular display should be done on the fly by the function that sends the data to the display. This way you only need to deal with different modes in one place.pythoncoder wrote: ↑Tue Aug 14, 2018 7:00 am@dhylands Have you seen PR4020? This addresses the issue of efficiently prepending a command to a buffer such that an I2C stop does not occur between command and data.
I take your point. But if the only supported device is the SSD1306 we're a long way from a zillion
i played around some time ago with the limifrog oled display which worked wellThe framebuf class is able to work with multiple colours and the official SSD1306 driver is subclassed from framebuf. Are any colour displays available with drivers written in this way?
I am using 16bit color framebuf class in my bare metal Raspberry Pi port.pythoncoder wrote: ↑Mon Aug 13, 2018 9:49 amThe framebuf class is able to work with multiple colours and the official SSD1306 driver is subclassed from framebuf. Are any colour displays available with drivers written in this way?
Code: Select all
import gpu
import framebuf
class RPiScreen(framebuf.FrameBuffer):
def __init__(self, width, height):
self.width = width
self.height = height
gpu.fb_init(width,height,screen_w=1920,screen_h=1080)
super().__init__(gpu.fb_data(),width,height,framebuf.RGB565)
self
Code: Select all
def set_fb_console(on=True):
global theScreen
from FBConsole import FBConsole, RPiScreen
import os
if on:
theScreen = FBConsole(RPiScreen(480,270))
os.dupterm(theScreen)
else:
theScreen = os.dupterm(None)