Simple GPIO calculator for libgpiod based on its chardev.
Project description
Simple GPIO calculator for libgpiod based on its chardev using the formula chardev = (alphabet_index - 1) * 32 + pin which is also used on sysfs.
Installation
pip install git+https://github.com/yeyeto2788/GPIO_Calculator
Usage
from gpio_calculator import Calculator
calculator = Calculator()
# Get chardev based on pin letter and pin number.
# Return should be 242
calculator.get_chardev("H", 18)
# Get chardev from list.
# Returns a list of converted items [242, 243, 244].
calculator.get_chardevs(["H18", "H19", "H20"])
# Get pin from chardev.
# Returns the pin number H18.
calculator.get_pin(242)
# Get all pins from chardevs.
# Returns all pins found H18, H19, H20.
calculator.get_pins([242, 243, 244])
Contributing
All contributions, pull requests and comments are welcome!
When contributing it is important to test the module in order to make sure everything is working as expected. For that install dependencies to run the tests.
pip install pytest pytest-cov mock pylint
Running tests and see coverage.
py.test --cov -v --cov-config=.coveragerc --cov-report=html
This will generate a report with the coverage which is at 98% now, let’s try to keep it at the same percentage.
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 Distribution
GPIO-Calculator-1.0.2.tar.gz
(10.0 kB
view hashes)
Built Distribution
Close
Hashes for GPIO_Calculator-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 856e0ffdb656826e2e2dbdc24ebec0d64f1ee48dff382f1c2cb33afae1cc3b58 |
|
MD5 | 671ba8117ecfda29078b1b7ce6600bc4 |
|
BLAKE2b-256 | 35305d3bc118131a7d09adbae3e874a3b57ccb8ba6c1586f5ff966f9141b0acc |