romilly/quick2wire-python-api

unexport does not reset GPIO to initial state (only removes it from device list)

RandomDude4 opened this issue · 1 comments

Running this code results in the GPIO pin 11 still being set as OUTPUT and still being ON even after the unexport command:

Python code:
from quick2wire.gpio import Pin
Pin(11, "out")
Pin(11).value = 1
Pin(11).unexport()

Also using the unexport directly from shell with the command "gpio-admin unexport 11"
results in the same result.

Using any other GPIO library/driver that is available interprets this as GPIO pin nr 11 still being in use even though one has unexported the pin.

A partial solution is to manually set Pin 11 as an INPUT using command: "Pin(11, "in"), before using the unexport command, however this is not possible to implement together with the "with exported" statement in python.

The new GPIO API fixes this.