Skip to content
Snippets Groups Projects
Commit cda0d125 authored by q3k's avatar q3k
Browse files

st4m: run against new captouch api

parent 4b044849
No related branches found
No related tags found
No related merge requests found
from typing import Protocol, List
from typing import Protocol, List, Tuple
class CaptouchPetalPadsState(Protocol):
"""
......
......@@ -17,7 +17,7 @@ if TYPE_CHECKING:
class ABCBase(metaclass=ABCMeta):
pass
from typing import List, Optional
from typing import List, Optional, Tuple
from enum import Enum
else:
# We're in CPython or Micropython.
......@@ -31,12 +31,13 @@ else:
return _fail
try:
from typing import List, Optional
from typing import List, Optional, Tuple
from enum import Enum
except ImportError:
# We're in Micropython.
List = None
Optional = None
Tuple = None
class Enum:
pass
......@@ -49,4 +50,5 @@ __all__ = [
"List",
"Optional",
"Enum",
"Tuple",
]
......@@ -2,6 +2,7 @@ from st4m.goose import List, Optional, Enum
from st4m.ui.ctx import Ctx
import hardware
import captouch
class InputState:
......@@ -25,7 +26,8 @@ class InputState:
Build InputState from current hardware state. Should only be used by the
Reactor.
"""
petal_pressed = [hardware.get_captouch(i) for i in range(10)]
cts = captouch.read()
petal_pressed = [cts.petals[i].pressed for i in range(10)]
left_button = hardware.left_button_get()
right_button = hardware.right_button_get()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment