There was an error while loading. Please reload this page.
1 parent de38007 commit 4bd0f5fCopy full SHA for 4bd0f5f
m5stack/ugame.py
@@ -8,11 +8,13 @@
8
9
10
K_X = 0x20
11
-K_DOWN = 0x01
12
-K_LEFT = 0x08
13
-K_RIGHT = 0x04
14
-K_UP = 0x02
+K_DOWN = 0x02
+K_LEFT = 0x04
+K_RIGHT = 0x08
+K_UP = 0x01
15
K_O = 0x10
16
+K_SELECT = 0x40
17
+K_START = 0x80
18
19
20
class Audio:
@@ -30,12 +32,12 @@ def mute(self, value=True):
30
32
31
33
34
class Buttons:
- def __init__(self, i2c, address=0x10):
35
+ def __init__(self, i2c, address=0x08):
36
self._i2c = i2c
37
self._address = address
38
39
def get_pressed(self):
- return self._i2c.readfrom(self._address, 1)[0]
40
+ return self._i2c.readfrom(self._address, 1)[0] ^ 0xff
41
42
43
spi = SPI(2, baudrate=40000000, sck=Pin(18), mosi=Pin(23))
0 commit comments