Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => iMX233 => Topic started by: flipflops on February 14, 2013, 03:45:55 AM

Title: GPIO metrics?
Post by: flipflops on February 14, 2013, 03:45:55 AM
Does Linux have easy access to the resistance on GPIO pins?

I need to detect the open/closed state of contact switches (doorbell, float, etc) attached to GPIOs.

I assume the best way is to set the GPIO pin type to output and set the pin logic to 1 so it sends 3.3v to the switch mechanism (which returns to ground) and monitor the resistance at the pin to see when it changes from high to low resistance to detect the mechanism closing the circuit.

Is there a documented way to see the resistance of a GPIO pin from the Linux OS?

Thanks
Title: Re: GPIO metrics?
Post by: flipflops on February 14, 2013, 04:32:37 AM
or if going the GPIO input route, does this MC have integrated pull-up/down resistors and any related documentation?
Title: Re: GPIO metrics?
Post by: flipflops on February 14, 2013, 08:53:22 AM
Let me clarify, if I set pin x to input direction, is the pin state floating, high, or low? and can I enable integrated pull-up/down resistors on the pin to set the default input state to high or low?

I see that there is an "active_low" file in /sys/class/gpio/gpioX/ with a value of 0 but I cant find any supporting documentation.

Any help is appreciated.

Thank you