Skip to content

Commit 4efb124

Browse files
author
Adam Patt
committed
adafruit#10 - pass any submitted parameters supported by the underlying call
1 parent 549c6e4 commit 4efb124

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

simpleio.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,12 @@ class DigitalOut:
230230
"""
231231
Simple digital output that is valid until soft reset.
232232
"""
233-
def __init__(self, pin):
233+
def __init__(self, pin, value=None, drive_mode=None):
234+
"""
235+
"""
236+
kwargs = {k: v for k, v in (('value', value), ('drive_mode', drive_mode)) if not v is None}
234237
self.iopin = digitalio.DigitalInOut(pin)
235-
self.iopin.switch_to_output()
238+
self.iopin.switch_to_output(**kwargs)
236239

237240
@property
238241
def value(self):
@@ -247,9 +250,10 @@ class DigitalIn:
247250
"""
248251
Simple digital input that is valid until soft reset.
249252
"""
250-
def __init__(self, pin):
253+
def __init__(self, pin, pull=None):
254+
kwargs = {k: v for k, v in (('pull', pull),) if not v is None}
251255
self.iopin = digitalio.DigitalInOut(pin)
252-
self.iopin.switch_to_input()
256+
self.iopin.switch_to_input(**kwargs)
253257

254258
@property
255259
def value(self):

0 commit comments

Comments
 (0)