File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,18 @@ def input(self, pin):
100
100
"""Read the specified pin and return GPIO.HIGH/True if the pin is pulled
101
101
high, or GPIO.LOW/False if pulled low.
102
102
"""
103
- self ._validate_pin (pin )
103
+ return self .input_pins ([pin ])[0 ]
104
+
105
+ def input_pins (self , pins ):
106
+ """Read multiple pins specified in the given list and return list of pin values
107
+ GPIO.HIGH/True if the pin is pulled high, or GPIO.LOW/False if pulled low.
108
+ """
109
+ for pin in pins :
110
+ self ._validate_pin (pin )
104
111
# Get GPIO state.
105
112
gpio = self ._device .readList (self .GPIO , self .gpio_bytes )
106
113
# Return True if pin's bit is set.
107
- return (gpio [int (pin / 8 )] & 1 << (int (pin % 8 ))) > 0
114
+ return [ (gpio [int (pin / 8 )] & 1 << (int (pin % 8 ))) > 0 for pin in pins ]
108
115
109
116
def pullup (self , pin , enabled ):
110
117
"""Turn on the pull-up resistor for the specified pin if enabled is True,
You can’t perform that action at this time.
0 commit comments