mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
84 lines
2.9 KiB
Python
84 lines
2.9 KiB
Python
# SPDX-License-Identifier: MIT
|
|
# Copyright (c) 2020-2021 The Pybricks Authors
|
|
|
|
from typing import Collection, Iterable, Optional, Tuple, Union, overload
|
|
|
|
from .geometry import Axis, Matrix, vector
|
|
from .parameters import Button, Color, Direction, Side, Stop, Port
|
|
|
|
class Speaker:
|
|
@overload
|
|
def volume(self) -> int: ...
|
|
@overload
|
|
def volume(self, volume: int) -> None: ...
|
|
def beep(self, frequency: int = 500, duration: int = 100) -> None: ...
|
|
def play_notes(self, notes: Iterable[str], tempo: int = 120) -> None: ...
|
|
|
|
class Light:
|
|
def on(self, brightness: int = 100) -> None: ...
|
|
def off(self) -> None: ...
|
|
def blink(self, durations: Collection[int]) -> None: ...
|
|
def animate(self, brightness_values: Collection[int], interval: int) -> None: ...
|
|
def reset(self) -> None: ...
|
|
|
|
class ColorLight:
|
|
def on(self, color: Optional[Color]) -> None: ...
|
|
def off(self) -> None: ...
|
|
def blink(self, color: Color, durations: Collection[int]) -> None: ...
|
|
def animate(self, colors: Collection[Color], interval: int) -> None: ...
|
|
def reset(self) -> None: ...
|
|
|
|
class LightArray:
|
|
def __init__(self, n: int): ...
|
|
def on(self, brightness: Union[int, (int, int, int, int)]) -> None: ...
|
|
def off(self) -> None: ...
|
|
def blink(self, durations: Collection[int]) -> None: ...
|
|
def animate(self, brightness_values: Collection[int], interval: int) -> None: ...
|
|
|
|
class LightMatrix:
|
|
def __init__(self, rows: int, columns: int): ...
|
|
def orientation(self, up: Side) -> None: ...
|
|
def image(self, matrix: Matrix) -> None: ...
|
|
def animate(self, matrices: Collection[Matrix], interval: int) -> None: ...
|
|
def pixel(self, row: int, column: int, brightness: int = 100) -> None: ...
|
|
def off(self) -> None: ...
|
|
def number(self, number: int) -> None: ...
|
|
def char(self, char: str) -> None: ...
|
|
def text(self, text: str, on: int = 500, off: int = 50) -> None: ...
|
|
def reset(self) -> None: ...
|
|
|
|
class Keypad:
|
|
def pressed(self) -> Tuple[Button]: ...
|
|
|
|
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
|
|
def acceleration(self) -> vector[float, float, float]: ...
|
|
@overload
|
|
def acceleration(self, axis: Axis) -> int: ...
|
|
def tilt(self) -> Tuple[int, int]: ...
|
|
def tapped(self) -> bool: ...
|
|
def shaken(self) -> bool: ...
|
|
def up(self) -> Side: ...
|
|
|
|
class IMU(Accelerometer):
|
|
def heading(self) -> int: ...
|
|
def reset_heading(self, angle): ...
|
|
@overload
|
|
def gyro(self) -> vector[float, float, float]: ...
|
|
@overload
|
|
def gyro(self, axis: Axis) -> int: ...
|