-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdemo_images.py
37 lines (29 loc) · 1.07 KB
/
demo_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""SSD1309 demo (images)."""
from time import sleep
from machine import Pin, SPI # type: ignore
from ssd1309 import Display
def test():
"""Test code."""
spi = SPI(1, baudrate=10000000, sck=Pin(14), mosi=Pin(13))
display = Display(spi, dc=Pin(4), cs=Pin(5), rst=Pin(2))
# i2c = I2C(0, freq=400000, scl=Pin(5), sda=Pin(4)) # Pico I2C bus 1
# display = Display(i2c=i2c, rst=Pin(2))
display.draw_bitmap("images/eyes_128x42.mono", 0, display.height // 2 - 21,
128, 42)
display.present()
sleep(5)
display.clear_buffers()
display.draw_bitmap("images/doggy_jet128x64.mono", 0, 0, 128, 64,
invert=True)
display.present()
sleep(5)
display.clear_buffers()
display.draw_bitmap("images/invaders_48x36.mono", 0, 14, 48, 36, rotate=90)
display.draw_bitmap("images/invaders_48x36.mono", 40, 14, 48, 36)
display.draw_bitmap("images/invaders_48x36.mono", 92, 14, 48, 36,
rotate=270)
display.present()
sleep(10)
display.cleanup()
print('Done.')
test()