File tree Expand file tree Collapse file tree 4 files changed +11
-3
lines changed Expand file tree Collapse file tree 4 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -642,16 +642,19 @@ def _get_params(self):
642
642
return {
643
643
"host" : self .host ,
644
644
"index" : self .local .index ,
645
+ "invert" : self .local .invert ,
645
646
}
646
647
647
648
def _get_start_params (self ):
648
649
return {
649
650
"index" : self .local .index ,
651
+ "invert" : self .local .invert ,
650
652
}
651
653
652
654
def _start (self , start_params ):
653
655
"""Start a GPIO export to userspace"""
654
656
index = start_params ["index" ]
657
+ invert = start_params ["invert" ]
655
658
656
659
if self .export_path .exists ():
657
660
self .system_exported = True
@@ -672,7 +675,6 @@ def _stop(self, start_params):
672
675
with open (export_sysfs_path , mode = "wb" ) as unexport :
673
676
unexport .write (str (index ).encode ("utf-8" ))
674
677
675
-
676
678
exports ["SysfsGPIO" ] = GPIOSysFSExport
677
679
exports ["MatchedSysfsGPIO" ] = GPIOSysFSExport
678
680
Original file line number Diff line number Diff line change @@ -42,5 +42,7 @@ class SysfsGPIO(Resource):
42
42
"""The basic SysfsGPIO contains an index
43
43
44
44
Args:
45
- index (int): index of target gpio line."""
45
+ index (int): index of target gpio line.
46
+ invert (bool) : optional, whether the logic level is inverted (active-low)"""
46
47
index = attr .ib (default = None , validator = attr .validators .instance_of (int ))
48
+ invert = attr .ib (default = False , validator = attr .validators .instance_of (bool ))
Original file line number Diff line number Diff line change @@ -339,7 +339,9 @@ class NetworkSysfsGPIO(NetworkResource, ManagedResource):
339
339
manager_cls = RemotePlaceManager
340
340
341
341
"""The NetworkSysfsGPIO describes a remotely accessible gpio line"""
342
+
342
343
index = attr .ib (validator = attr .validators .optional (attr .validators .instance_of (int )))
344
+ invert = attr .ib (default = False , validator = attr .validators .instance_of (bool ))
343
345
def __attrs_post_init__ (self ):
344
346
self .timeout = 10.0
345
347
super ().__attrs_post_init__ ()
Original file line number Diff line number Diff line change @@ -758,8 +758,10 @@ class MatchedSysfsGPIO(USBResource):
758
758
"""The MatchedSysfsGPIO described a SysfsGPIO matched by Udev
759
759
760
760
Args:
761
- pin (int): gpio pin number within the matched gpiochip."""
761
+ pin (int): gpio pin number within the matched gpiochip.
762
+ invert (bool): optional, whether the logic level is inverted (active-low)"""
762
763
pin = attr .ib (default = None , validator = attr .validators .instance_of (int ))
764
+ invert = attr .ib (default = False , validator = attr .validators .instance_of (bool ))
763
765
index = None
764
766
765
767
def __attrs_post_init__ (self ):
You can’t perform that action at this time.
0 commit comments