Based on pimoroni/micropython commit 0cc56b6. Signed-off-by: Matthias Blankertz <matthias@blankertz.org>