Mock.GPIO icon indicating copy to clipboard operation
Mock.GPIO copied to clipboard

Support multiple channels in the setup function

Open gvigh opened this issue 3 years ago • 0 comments

Currently the Mock implementation of setup only allows one channel as it's first parameter.

According to the RPi.GPIO documentation, (and my own testing) the RPi.GPIO setup function supports the initialization of multiple channels with only one call:

chan_list = [11,12]    # add as many channels as you want!
                       # you can tuples instead i.e.:
                       #   chan_list = (11,12)
GPIO.setup(chan_list, GPIO.OUT)

taken from the 'Setup more than one channel' section in the linked docs

This should also work when providing an initial value:

GPIO.setup([11, 12], GPIO.OUT, initial=GPIO.LOW)

Since one of the goals of this project is to make the switching between the two modules seamless, I would recommend fixing this small difference :)

gvigh avatar May 14 '22 21:05 gvigh