How Do I Write a Gpio Driver in Linux?

How Do I Write a Gpio Driver in Linux?
Contents

What is GPIO driver?

A GPIO controller driver is a KMDF driver that manages all hardware-specific operations for a GPIO controller. … GPIO pins can be configured as data inputs, data outputs, or interrupt request inputs. Typically, a GPIO pin is dedicated to a peripheral device, and not shared by two or more devices.

How do I access Gpio on Linux?

The basic steps to use a GPIO pin from the sysfs interface are the following:

  1. Export the pin.
  2. Set the pin direction (input or output).
  3. If an output pin, set the level to low or high.
  4. If an input pin, read the pin’s level (low or high).
  5. When done, unexport the pin.

10 июл. 2019 г.

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.