mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
api/iodevices: simplify LUMPDevice API
All these device can do is read or write values at a particular mode. There is also no need for separate mode setters.
This commit is contained in:
+7
-45
@@ -12,64 +12,26 @@ class LUMPDevice():
|
||||
"""
|
||||
pass
|
||||
|
||||
def read(self):
|
||||
"""Read latest values from the sensor.
|
||||
def read(self, mode):
|
||||
"""Read values from a given mode.
|
||||
|
||||
Arguments:
|
||||
mode (``int``): Device mode.
|
||||
|
||||
Returns:
|
||||
``tuple``: Values read from the sensor.
|
||||
"""
|
||||
pass
|
||||
|
||||
def write(self, values):
|
||||
def write(self, mode, values):
|
||||
"""Write values to the sensor.
|
||||
|
||||
Arguments:
|
||||
mode (``int``): Device mode.
|
||||
data (``tuple``): Values to be written.
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_mode(self):
|
||||
"""Get the currently active mode or combi-mode.
|
||||
|
||||
Returns:
|
||||
``tuple``: Values read from the sensor.
|
||||
"""
|
||||
pass
|
||||
|
||||
def set_mode(self, mode):
|
||||
"""Set the sensor to a given mode.
|
||||
|
||||
Arguments:
|
||||
mode (``int``): Mode index.
|
||||
"""
|
||||
pass
|
||||
|
||||
def set_combi_mode(self, todo1, todo2):
|
||||
"""Set the sensor to a given combi-mode.
|
||||
|
||||
TODO: Need to figure out how this works.
|
||||
|
||||
Arguments:
|
||||
TODO (``tuple``): TODO.
|
||||
"""
|
||||
pass
|
||||
|
||||
def format(self):
|
||||
"""Get the data type for the currently active mode.
|
||||
|
||||
Returns:
|
||||
``str``: Struct format specifier.
|
||||
"""
|
||||
pass
|
||||
|
||||
def id(self):
|
||||
"""Get the unique type ID for this device.
|
||||
|
||||
Returns:
|
||||
``int``: Device ID.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class AnalogSensor():
|
||||
"""Generic or custom analog sensor."""
|
||||
|
||||
Reference in New Issue
Block a user