From a2801aff41452be1abd5eb95c47ed7c43af8a09d Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Wed, 7 Jul 2021 09:47:06 +0200 Subject: [PATCH] pybricks.hubs: Enable single button. --- doc/api/hubs/cityhub.rst | 4 +++- doc/api/hubs/movehub.rst | 4 +++- doc/api/hubs/technichub.rst | 4 +++- pybricks/hubs.py | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/api/hubs/cityhub.rst b/doc/api/hubs/cityhub.rst index 95d4aff..2f4e614 100644 --- a/doc/api/hubs/cityhub.rst +++ b/doc/api/hubs/cityhub.rst @@ -23,7 +23,9 @@ City Hub .. automethod:: pybricks.hubs::CityHub.battery.current - .. rubric:: System control + .. rubric:: Button and system control + + .. automethod:: pybricks.hubs::CityHub.button.pressed .. automethod:: pybricks.hubs::CityHub.system.set_stop_button diff --git a/doc/api/hubs/movehub.rst b/doc/api/hubs/movehub.rst index 8fdf9d9..f556835 100644 --- a/doc/api/hubs/movehub.rst +++ b/doc/api/hubs/movehub.rst @@ -31,7 +31,9 @@ Move Hub .. automethod:: pybricks.hubs::MoveHub.battery.current - .. rubric:: System control + .. rubric:: Button and system control + + .. automethod:: pybricks.hubs::MoveHub.button.pressed .. automethod:: pybricks.hubs::MoveHub.system.set_stop_button diff --git a/doc/api/hubs/technichub.rst b/doc/api/hubs/technichub.rst index 849f7c2..6ea01bb 100644 --- a/doc/api/hubs/technichub.rst +++ b/doc/api/hubs/technichub.rst @@ -37,7 +37,9 @@ Technic Hub .. automethod:: pybricks.hubs::TechnicHub.battery.current - .. rubric:: System control + .. rubric:: Button and system control + + .. automethod:: pybricks.hubs::TechnicHub.button.pressed .. automethod:: pybricks.hubs::TechnicHub.system.set_stop_button diff --git a/pybricks/hubs.py b/pybricks/hubs.py index 693fed7..ffb5511 100644 --- a/pybricks/hubs.py +++ b/pybricks/hubs.py @@ -39,6 +39,7 @@ class MoveHub: light = _ColorLight() imu = _SimpleAccelerometer() system = _System() + button = _Keypad((_Button.CENTER,)) class CityHub: @@ -49,6 +50,7 @@ class CityHub: battery = _Battery() light = _ColorLight() system = _System() + button = _Keypad((_Button.CENTER,)) class TechnicHub: @@ -60,6 +62,7 @@ class TechnicHub: light = _ColorLight() imu = _IMU() system = _System() + button = _Keypad((_Button.CENTER,)) def __init__(self, top_side=_Axis.Z, front_side=_Axis.X): """__init__(top_side=Axis.Z, front_side=Axis.X)