0

The GPIO ports can be accessed using sysfs interface located in /sys/class/gpio. However, I failed to found more detailed documentation, most of which only describes plain read/write operation.

What I specifically interested are:

  • When a GPIO port is configured as input, how to monitor its edge interrupt?
  • Actually, I even don't know how to configure a port to be triggering edge interrupts, via the sysfs interface.
  • Does the sysfs interface capable to switch GPIO ports into alternative modes?
1

The sysfs kernel interface to the GPIO has limited capability.

See https://www.kernel.org/doc/Documentation/gpio/sysfs.txt for details.

Broadly speaking you can set a GPIO to be an input or an output. For an output you can set the level high or low. For an input you can read the level and request to be interrupted at a particular edge transition.

You would use such C language calls as poll to respond to kernel GPIO interrupts.

man poll

You can not use the sysfs interface to set a GPIO to a mode other than input or output.

1

However, I failed to found more detailed documentation, most of which only describes plain read/write operation.

I believes your problem is with unavailability of detailed documentation. Please read Mastering the Raspberry Pi written by Warren Gay(Appress Publication Technology in Action-TIA series). In this book it is clarified. I believes this book is available in Internet. Sorry if you feel it just a comment. I have no enough reputation to comment under your post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.