WiringPi / WiringPi-Node

Node.js bindings to wiringPi
334 stars 94 forks source link

how can i read the pin mode #16

Closed clhey closed 9 years ago

clhey commented 9 years ago

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

nekuz0r commented 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.

clhey commented 9 years ago

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)

dirkels commented 9 years ago

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.