Rust bindings for the rppal crate to manage GPIO pins on a Raspberry Pi.
Project description
Description
- These are rust binding around the RPPAL - Raspberry Pi Peripheral Access Library crate that gives access to gpio, pwm, spi, and more. As of current, the only provided bindings are for the gpio library. Support for the other functions may come later on.
- These bindings allow you to call the rust code from python in a way that looks like any other python object
Features
- Able to make multiple objects that can call the gpio without generating errors
- Support for event driven io using callbacks
- Supports software pwm
- Allows for setting up pins as input or output
- Works with multiple platforms
Usage
- To use you need to first create a GPIOManager object, this can be done by calling
manager = gpio_manager.GPIOManager()
. - To set up a pin as input with the pull-up resistor enabled on the pin
manager.add_input_pin(BUTTON_PIN, gpio_manager.IPinState.PULLUP)
. - To set up a pin as output run
manager.add_output_pin(LED_PIN)
. - To set an output pin to the low state run
manager.set_output_pin(LED_PIN, gpio_manager.OPinState.LOW)
. - To assign a callback to an input pin
manager.assign_callback(BUTTON_PIN, gpio_manager.TriggerEdge.FALLING, button_callback)
. - To wait on an input pin to trigger an edge
manager.wait_for_edge(BUTTON_PIN, gpio_manager.TriggerEdge.FALLING)
. - To set pwm on an output pin run
manager.set_pwm(PWM_PIN, PERIOD_MS, PULSE_WIDTH_US)
. - To reset a pin to its default state run
manager.reset_pin(PIN)
. - To set all outputs to low and clear all interrupts run
manager.cleanup()
.
Warranty
- This library is provided as is and is not guaranteed to work in all cases.
Coming Soon
- Support for UART
- support for SPI
- Support for hardware PWM
- Support for I2C
- Documentation on readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for gpio_manager-1.1.4-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e7e412278391e48a1bec4dc1a09d95a74b024075d184fb31f388ae4dcb81e34 |
|
MD5 | a5871aa5fc40720798ca6ddc14170831 |
|
BLAKE2b-256 | 7e59f8091b87969991c93409c652a72b32dc4693fce9af299725aa0e89abdcee |