mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-11 17:14:41 +00:00
pybricks.common: Charger, IMU and System auto-completion
This commit is contained in:
committed by
David Lechner
parent
2ba7edab0c
commit
d8bd890101
@@ -4,6 +4,9 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
- Code auto-completion for `hub.charger`, `hub.imu` and `hub.system`.
|
||||
|
||||
### Fixed
|
||||
- Fixed code completion for `DCMotor` and `Motor` classes in MS Python VS Code extension.
|
||||
- Fixed missing `DCMotor` type in `ev3devices`.
|
||||
|
||||
@@ -7,6 +7,12 @@ from .geometry import Axis, Matrix, vector
|
||||
from .parameters import Button, Color, Direction, Side, Stop, Port
|
||||
|
||||
|
||||
class System:
|
||||
def set_stop_button(self, button: Button) -> None: ...
|
||||
def shutdown(self) -> None: ...
|
||||
def reset_reason(self) -> int: ...
|
||||
def name(self) -> str: ...
|
||||
|
||||
class DCMotor:
|
||||
def __init__(
|
||||
self, port: Port, positive_direction: Direction = Direction.CLOCKWISE
|
||||
@@ -128,6 +134,15 @@ class Battery:
|
||||
def voltage(self) -> int: ...
|
||||
def current(self) -> int: ...
|
||||
|
||||
class Charger:
|
||||
def connected(self) -> bool: ...
|
||||
def status(self) -> int: ...
|
||||
def current(self) -> int: ...
|
||||
|
||||
class SimpleAccelerometer:
|
||||
def acceleration(self) -> Tuple[int, int, int]: ...
|
||||
def up(self) -> Side: ...
|
||||
|
||||
class Accelerometer:
|
||||
def neutral(self, top: Axis, front: Axis) -> None: ...
|
||||
@overload
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (c) 2020 The Pybricks Authors
|
||||
|
||||
from ._common import Speaker, Battery, ColorLight, LightMatrix, Keypad
|
||||
from ._common import Battery, ColorLight, Charger, IMU, Keypad, LightMatrix, SimpleAccelerometer, Speaker, System
|
||||
from .ev3dev._speaker import Speaker as EV3Speaker
|
||||
from .geometry import Axis
|
||||
from .media.ev3dev import Image
|
||||
@@ -17,17 +17,22 @@ class EV3Brick:
|
||||
class MoveHub:
|
||||
battery: Battery
|
||||
light: ColorLight
|
||||
system: System
|
||||
imu: SimpleAccelerometer
|
||||
|
||||
|
||||
class CityHub:
|
||||
battery: Battery
|
||||
light: ColorLight
|
||||
system: System
|
||||
|
||||
|
||||
class TechnicHub:
|
||||
def __init__(self, top_size: Axis, front_side: Axis): ...
|
||||
battery: Battery
|
||||
light: ColorLight
|
||||
system: System
|
||||
imu: IMU
|
||||
|
||||
|
||||
class PrimeHub:
|
||||
@@ -37,6 +42,9 @@ class PrimeHub:
|
||||
display: LightMatrix
|
||||
buttons: Keypad
|
||||
speaker: Speaker
|
||||
system: System
|
||||
imu: IMU
|
||||
charger: Charger
|
||||
|
||||
|
||||
class InventorHub(PrimeHub): ...
|
||||
|
||||
Reference in New Issue
Block a user