diff --git a/python_payload/mypystubs/captouch.pyi b/python_payload/mypystubs/captouch.pyi index 99edb701794e2b1ca6f2d90fb10df11606cbc62e..7c49b0e94734972bb423bf34e4e71314511391cc 100644 --- a/python_payload/mypystubs/captouch.pyi +++ b/python_payload/mypystubs/captouch.pyi @@ -1,4 +1,4 @@ -from typing import Protocol, List +from typing import Protocol, List, Tuple class CaptouchPetalPadsState(Protocol): """ diff --git a/python_payload/st4m/goose.py b/python_payload/st4m/goose.py index c4380609ffd25c551305bbf10bafb59f5391869f..bb1c0224894db616163d3cefba86b7897c6868f1 100644 --- a/python_payload/st4m/goose.py +++ b/python_payload/st4m/goose.py @@ -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", ] diff --git a/python_payload/st4m/input.py b/python_payload/st4m/input.py index cdeacc05ba85e4e9efed3729426449ab96af8ecf..5c597bf165b90d0a3addbd2b4586b6c036f53712 100644 --- a/python_payload/st4m/input.py +++ b/python_payload/st4m/input.py @@ -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()