Closed clhey closed 9 years ago
No, there is no function returning the configured mode of a pin. Why would you want that kind of function ? You are supposed to know the mode since you are configuring it at your program start.
Because i want create a restful api like webiopi.
The python module RPi.GPIO supply a api to read the pin mode:
func = GPIO.gpio_function(pin)
The function getAlt gives the mode of a pin: 0 = input, 1 = output, 4 = alt0, 5 = alt1, 6 = alt2, 7 = alt3, 3 = alt4 & 2 = alt5.
There is a core function to set the pin mode named pinMode(pin,mode), but how can i get the pin mode(OUT or IN)?