Skip to content

Commit 9582f9a

Browse files
committed
Update setup for tinypico
1 parent 4d9a96f commit 9582f9a

File tree

2 files changed

+31
-17
lines changed

2 files changed

+31
-17
lines changed

tinypicost7789/freeze/st7789.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,30 @@ def reset(self):
2222
utime.sleep_ms(50)
2323
self.cs(0)
2424
for command, data in (
25-
# (b'\x01', None), # reset
26-
(b'\x11', None), # wake
27-
(b'\x3a', b'\x55'), # format
28-
(b'\x36', b'\xc8'), # mad
29-
(b'\x21', None), # invert
30-
(b'\x13', None), # no partial
31-
(b'\x29', None), # on
25+
(b'\x36', b'\xc8'), # MADCTRL
26+
(b'\x3a', b'\x05'), # COLMOD
27+
(b'\xb2', # PORCTRL
28+
b'\x0c\x0c\x00\x33\x33'),
29+
(b'\xb7', b'\x35'), # GCTRL
30+
(b'\xbb', b'\x28'), # VCOMS
31+
(b'\xc0', b'\x2c'), # LCMCTRL
32+
(b'\xc2', b'\x01\xff'), # VDVVRHEN
33+
(b'\xc3', b'\x12'), # VRHS
34+
(b'\xc4', b'\x20'), # VDVSET
35+
(b'\xc6', b'\x0f'), # FRCTR2
36+
(b'\xd0', b'\xa4\xa1'),
37+
(b'\xe0', # PVGAMCTRL
38+
b'\xd0\x04\x0d\x11\x13\x28\x3f\x54\x4c\x18\x0d\x0b\x1f\x23'),
39+
(b'\xe1', # NVGAMCTRL
40+
b'\xd0\x04\x0C\x11\x13\x2c\x3f\x44\x51\x2f\x1f\x1f\x20\x23'),
41+
(b'\x2c', None),
42+
(b'\x21', None), # no invert
43+
(b'\x11', None), # display on
3244
):
3345
self.write(command, data)
34-
utime.sleep_ms(150)
46+
utime.sleep_ms(10)
47+
utime.sleep_ms(120)
48+
self.write(b'\x29', None) # on
3549
self.cs(1)
3650
utime.sleep_ms(50)
3751

tinypicost7789/freeze/ugame.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import struct
99

1010

11-
K_DOWN = 1 << 3
12-
K_LEFT = 1 << 4
13-
K_RIGHT = 1 << 5
14-
K_UP = 1 << 7
15-
K_O = 1 << 9 # button A
16-
K_X = 1 << 8 # button B
17-
K_Z = 1 << 6 # button C
11+
K_DOWN = 0x0800
12+
K_LEFT = 0x1000
13+
K_RIGHT = 0x2000
14+
K_UP = 0x8000
15+
K_O = 0x0001
16+
K_X = 0x0002
17+
K_Z = 0x0008
1818

1919

2020
class Audio:
@@ -38,7 +38,7 @@ def __init__(self, i2c, address=0x5a):
3838
for register, value in (
3939
(0x80, b'\x63'), # reset
4040
(0x5e, b'\x00'), # stop mode, reset config
41-
(0x2b, b'\x01\x01\x0e\x00\x01\x05\x01\x00\x00\x00\x00'),
41+
(0x2b, b'\x01\x01\x10\x20\x01\x01\x10\x20\x01\x10\xff'),
4242
(0x5b, b'\x00\x10\x20'), # debounce, config1, config2
4343
(0x5e, b'\x8f'), # exit stop mode
4444
):
@@ -50,7 +50,7 @@ def get_pressed(self):
5050
return mask
5151

5252

53-
spi = SPI(2, baudrate=40000000, sck=Pin(18), mosi=Pin(23))
53+
spi = SPI(2, baudrate=40_000_000, sck=Pin(18), mosi=Pin(23))
5454
display = st7789.Display(spi, Pin(4, Pin.OUT), Pin(14, Pin.OUT))
5555
display.clear()
5656
i2c = I2C(sda=Pin(21), scl=Pin(22))

0 commit comments

Comments
 (0)