mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
pybricks.common.Charger: Document it.
This commit is contained in:
@@ -83,6 +83,14 @@ Prime Hub / Inventor Hub
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.battery.current
|
||||
|
||||
.. rubric:: Getting the charger status
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.charger.connected
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.charger.current
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.charger.status
|
||||
|
||||
.. rubric:: System control
|
||||
|
||||
.. automethod:: pybricks.hubs::PrimeHub.system.set_stop_button
|
||||
|
||||
@@ -708,6 +708,40 @@ class Battery:
|
||||
pass
|
||||
|
||||
|
||||
class Charger:
|
||||
"""Get the status of a battery charger."""
|
||||
|
||||
def connected(self):
|
||||
"""Checks whether a charger is connected via USB.
|
||||
|
||||
Returns:
|
||||
bool: ``True`` if a charger is connected, ``False`` if not.
|
||||
"""
|
||||
|
||||
def status(self):
|
||||
"""Gets the status of the battery charger, represented by one of the
|
||||
following values. This corresponds to the battery light indicator
|
||||
right next to the USB port.
|
||||
|
||||
0. Not charging (off).
|
||||
1. Charging (red).
|
||||
2. Charging is complete (green).
|
||||
3. There is a problem with the charger (yellow).
|
||||
|
||||
Returns:
|
||||
int: Status value.
|
||||
"""
|
||||
pass
|
||||
|
||||
def current(self):
|
||||
"""Gets the charging current.
|
||||
|
||||
Returns:
|
||||
:ref:`current`: Charging current.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class SimpleAccelerometer:
|
||||
"""Get measurements from an accelerometer."""
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
from ._common import (Speaker as _Speaker, Battery as _Battery,
|
||||
ColorLight as _ColorLight, Keypad as _Keypad,
|
||||
LightMatrix as _LightMatrix, IMU as _IMU,
|
||||
System as _System,
|
||||
Charger as _Charger, System as _System,
|
||||
SimpleAccelerometer as _SimpleAccelerometer)
|
||||
from .ev3dev._speaker import Speaker as _EV3Speaker
|
||||
from .geometry import Axis as _Axis
|
||||
@@ -94,6 +94,7 @@ class PrimeHub:
|
||||
_Button.CENTER,
|
||||
_Button.BLUETOOTH,
|
||||
))
|
||||
charger = _Charger()
|
||||
light = _ColorLight()
|
||||
display = _LightMatrix(5, 5)
|
||||
speaker = _Speaker()
|
||||
|
||||
Reference in New Issue
Block a user