Skip to main content

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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GPIO_Calculator-1.0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file GPIO-Calculator-1.0.2.tar.gz.

File metadata

  • Download URL: GPIO-Calculator-1.0.2.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

File hashes

Hashes for GPIO-Calculator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 560f86e3f316970fc2f1c2392310b1116af1d9c2b510214eba70a778d336ad1a
MD5 f5acd1fa9918d7a29c19b9b99cbf6974
BLAKE2b-256 1f942cbd06a3f3f90c1b22b07312115479071bfdcb5eb12d6ac579c4434c152f

See more details on using hashes here.

File details

Details for the file GPIO_Calculator-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: GPIO_Calculator-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

File hashes

Hashes for GPIO_Calculator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 856e0ffdb656826e2e2dbdc24ebec0d64f1ee48dff382f1c2cb33afae1cc3b58
MD5 671ba8117ecfda29078b1b7ce6600bc4
BLAKE2b-256 35305d3bc118131a7d09adbae3e874a3b57ccb8ba6c1586f5ff966f9141b0acc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page