All Projects → rust-embedded → Gpio Utils

rust-embedded / Gpio Utils

Licence: other
Userspace Utilities for managing GPIOs in Linux

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Gpio Utils

gpio-cdev
Rust interface to the Linux GPIO Character Device API (/dev/gpiochip...)
Stars: ✭ 153 (+86.59%)
Mutual labels:  embedded, gpio
Drivers
TinyGo drivers for sensors and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
Stars: ✭ 250 (+204.88%)
Mutual labels:  gpio, embedded
Homegenie
HomeGenie, the open source, programmable, home automation server for smart connected devices and applications
Stars: ✭ 313 (+281.71%)
Mutual labels:  gpio, embedded
w1-gpio-cl
Command line configured kernel mode 1-wire bus master driver. w1-gpio standard Linux module enhancement/substitution.
Stars: ✭ 17 (-79.27%)
Mutual labels:  embedded, gpio
Rust Sysfs Gpio
A Rust Interface to the Linux sysfs GPIO interface (https://www.kernel.org/doc/Documentation/gpio/sysfs.txt)
Stars: ✭ 320 (+290.24%)
Mutual labels:  gpio, embedded
Blinker Library
An IoT Solution,Blinker library for embedded hardware. Works with Arduino, ESP8266, ESP32.
Stars: ✭ 1,095 (+1235.37%)
Mutual labels:  embedded
Swiftygpio
A Swift library for hardware projects on Linux/ARM boards with support for GPIOs/SPI/I2C/PWM/UART/1Wire.
Stars: ✭ 1,188 (+1348.78%)
Mutual labels:  gpio
Pocket Tensor
Run Keras models from a C++ application on embedded devices
Stars: ✭ 65 (-20.73%)
Mutual labels:  embedded
Incubator Nuttx Apps
Apache NuttX Apps is a collection of tools, shells, network utilities, libraries, interpreters and can be used with the NuttX RTOS
Stars: ✭ 65 (-20.73%)
Mutual labels:  embedded
Ring Buffer
simple C++11 ring buffer implementation, allocated and evaluated at compile time
Stars: ✭ 80 (-2.44%)
Mutual labels:  embedded
Bitbox
The bitbox console (example, firmwares, doc)
Stars: ✭ 78 (-4.88%)
Mutual labels:  embedded
Serial Studio
Multi-purpose serial data visualization & processing program
Stars: ✭ 1,168 (+1324.39%)
Mutual labels:  embedded
Lwmqtt
a light weight MQTT implementation
Stars: ✭ 67 (-18.29%)
Mutual labels:  embedded
Ejdb
🏂 EJDB 2.0 — Embeddable JSON Database engine C library. Simple XPath like query language (JQL). Websockets / Android / iOS / React Native / Flutter / Java / Dart / Node.js bindings. Docker image.
Stars: ✭ 1,187 (+1347.56%)
Mutual labels:  embedded
Go Hardware
A directory of hardware related libs, tools, and tutorials for Go
Stars: ✭ 1,137 (+1286.59%)
Mutual labels:  embedded
Mraa
Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
Stars: ✭ 1,220 (+1387.8%)
Mutual labels:  gpio
Stm32l4xx Hal
A Hardware abstraction layer for the stm32l432xx series chips written in rust.
Stars: ✭ 65 (-20.73%)
Mutual labels:  embedded
Daplink
Stars: ✭ 1,162 (+1317.07%)
Mutual labels:  embedded
Azure Sdk For C
This repository is for active development of the Azure SDK for Embedded C. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-c.
Stars: ✭ 77 (-6.1%)
Mutual labels:  embedded
Merecat
Small and made-easy HTTP/HTTPS server based on Jef Poskanzer's thttpd
Stars: ✭ 69 (-15.85%)
Mutual labels:  embedded

Linux GPIO Utils

Build Status Version License

GPIO Utils provides convenient access to GPIOs on a Linux system. The library builds on top of the sysfs interface to GPIOs exposed by the kernel and provides essential functionality required for most embedded systems.

Install

To install the latest released version of gpio utils, ensure that you have installed Rust and then run:

cargo install gpio-utils

Features

  • [x] Infrastructure for providing names for the GPIOs in one's system providing names that map to individual pins. These names (in addition to GPIO numbers) may be used with other commands.
  • [x] Ability to export/unexport GPIOs and expose symlinks using the GPIO "friendly" names simpler.
  • [x] Ability to set input/output state on each pin
  • [x] Ability to set active low state on each pin
  • [x] Ability to get/set gpio values by pin number or name (including temporary export if necessary)
  • [x] Ability to block awaiting pin state change (with timeout)
  • [x] Ability to set exported GPIO permissions

System Integration

GPIO Utils provides two main pieces that one may integrate into their final system:

  1. The gpio command. This provides the core functionality for GPIO Utils and is useful in its own right.
  2. The gpio init script/systemd service. This can be integrated into a target system and will ensure that configured GPIOs get exported on system startup (The GPIO command searches for /etc/gpio.toml and /etc/gpio.d/*.toml configs)

The GPIO Utils library is built on top of the Rust sysfs-gpio library which may be used independent of this project.

GPIO Configuration File

GPIO Utils uses the TOML. There is some flexibility in the configuration, but the following examples shows the basics of how you can configure your GPIOs.

#
# Example GPIO configuration (e.g. /etc/gpio.toml)
#
# The main configuration consists of zero or more pins, each of which may have
# the following keys:
#
# - `num`: Required.  The GPIO number.
# - `names`: Required.  One or more names for the GPIO
# - `direction`: Default: `"in"`.  Must be either "in" or "out"
# - `active_low`: Default: `false`.  If set to true, the polarity of the pin will
#    be reversed.
# - `export`: Default: `true`.  If true, this GPIO will be automatically
#    exported when `gpio export-all` is run (e.g. by an init script).
# - `user`: User that should own the exported GPIO
# - `group`: Group that should own the exported GPIO
# - `mode`: Mode for exported directory

[[pins]]
num = 73                 # required
names = ["reset_button"] # required (may have multiple)
direction = "in"         # default: in
active_low = false       # default: false (really means invert logic)
export = true            # default: true
user = "root"            # default: (OS Default - root)
group = "gpio"           # default: (OS Default - root)
mode = 0o664             # default: (OS Default - 0o644)

[[pins]]
num = 37
names = ["status_led", "A27", "green_led"]
direction = "out"

# ...

Implementation Notes

Unlike several other existing solutions to this problem, this project is implemented in Rust (a modern systems programming language operating at the same level as C but with a type system providing greater productivity and reliability) and seeks to operate with a minimum of overhead.

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.26.2 and up. It might compile with older versions but that may change in any new patch release.

Contributing

Contributions are very welcome. See CONTRIBUTING.md for additional information on how to report bugs, submit changes, test changes, get support, etc.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the Embedded Linux Team, promises to intervene to uphold that code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].