|
@@ -38,7 +38,7 @@ _pins_for_cleanup = set()
|
|
|
# respond(ERROR_TAKES_ARGUMENTS.format(
|
|
|
# command, "one", "positional", "<name>"))
|
|
|
|
|
|
-# def _parse_to_int_list(parse):
|
|
|
+# def gpio.parse_to_int_list(parse):
|
|
|
# if type(parse) is list:
|
|
|
# return parse
|
|
|
# elif type(parse) is int:
|
|
@@ -59,7 +59,7 @@ _pins_for_cleanup = set()
|
|
|
#
|
|
|
# def _setup()
|
|
|
#
|
|
|
-# def _output(pins,state):
|
|
|
+# def gpio.output(pins,state):
|
|
|
# lgpio.debug("setting pin(s) {:0>2} to value {}".format(
|
|
|
# pins,state))
|
|
|
# if type(pins) is int:
|
|
@@ -67,7 +67,7 @@ _pins_for_cleanup = set()
|
|
|
# _pins_for_cleanup.update(pins)
|
|
|
# gpio.output(pins,state)
|
|
|
#
|
|
|
-# def _read(self,pin):
|
|
|
+# def gpio.read(self,pin):
|
|
|
# state = gpio.read(pin)
|
|
|
# lgpio.debug("reading pin {}: {}".format(
|
|
|
# pin,state))
|
|
@@ -139,7 +139,7 @@ class GPIOWrapper(object):
|
|
|
self.IN = getattr(self.gpio,"IN",self.IN)
|
|
|
# self.BCM = getattr(self.gpio,self.BCM)
|
|
|
|
|
|
- def _output(pins,state,*args):
|
|
|
+ def output(pins,state,*args):
|
|
|
lgpio.debug("setting pin(s) {:0>2} to value {}".format(
|
|
|
pins,state))
|
|
|
if type(pins) is int:
|
|
@@ -148,7 +148,7 @@ class GPIOWrapper(object):
|
|
|
if self.gpio:
|
|
|
self.gpio.output(pins,state)
|
|
|
|
|
|
- def _parse_to_int_list(parse,*args):
|
|
|
+ def parse_to_int_list(parse,*args):
|
|
|
if type(parse) is list:
|
|
|
return parse
|
|
|
elif type(parse) is int:
|
|
@@ -167,7 +167,7 @@ class GPIOWrapper(object):
|
|
|
parse.append(int(part))
|
|
|
return parse
|
|
|
|
|
|
- def _read(self,pin,*args):
|
|
|
+ def read(self,pin,*args):
|
|
|
if self.gpio:
|
|
|
state = self.gpio.read(pin)
|
|
|
else:
|
|
@@ -191,12 +191,12 @@ class PinBase(object):
|
|
|
self.value = self.value_low
|
|
|
|
|
|
def output(self,value):
|
|
|
- [value] = _parse_to_int_list(value)
|
|
|
+ [value] = gpio.parse_to_int_list(value)
|
|
|
self.value = value
|
|
|
- _output(self.pin_number,value)
|
|
|
+ gpio.output(self.pin_number,value)
|
|
|
|
|
|
def read(self):
|
|
|
- value = _read(self.pin_number,value)
|
|
|
+ value = gpio.read(self.pin_number,value)
|
|
|
return value
|
|
|
|
|
|
class DigitalPin(PinBase):
|
|
@@ -375,17 +375,17 @@ class DebugPinController(PinControllerBase):
|
|
|
respond(ERROR_TAKES_ARGUMENTS.format(
|
|
|
command, "two", "positional", "<name>"))
|
|
|
return False
|
|
|
- pins = _parse_to_int_list(args[0])
|
|
|
- [state] = _parse_to_int_list(args[1])
|
|
|
- _output(pins,state)
|
|
|
+ pins = gpio.parse_to_int_list(args[0])
|
|
|
+ [state] = gpio.parse_to_int_list(args[1])
|
|
|
+ gpio.output(pins,state)
|
|
|
def output(self,args=[],command=None,respond=None):
|
|
|
if len(args) != 2:
|
|
|
respond(ERROR_TAKES_ARGUMENTS.format(
|
|
|
command, "two", "positional", "<name>"))
|
|
|
return False
|
|
|
- pins = _parse_to_int_list(args[0])
|
|
|
- [state] = _parse_to_int_list(args[1])
|
|
|
- return _read(pins,state)
|
|
|
+ pins = gpio.parse_to_int_list(args[0])
|
|
|
+ [state] = gpio.parse_to_int_list(args[1])
|
|
|
+ return gpio.read(pins,state)
|
|
|
|
|
|
gpio = GPIOWrapper()
|
|
|
|