@@ -45,7 +45,7 @@ def __init__(self, seesaw, pin):
4545 self ._seesaw = seesaw
4646 self ._pin = pin
4747 self ._drive_mode = digitalio .DriveMode .PUSH_PULL
48- self ._direction = False
48+ self ._direction = digitalio . Direction . INPUT
4949 self ._pull = None
5050 self ._value = False
5151
@@ -62,8 +62,8 @@ def switch_to_output(self, value=False, drive_mode=digitalio.DriveMode.PUSH_PULL
6262 def switch_to_input (self , pull = None ):
6363 """Switch the pin to input mode"""
6464 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 :
6767 self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT_PULLUP )
6868 else :
6969 self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT )
@@ -117,8 +117,8 @@ def pull(self, mode):
117117 if self ._direction == digitalio .Direction .OUTPUT :
118118 raise AttributeError ("cannot set pull on an output pin" )
119119 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 :
122122 self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT_PULLUP )
123123 elif mode is None :
124124 self ._seesaw .pin_mode (self ._pin , self ._seesaw .INPUT )
0 commit comments