Circuits.GPIO v2.0

Circuits.GPIO lets you read and write to I/O pins on embedded hardware like that used by Nerves. The new v2.0 version makes it possible to support other platforms as well. This is a big update to v1.0 that is mostly backwards compatible but has many improvements that make it worth a look.

Here’s part of the ChangeLog to highlight other v2.0 updates:

  • Nerves and embedded Linux platforms now use the Linux GPIO character device API (cdev) which offers better performance, more functionality and fixes race conditions seen with the previous sysfs implementation

  • Circuits.GPIO.open/3 is much more flexible in how GPIOs are identified. Specifying GPIOs by number still works, but it’s now possible to specify GPIOs by string labels and by tuples that contain the GPIO controller name and index.

  • List out available GPIOs with Circuits.GPIO.enumerate/0. Other helper
    functions are available for getting more information about each GPIO too.

  • Specify pull modes on all hardware that supports them and not just Raspberry Pis

  • Easily do one-off reads and writes with Circuits.GPIO.read_one/2 and
    Circuits.GPIO.write_one/3

  • Must better timestamping of GPIO input events since the timestamps get applied when the kernel processes the event

  • Runtime diagnostics to help debug low level issues. See Circuits.GPIO.Diagnostics

Much more documentation and porting information is available in the hex docs.

Happy hardware hacking!

11 Likes