diff --git a/pybricks/hubs.py b/pybricks/hubs.py index 33759de..a883501 100644 --- a/pybricks/hubs.py +++ b/pybricks/hubs.py @@ -7,6 +7,7 @@ from ._common import (Speaker as _Speaker, Battery as _Battery, LightMatrix as _LightMatrix, IMU as _IMU) from .media.ev3dev import Image as _Image from .parameters import Button as _Button +from .geometry import Axis as _Axis class EV3Brick: @@ -54,6 +55,22 @@ class TechnicHub: light = _ColorLight() imu = _IMU() + def __init__(self, top_side=_Axis.Z, front_side=_Axis.X): + """__init__(top_side=Axis.Z, front_side=Axis.X) + + Initializes the hub. Optionally, specify how the hub is + :ref:`placed in your design ` by saying in which + direction the top side (with the button) and front side + (with the light) are pointing. + + Arguments: + top_side (Axis): The axis that passes through the *top side* of + the hub. + front_side (Axis): The axis that passes through the *front side* of + the hub. + """ + pass + class PrimeHub: """LEGO® SPIKE Prime Hub.""" @@ -72,6 +89,22 @@ class PrimeHub: speaker = _Speaker() imu = _IMU() + def __init__(self, top_side=_Axis.Z, front_side=_Axis.X): + """__init__(top_side=Axis.Z, front_side=Axis.X) + + Initializes the hub. Optionally, specify how the hub is + :ref:`placed in your design ` by saying in which + direction the top side (with the buttons) and front side (with the USB + port) are pointing. + + Arguments: + top_side (Axis): The axis that passes through the *top side* of + the hub. + front_side (Axis): The axis that passes through the *front side* of + the hub. + """ + pass + class InventorHub(PrimeHub): """LEGO® MINDSTORMS Inventor Hub.""" diff --git a/pybricks/hubs.pyi b/pybricks/hubs.pyi index 1f7a1ca..c7a4c67 100644 --- a/pybricks/hubs.pyi +++ b/pybricks/hubs.pyi @@ -3,6 +3,7 @@ from ._common import Speaker, Battery, ColorLight, LightMatrix, Keypad from .media.ev3dev import Image +from .geometry import Axis class EV3Brick: screen: Image @@ -22,11 +23,13 @@ class CityHub: class TechnicHub: + def __init__(self, top_size: Axis, front_side: Axis): ... battery: Battery light: ColorLight class PrimeHub: + def __init__(self, top_size: Axis, front_side: Axis): ... battery: Battery light: ColorLight display: LightMatrix