-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlcd.py
More file actions
43 lines (37 loc) · 715 Bytes
/
lcd.py
File metadata and controls
43 lines (37 loc) · 715 Bytes
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
38
39
40
41
42
43
import random
import st7789py as st7789
import tft_config
import vga1_8x16 as font
# import vga2_bold_16x32 as font
tft = tft_config.config(tft_config.WIDE)
tft.rotation(0)
tft.fill(0)
tft.text(
font,
f"Hello gamepad!",
10, 10
)
def show_gamepad(data):
tft.text(
font,
f"ls: {data} ",
10, 10
)
tft.text(
font,
f"xaby: {bin((data[5] & 0b11110000) >> 4)}",
10, 40
)
tft.text(
font,
f"other: {bin(data[6])}",
10, 70
)
tft.text(
font,
f"dpad: {bin(data[5] & 0b00001111)}",
10, 100
)
if __name__ == "__main__":
data = [1, 111,222, 112,221, 8,0, 6]
show_gamepad(data)