@@ -930,18 +930,17 @@ def list_motors(name_pattern=Motor.SYSTEM_DEVICE_NAME_CONVENTION, **kwargs):
930
930
931
931
Parameters:
932
932
name_pattern: pattern that device name should match.
933
- For example, 'sensor*' or ' motor*'. Default value: '*'.
933
+ For example, 'motor*'. Default value: '*'.
934
934
keyword arguments: used for matching the corresponding device
935
935
attributes. For example, driver_name='lego-ev3-l-motor', or
936
936
address=['outB', 'outC']. When argument value
937
937
is a list, then a match against any entry of the list is
938
938
enough.
939
939
"""
940
- classpath = abspath (Device .DEVICE_ROOT_PATH + '/' + Motor .SYSTEM_CLASS_NAME )
940
+ class_path = abspath (Device .DEVICE_ROOT_PATH + '/' + Motor .SYSTEM_CLASS_NAME )
941
941
942
942
return (Motor (name_pattern = name , name_exact = True )
943
- for name in list_device_names (classpath , name_pattern , ** kwargs ))
944
-
943
+ for name in list_device_names (class_path , name_pattern , ** kwargs ))
945
944
946
945
# ~autogen generic-class classes.largeMotor>currentClass
947
946
@@ -1769,6 +1768,24 @@ def bin_data(self, fmt=None):
1769
1768
1770
1769
return unpack (fmt , raw )
1771
1770
1771
+ def list_sensors (name_pattern = Sensor .SYSTEM_DEVICE_NAME_CONVENTION , ** kwargs ):
1772
+ """
1773
+ This is a generator function that enumerates all sensors that match the
1774
+ provided arguments.
1775
+
1776
+ Parameters:
1777
+ name_pattern: pattern that device name should match.
1778
+ For example, 'sensor*'. Default value: '*'.
1779
+ keyword arguments: used for matching the corresponding device
1780
+ attributes. For example, driver_name='lego-ev3-touch', or
1781
+ address=['in1', 'in3']. When argument value is a list,
1782
+ then a match against any entry of the list is enough.
1783
+ """
1784
+ class_path = abspath (Device .DEVICE_ROOT_PATH + '/' + Sensor .SYSTEM_CLASS_NAME )
1785
+ return (Sensor (name_pattern = name , name_exact = True )
1786
+ for name in list_device_names (class_path , name_pattern , ** kwargs ))
1787
+
1788
+
1772
1789
# ~autogen generic-class classes.i2cSensor>currentClass
1773
1790
1774
1791
class I2cSensor (Sensor ):
0 commit comments