Skip to content

Commit 2cd39b5

Browse files
Update README.md and add examples reference
1 parent 5641eb5 commit 2cd39b5

File tree

3 files changed

+97
-49
lines changed

3 files changed

+97
-49
lines changed

README.md

Lines changed: 80 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,77 @@
1-
Qwiic_Keypad_Py
2-
==============
1+
![Qwiic Keypad Python Package](docs/images/keypad-gh-banner-py.png "qwiic Keypad Python Package" )
32

4-
<p align="center">
5-
<img src="https://cdn.sparkfun.com/assets/custom_pages/2/7/2/qwiic-logo-registered.jpg" width=200>
6-
<img src="https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" width=240>
7-
</p>
8-
<p align="center">
9-
<a href="https://pypi.org/project/sparkfun-qwiic-keypad/" alt="Package">
10-
<img src="https://img.shields.io/pypi/pyversions/sparkfun_qwiic_keypad.svg" /></a>
11-
<a href="https://github.com/sparkfun/Qwiic_Keypad_Py/issues" alt="Issues">
12-
<img src="https://img.shields.io/github/issues/sparkfun/Qwiic_Keypad_Py.svg" /></a>
13-
<a href="https://qwiic-keypad-py.readthedocs.io/en/latest/?" alt="Documentation">
14-
<img src="https://readthedocs.org/projects/qwiic-keypad-py/badge/?version=latest&style=flat" /></a>
15-
<a href="https://github.com/sparkfun/Qwiic_Keypad_Py/blob/master/LICENSE" alt="License">
16-
<img src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
17-
<a href="https://twitter.com/intent/follow?screen_name=sparkfun">
18-
<img src="https://img.shields.io/twitter/follow/sparkfun.svg?style=social&logo=twitter"
19-
alt="follow on Twitter"></a>
20-
21-
</p>
3+
# SparkFun Qwiic Keypad - Python Package
224

