codenio / Mock.GPIO

Mock Library for RPI.GPIO python Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support multiple channels in the setup function

gvigh opened this issue · comments

commented

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 :)