Skip to content

Instantly share code, notes, and snippets.

@antirez
Created March 25, 2024 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antirez/2a939b0503631a675fcb24c18642480b to your computer and use it in GitHub Desktop.
Save antirez/2a939b0503631a675fcb24c18642480b to your computer and use it in GitHub Desktop.
from machine import SPI, Pin
from uc8151 import UC8151
import math, array, time, random
from microfont import MicroFont
import framebuf
spi = SPI(0, baudrate=12000000, phase=0, polarity=0, sck=Pin(18), mosi=Pin(19), miso=Pin(16))
eink = UC8151(spi,cs=17,dc=20,rst=21,busy=26,speed=3,no_flickering=True,inverted=False,dangerous_reaffirm_black=True)
font = MicroFont("victor:R:24.mfnt",cache_chars=True)
font2 = MicroFont("victor:B:70.mfnt",cache_chars=True)
while True:
eink.fb.fill(0)
font2.write("Test!", eink.fb, framebuf.MONO_HLSB, eink.width, eink.height, 0, 10, 1, rot=0, x_spacing=-4)
for angle in range(0,360,10):
start = time.ticks_ms()
random.seed(123)
for _ in range(1):
x = 50
y = 100
font.write("Nel mezzo del cammin", eink.fb, framebuf.MONO_HLSB, eink.width, eink.height, x, y, 1, rot=angle, x_spacing=2)
print("Drawing time ms:", time.ticks_ms() - start)
eink.update(blocking=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment