peterhinch/micropython-async

SSD1306 driver?

Closed this issue · 1 comments

Hello, I am an asynchronous programming stupid. I hope to get a simple asynchronous SSD1306 driver. In order to avoid create extra work or burden to others due to my stupidity, I decide to list my needs here, I hope someone can help me to judge whether I really need asynchronous SSD1306 driver in my situation.

I have a periodic task that can't be interrupted, which means that unless I can complete the SSD1306 update in one cycle, the integrity of the periodic task will be destroyed. The current SSD1306 update will cause a 10ms block, so my periodic task can only be 100 Hz, and I hope to upgrade the task to 200 Hz, which is 5ms.

So should I use non-blocking asynchronous SSD1306 drivers?

In any real application uasyncio is not able to schedule a coroutine at a rate of 200Hz. This is because in the interval between the task getting execution every other running task gets scheduled. The only practicable way to run code at a 200Hz rate is in response to a hard interrupt, typically caused by a hardware timer. A hard IRQ callback will be able to pre-empt the SSD1306 driver, but you need to select a platform that supports hard IRQ's and follow the rules on writing interrupt service routines.

I suggest you seek further help in the forum.