oin/typings/sense_hat/colour.pyi

223 lines
6.5 KiB
Python
Raw Normal View History

2024-12-09 13:25:00 +01:00
"""
This type stub file was generated by pyright.
"""
"""
Python library for the TCS3472x and TCS340x Color Sensors
Documentation (including datasheet): https://ams.com/tcs34725#tab/documents
https://ams.com/tcs3400#tab/documents
The sense hat for AstroPi on the ISS uses the TCS34725.
The sense hat v2 uses the TCS3400 the successor of the TCS34725.
The TCS34725 is not available any more. It was discontinued by ams in 2021.
"""
class HardwareInterface:
"""
`HardwareInterface` is the abstract class that sits between the
`ColourSensor` class (providing the TCS34725/TCS3400 sensor API)
and the actual hardware. Using this intermediate layer of abstraction,
a `ColourSensor` object interacts with the hardware without being
aware of how this interaction is implemented.
Different subclasses of the `HardwareInterface` class can provide
access to the hardware through e.g. I2C, `libiio` and its system
files or even a hardware emulator.
"""
@staticmethod
def max_value(integration_cycles): # -> Literal[65535]:
"""
The maximum raw value for the RBGC channels depends on the number
of integration cycles.
"""
...
def get_enabled(self):
"""
Return True if the sensor is enabled and False otherwise
"""
...
def set_enabled(self, status):
"""
Enable or disable the sensor, depending on the boolean `status` flag
"""
...
def get_gain(self):
"""
Return the current value of the sensor gain.
See GAIN_VALUES for the set of possible values.
"""
...
def set_gain(self, gain):
"""
Set the value for the sensor `gain`.
See GAIN_VALUES for the set of possible values.
"""
...
def get_integration_cycles(self):
"""
Return the current number of integration_cycles (1-256).
It takes `integration_cycles` * CLOCK_STEP to obtain a new
sensor reading.
"""
...
def set_integration_cycles(self, integration_cycles):
"""
Set the current number of integration_cycles (1-256).
It takes `integration_cycles` * CLOCK_STEP to obtain a new
sensor reading.
"""
...
def get_raw(self):
"""
Return a tuple containing the raw values of the RGBC channels.
The maximum for these raw values depends on the number of
integration cycles and can be computed using `max_value`.
"""
...
def get_red(self):
"""
Return the raw value of the R (red) channel.
The maximum for this raw value depends on the number of
integration cycles and can be computed using `max_value`.
"""
...
def get_green(self):
"""
Return the raw value of the G (green) channel.
The maximum for this raw value depends on the number of
integration cycles and can be computed using `max_value`.
"""
...
def get_blue(self):
"""
Return the raw value of the B (blue) channel.
The maximum for this raw value depends on the number of
integration cycles and can be computed using `max_value`.
"""
...
def get_clear(self):
"""
Return the raw value of the C (clear light) channel.
The maximum for this raw value depends on the number of
integration cycles and can be computed using `max_value`.
"""
...
class I2C(HardwareInterface):
"""
An implementation of the `HardwareInterface` for the TCS34725/TCS3400
sensor that uses I2C to control the sensor and retrieve measurements.
Use the datasheets as a reference.
"""
BUS = ...
ENABLE = ...
ATIME = ...
CONTROL = ...
ID = ...
STATUS = ...
CDATA = ...
RDATA = ...
GDATA = ...
BDATA = ...
OFF = ...
PON = ...
AEN = ...
ON = ...
AVALID = ...
GAIN_REG_VALUES = ...
ADDR = ...
GAIN_VALUES = ...
CLOCK_STEP = ...
GAIN_TO_REG = ...
REG_TO_GAIN = ...
def __init__(self) -> None: ...
@staticmethod
def i2c_enabled(): # -> bool:
"""Returns True if I2C is enabled or False otherwise."""
...
def get_enabled(self):
"""
Return True if the sensor is enabled and False otherwise
"""
...
def set_enabled(self, status): # -> None:
"""
Enable or disable the sensor, depending on the boolean `status` flag
"""
...
def get_gain(self): # -> Literal[1, 4, 16, 60, 64]:
"""
Return the current value of the sensor gain.
See GAIN_VALUES for the set of possible values.
"""
...
def set_gain(self, gain): # -> None:
"""
Set the value for the sensor `gain`.
See GAIN_VALUES for the set of possible values.
"""
...
def get_integration_cycles(self):
"""
Return the current number of integration_cycles (1-256).
It takes `integration_cycles` * CLOCK_STEP to obtain a new
sensor reading.
"""
...
def set_integration_cycles(self, integration_cycles): # -> None:
"""
Set the current number of integration_cycles (1-256).
It takes `integration_cycles` * CLOCK_STEP to obtain a new
sensor reading.
"""
...
def get_raw(self): # -> tuple[Any, Any, Any, Any]:
"""
Return a tuple containing the raw values of the RGBC channels.
The maximum for these raw values depends on the number of
integration cycles and can be computed using `max_value`.
"""
...
get_red = ...
get_green = ...
get_blue = ...
get_clear = ...
class ColourSensor:
def __init__(self, gain=..., integration_cycles=..., interface=...) -> None: ...
@property
def enabled(self): ...
@enabled.setter
def enabled(self, status): ...
@property
def gain(self): ...
@gain.setter
def gain(self, gain): ...
@property
def integration_cycles(self): ...
@integration_cycles.setter
def integration_cycles(self, integration_cycles): ...
@property
def integration_time(self): ...
@property
def max_raw(self): ...
@property
def colour_raw(self): ...
color_raw = ...
red_raw = ...
green_raw = ...
blue_raw = ...
clear_raw = ...
brightness = ...
@property
def colour(self): ...
@property
def rgb(self): ...
color = ...
red = ...
green = ...
blue = ...
clear = ...