pimoroni / picosystem

PicoSystem libraries and examples.
MIT License
145 stars 33 forks source link

MicroPython: Add start() and quit() functions. #32

Closed Gadgetoid closed 3 years ago

Gadgetoid commented 3 years ago

New API changes

start() enters a blocking main loop that dispatches update/draw calls to the Python functions.

When quit() is called, start() will drop out of the loop, clean up the cached update/draw pointers and reset "tick".

Your scripts should now look like this:

def update(tick):
    pass

def draw(tick):
    pass

start()

tick() and _reset() are included for posterity, but these may both be deprecated since _reset() happens implicitly when quit() is called.

Stats & GC

:thinking: Flipping, at least, should be a pretty constant time operation, can we stick a larger sleep value in here?

OC/Buffer