23-
<img src="https://cdn.sparkfun.com//assets/parts/1/3/7/7/7/15290-SparkFun_Qwiic_Keypad_-_12_Button-01.jpg" align="right" width=300 alt="SparkFun Qwiic Keypad Breakout">
5+
![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_keypad)
6+
![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_keypad_py)
7+
![License](https://img.shields.io/github/license/sparkfun/qwiic_keypad_py)
8+
![X](https://img.shields.io/twitter/follow/sparkfun)
9+
[![API](https://img.shields.io/badge/API%20Reference-blue)](https://docs.sparkfun.com/qwiic_keypad_py/classqwiic__keypad_1_1_qwiic_keypad.html)
2410

25-
Python module for the qwiic keypad, which is part of the [SparkFun Qwiic Keypad - 12 Button](https://www.sparkfun.com/products/15290)
11+
The SparkFun Qwiic Keypad provides a simple and cost effective solution for adding button inputs to your project without tying up GPIO lines. Implementing a SparkFun Qwiic I2C interface, these sensors can be rapidly added to any project with boards that are part of the SparkFun Qwiic ecosystem.
12+
13+
This repository implements a Python package for the SparkFun Qwiic Keypad. This package works with Python, MicroPython and CircuitPython.
14+
15+
### Contents
16+
17+
* [About](#about-the-package)
18+
* [Getting Started](#getting-started)
19+
* [Installation](#installation)
20+
* [Supported Platforms](#supported-platforms)
21+
* [Documentation](https://docs.sparkfun.com/qwiic_keypad_py/classqwiic__keypad_1_1_qwiic_keypad.html)
22+
* [Examples](#examples)
2623

27-
This python package is a port of the existing [SparkFun Qwiic Keypad Arduino Library](https://github.com/sparkfun/SparkFun_Qwiic_Keypad_Arduino_Library)
24+
## About the Package
2825

29-
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
26+
This python package enables the user to access the features of the Keypad via a single Qwiic cable. This includes reading keypresses, time of press, and more. The capabilities of the Keypad are each demonstrated in the included examples.
3027

3128
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
3229

33-
## Contents
30+
### Supported SparkFun Products
3431

35-
* [Dependencies](#dependencies)
36-
* [Installation](#installation)
37-
* [Documentation](#documentation)
38-
* [Example Use](#example-use)
32+
This Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python.
33+
34+
* [SparkFun Qwiic Keypad - 12 Button](https://www.sparkfun.com/sparkfun-qwiic-keypad-12-button.html)
35+
36+
### Supported Platforms
37+
38+
| Python | Platform | Boards |
39+
|--|--|--|
40+
| Python | Linux | [Raspberry Pi](https://www.sparkfun.com/raspberry-pi-5-8gb.html) , [NVIDIA Jetson Orin Nano](https://www.sparkfun.com/nvidia-jetson-orin-nano-developer-kit.html) via the [SparkFun Qwiic SHIM](https://www.sparkfun.com/sparkfun-qwiic-shim-for-raspberry-pi.html) |
41+
| MicroPython | Raspberry Pi - RP2, ESP32 | [SparkFun RP2040 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2040.html), [SparkFun RP2350 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2350.html), [SparkFun ESP32 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-esp32-wroom-usb-c.html)
42+
|CircuitPython | Raspberry Pi - RP2, ESP32 | [SparkFun RP2040 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2040.html), [SparkFun RP2350 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2350.html), [SparkFun ESP32 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-esp32-wroom-usb-c.html)
43+
44+
> [!NOTE]
45+
> The listed supported platforms and boards are the primary platform targets tested. It is fully expected that this package will work across a wide variety of Python enabled systems.
46+
47+
## Installation
48+
49+
The first step to using this package is installing it on your system. The install method depends on the python platform. The following sections outline installation on Python, MicroPython and CircuitPython.
3950

40-
Dependencies
41-
---------------
42-
This driver package depends on the qwiic I2C driver:
43-
[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py)
51+
### Python
4452

45-
Documentation
46-
-------------
47-
The SparkFun qwiic Keypad module documentation is hosted at [ReadTheDocs](https://qwiic-keypad-py.readthedocs.io/en/latest/?)
53+
The package is primarily installed using the `pip` command, downloading the package from the Python Index - "PyPi". Note - the below instructions outline installation an Linux-based (Raspberry Pi) system.
4854

49-
Installation
50-
-------------
55+
#### PyPi Installation
5156

52-
### PyPi Installation
53-
This repository is hosted on PyPi as the [sparkfun-qwiic-keypad](https://pypi.org/project/sparkfun-qwiic-keypad/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
57+
The SparkFun Qwiic Keypad Python package is part of the overall SparkFun Qwiic Python package which is hosted on PyPi. On systems that support PyPi installation via pip, this library is installed using the following commands
5458

5559
For all users (note: the user must have sudo privileges):
5660
```sh
57-
sudo pip install sparkfun-qwiic-keypad
61+
sudo pip install sparkfun-qwiic
5862
```
5963
For the current user:
6064

6165
```sh
62-
pip install sparkfun-qwiic-keypad
66+
pip install sparkfun-qwiic
6367
```
64-
65-
### Local Installation
68+
---
69+
---
70+
> [!CAUTION]
71+
> **TODO** Put together how this works with the new virtual environments used with the latest Python install
72+
---
73+
---
74+
#### Local Installation
6675
To install, make sure the setuptools package is installed on the system.
6776

6877
Direct installation at the command line:
@@ -78,11 +87,34 @@ A package file is built and placed in a subdirectory called dist. This package f
7887
```sh
7988
cd dist
8089
pip install sparkfun_qwiic_keypad-<version>.tar.gz
81-
8290
```
91+
92+
### MicroPython Installation
93+
If not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.
94+
95+
Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
96+
```sh
97+
mpremote mip install github:sparkfun/qwiic_keypad_py
98+
```
99+
100+
### CircuitPython Installation
101+
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
102+
103+
Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
104+
```sh
105+
circup bundle-add sparkfun/Qwiic_Py
106+
```
107+
108+
Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
109+
```sh
110+
circup install --py qwiic_keypad
111+
```
112+
83113
Example Use
84114
---------------
85-
See the examples directory for more detailed use examples.
115+
Below is a quickstart program to print which button was pressed or a space if '*' is pressed and a newline if '#' is pressed.
116+
117+
See the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_keypad_py/blob/main/examples/README.md) for a summary of the available examples.
86118

87119
```python
88120
import qwiic_keypad
@@ -91,7 +123,7 @@ import sys
91123

92124
def runExample():
93125

94-
print("\nSparkFun qwiic Keypad Example 1\n")
126+
print("\nSparkFun qwiic Keypad Example 1\n")
95127
myKeypad = qwiic_keypad.QwiicKeypad()
96128

97129
if myKeypad.is_connected() == False:
@@ -130,6 +162,5 @@ def runExample():
130162
# Development in progress
131163
```
132164
<p align="center">
133-
<a href="https://www.sparkfun.com" alt="SparkFun">
134-
<img src="https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png" alt="SparkFun - Start Something"></a>
165+
<img src="https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png" alt="SparkFun - Start Something">
135166
</p>

docs/images/keypad-gh-banner-py.PNG

522 KB
Loading

examples/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Sparkfun Qwiic Keypad Examples Reference
2+
Below is a brief summary of each of the example programs included in this repository. To report a bug in any of these examples or to request a new feature or example [submit an issue in our GitHub issues.](https://github.com/sparkfun/qwiic_keypad_py/issues).
3+
4+
## Example 1: Basic Readings
5+
This example demonstrates basic bringup of the Qwiic Keypad to print which button was pressed or a space if '*' is pressed and a newline if '#' is pressed
6+
7+
The key methods showcased by this example are:
8+
- [update_fifo()](https://docs.sparkfun.com/qwiic_keypad_py/classqwiic__keypad_1_1_qwiic_keypad.html#a9029aec36abfb17315cf2747f43a33c1)
9+
- [get_button()](https://docs.sparkfun.com/qwiic_keypad_py/classqwiic__keypad_1_1_qwiic_keypad.html#a2803d3a99b6f92befb6a6459be6c65cf)
10+
11+
## Example 2: Button Press Time
12+
This example prints which button was pressed as well as the time of how long ago it was pressed.
13+
14+
The key method showcased by this example is [time_since_pressed()](https://docs.sparkfun.com/qwiic_keypad_py/classqwiic__keypad_1_1_qwiic_keypad.html#a58e82d1c12a242f7dfdcb57232365185)
15+
16+
## Example 3:
17+
This example waits for the user to input the correct 4 digit keycode and responds with a nice message on serial if they get it right. It demonstrates how to ignore startup noise and then check user input against a stored keycode.

0 commit comments

Comments
 (0)