Overview
Back when the Qualia S3 was first released, I wanted to run the sushi conveyer belt animation on one of the long bar displays. I tried the project in CircuitPython, but it was way too slow, so I had to use Arduino with PlatformIO. Much like Jiro, I never stopped dreaming of sushi and hoped to one day revisit the project and have it run in CircuitPython. With Turbo, that day has finally come.
What's the Deal with Turbo?
CircuitPython Turbo lets you write Python helper modules with Viper decorators from MicroPython. These modules are compiled using mpy-cross for the specific architecture of the chip that it will run on. This creates an .MPY file that goes into the /lib folder on your CIRCUITPY device. The functions that utilize Viper decorators become native machine code on compilation. Not everything benefits from Viper decorators, but code snippets that use heavy math computations, like graphics, see a significant speed-up.
Tim C. wrote an excellent explainer for how Viper modules are written in his PixelDust Digital Sand for CircuitPython Guide:
Viper functions are written as Python, but they are their own weird flavor of Python with an extra set of rules that must be followed.
Local variables and arguments must be
int,uint(32-bit only),bool,ptr,ptr8,ptr16,ptr32, orobject. They cannot usefloatslike normal Python numbers do. Parameters get passed to the Viper function as a list of values, and are accessed via their index within that list. There is no overflow protection. Integers will silently wrap, out-of-range indexes can corrupt memory or crash instead of raising a cleanIndexError. Variables cannot change types. Mixing of typed values withobjectvalues will fall back to slower runtime calls.
Page last edited October 09, 2026
Text editor powered by tinymce.