@@ -45,7 +45,7 @@ def __init__(self, seesaw, pin):
45
45
self ._seesaw = seesaw
46
46
self ._pin = pin
47
47
self ._drive_mode = digitalio .DriveMode .PUSH_PULL
48
- self ._direction = False
48
+ self ._direction = digitalio . Direction . INPUT
49
49
self ._pull = None
50
50
self ._value = False
51
51
@@ -62,8 +62,8 @@ def switch_to_output(self, value=False, drive_mode=digitalio.DriveMode.PUSH_PULL
62
62
def switch_to_input (self , pull = None ):
63
63
"""Switch the pin to input mode"""
64
64
if pull == digitalio .Pull .DOWN :
65
- raise ValueError ( "Pull Down currently not supported" )
66
- if pull == digitalio .Pull .UP :
65
+ self . _seesaw . pin_mode ( self . _pin , self . _seesaw . INPUT_PULLDOWN )
66
+ elif pull == digitalio .Pull .UP :
67
67
self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT_PULLUP )
68
68
else :
69
69
self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT )
@@ -117,8 +117,8 @@ def pull(self, mode):
117
117
if self ._direction == digitalio .Direction .OUTPUT :
118
118
raise AttributeError ("cannot set pull on an output pin" )
119
119
if mode == digitalio .Pull .DOWN :
120
- raise ValueError ( "Pull Down currently not supported" )
121
- if mode == digitalio .Pull .UP :
120
+ self . _seesaw . pin_mode ( self . _pin , self . _seesaw . INPUT_PULLDOWN )
121
+ elif mode == digitalio .Pull .UP :
122
122
self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT_PULLUP )
123
123
elif mode is None :
124
124
self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT )
0 commit comments