File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -107,19 +107,20 @@ def output_pins(self, pins):
107
107
self .write_gpio ()
108
108
109
109
110
- def input (self , pin ):
110
+ def input (self , pin , read = True ):
111
111
"""Read the specified pin and return HIGH/True if the pin is pulled
112
112
high, or LOW/False if pulled low.
113
113
"""
114
- return self .input_pins ([pin ])[0 ]
114
+ return self .input_pins ([pin ], read )[0 ]
115
115
116
- def input_pins (self , pins ):
116
+ def input_pins (self , pins , read = True ):
117
117
"""Read multiple pins specified in the given list and return list of pin values
118
118
HIGH/True if the pin is pulled high, or LOW/False if pulled low.
119
119
"""
120
120
[self ._validate_pin (pin ) for pin in pins ]
121
- # Get GPIO state.
122
- self .read_gpio ()
121
+ if read :
122
+ # Get GPIO state.
123
+ self .read_gpio ()
123
124
# Return True if pin's bit is set.
124
125
return [(self .gpio [int (pin / 8 )] & 1 << (int (pin % 8 ))) > 0 for pin in pins ]
125
126
You can’t perform that action at this time.
0 commit comments