api/pupdevices/Remote: publish draft api

This commit is contained in:
Laurens Valk
2020-12-29 19:51:48 +01:00
parent 32a47bcee0
commit c2d2884794
4 changed files with 41 additions and 13 deletions
+8
View File
@@ -18,6 +18,7 @@
ultrasonicsensor
forcesensor
light
remote
.. class:: DCMotor
:noindex:
@@ -88,3 +89,10 @@
.. figure:: ../../api/images/light.png
:width: 90 %
:target: light.html
.. class:: Remote
:noindex:
.. figure:: ../../api/images/pupremote.png
:width: 50 %
:target: remote.html
+20
View File
@@ -0,0 +1,20 @@
Remote Control
^^^^^^^^^^^^^^^^^^^^^^^^^
.. warning::
This remote is not yet supported.
Upvote `this issue <https://github.com/pybricks/support/issues/186>`_ if
you want to see this happen.
.. figure:: ../../api/images/pupremote.png
:width: 60 %
.. autoclass:: pybricks.pupdevices.Remote
:no-members:
.. automethod:: pybricks.pupdevices::Remote.light.on
.. automethod:: pybricks.pupdevices::Remote.light.off
.. automethod:: pybricks.pupdevices::Remote.buttons.pressed
+9 -10
View File
@@ -25,22 +25,21 @@ class Motor(_Motor):
pass
class RemoteControl:
"""LEGO® Powered Up Bluetooth Remote Control/Handset."""
class Remote:
"""LEGO® Powered Up Bluetooth Remote Control."""
light = _ColorLight()
buttons = _Keypad()
address = None
"""Bluetooth address of the remote."""
def __init__(self, device=None, timeout=10000):
"""Connect the handset to the hub.
def __init__(self, address=None, timeout=10000):
"""Connects to the remote.
Arguments:
device (str): Bluetooth address of the handset (? TODO ?).
If you do not specify a device identifier, the hub will
attempt to pair with any handset that is currently in
advertising mode.
timeout (:ref:`time`): The amount of time before giving up
searching.
device (str): Bluetooth address of the remote. If no address is
given, it connects to the first available remote that it finds.
timeout (:ref:`time`): How long to search for the remote.
"""
pass
+4 -3
View File
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
from typing import Collection, List, Optional, Tuple
from typing import Collection, List, Optional, Tuple, Union
from ._common import Keypad, DCMotor, ColorLight, LightArray, Motor as BaseMotor, Light as BaseLight
@@ -9,10 +9,11 @@ from .parameters import Color, Direction, Port
class Motor(BaseMotor): ...
class RemoteControl:
class Remote:
light: ColorLight
buttons: Keypad
def __init__(self, device: str = None, timeout: int = 10000): ...
addresss: Union[str, None]
def __init__(self, address: str = None, timeout: int = 10000): ...
class TiltSensor:
def __init__(self, port: Port): ...