pad4pi
An interrupt-based Python 2/3 library for reading matrix keypad key presses using Raspberry Pi GPIO pins.
pip install pad4pi
Tested on a Raspberry Pi B+ using a 4x3 matrix keypad but it should work with 4x4 and other sizes.
Usage
from pad4pi import rpi_gpio
KEYPAD = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
["*", 0, "#"]
]
ROW_PINS = [4, 14, 15, 17] # BCM numbering
COL_PINS = [18, 27, 22] # BCM numbering
factory = rpi_gpio.KeypadFactory()
# Try factory.create_4_by_3_keypad
# and factory.create_4_by_4_keypad for reasonable defaults
keypad = factory.create_keypad(keypad=KEYPAD, row_pins=ROW_PINS, col_pins=COL_PINS)
def printKey(key):
print(key)
# printKey will be called each time a keypad button is pressed
keypad.registerKeyPressHandler(printKey)
When your program exits, call keypad.cleanup() to ensure the Raspberry Pi’s GPIO pins are reset.
License
Licensed under GNU Lesser General Public License Version 3 (LGPL v3).
Metadata
Release files for pad4pi 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pad4pi-1.1.5.tar.gz | 3.4 kB | Without provenance | Details |
Release files / pad4pi-1.1.5.tar.gz
| Download URL | pad4pi-1.1.5.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa855896a1793d0005cf810ed5aa7aa639984cb83dc50cba51b4236b8badb764
|
|
BLAKE2b-256 checksum How to use checksums |
43156ab0fe51324f52db2cb28ee739e59c7d1525c578d17df17005a50e3631cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.14
|
Security for pad4pi 1.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.