Skip to content

Commit 3676a50

Browse files
Autogenerated. Convert PyPi packaging and add Readme Updates
1 parent e49e9de commit 3676a50

File tree

6 files changed

+152
-177
lines changed

6 files changed

+152
-177
lines changed

README.md

Lines changed: 94 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,116 @@
1-
Qwiic_9DoF_IMU_ICM20948_Py
2-
==============
1+
![Qwiic 9DOF - Python Package](docs/images/gh-banner.png "qwiic 9DOF 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-icm20948/" alt="Package">
10-
<img src="https://img.shields.io/pypi/pyversions/sparkfun_qwiic_icm20948.svg" /></a>
11-
<a href="https://github.com/sparkfun/Qwiic_9DoF_IMU_ICM20948_Py/issues" alt="Issues">
12-
<img src="https://img.shields.io/github/issues/sparkfun/Qwiic_9DoF_IMU_ICM20948_Py.svg" /></a>
13-
<a href="https://qwiic-9dof-imu-icm20948-py.readthedocs.io/en/latest/?" alt="Documentation">
14-
<img src="https://readthedocs.org/projects/qwiic-9dof-imu-icm20948-py/badge/?version=latest&style=flat" /></a>
15-
<a href="https://github.com/sparkfun/Qwiic_9DoF_IMU_ICM20948_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 9DOF - Python Package
4+
5+
![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_9dof_imu_icm20948)
6+
![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_9dof_imu_icm20948_py)
7+
![License](https://img.shields.io/github/license/sparkfun/qwiic_9dof_imu_icm20948_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_9dof_imu_icm20948_py/classqwiic__icm20948_1_1_qwiic_icm20948.html)
2210

23-
<img src="https://cdn.sparkfun.com//assets/parts/1/3/8/6/0/15335-SparkFun_9DoF_IMU_Breakout_-_ICM-20948__Qwiic_-01b.jpg" align="right" width=300 alt="SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)">
11+
The SparkFun Qwiic 9 Degrees of Freedom IMU 9DOF Module provides a simple and cost effective solution for adding 9 Degrees of Freedom IMU capabilities to your project. 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.
2412

25-
Python module for the qwiic ICM-20948 sensor, which is included on the [SparkFun 9DoF IMU Breakout - ICM-20948 (Qwiic)](https://www.sparkfun.com/products/15335)
13+
This repository implements a Python package for the SparkFun Qwiic 9DOF. 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_9dof_imu_icm20948_py/classqwiic__icm20948_1_1_qwiic_icm20948.html)
22+
* [Examples](#examples)
2623

27-
This python package is a port of the existing [SparkFun ICM-20948 Arduino Library](https://github.com/sparkfun/SparkFun_ICM-20948_ArduinoLibrary)
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 9DOF via a single Qwiic cable. This includes <reading acceleration, reading gyroscope, reading magnetometer, reading temperature> and more. The capabilities of the 9DOF 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-
* [Supported Platforms](#supported-platforms)
36-
* [Dependencies](#dependencies)
37-
* [Installation](#installation)
38-
* [Documentation](#documentation)
39-
* [Example Use](#example-use)
32+
This Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python.
33+
34+
* [SparkFun 9 Degrees of Freedom IMU Sensor - 9DOF](https://www.sparkfun.com/products/15318)
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)
4043

41-
Supported Platforms
42-
--------------------
43-
The qwiic ICM20948 Python package current supports the following platforms:
44-
* [Raspberry Pi](https://www.sparkfun.com/search/results?term=raspberry+pi)
45-
* [NVidia Jetson Nano](https://www.sparkfun.com/products/15297)
46-
* [Google Coral Development Board](https://www.sparkfun.com/products/15318)
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.
4746
48-
Dependencies
49-
---------------
50-
This driver package depends on the qwiic I2C driver:
51-
[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py)
47+
## Installation
5248

53-
Documentation
54-
-------------
55-
The SparkFun qwiic ICM20948 module documentation is hosted at [ReadTheDocs](https://qwiic-9dof-imu-icm20948-py.readthedocs.io/en/latest/?)
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.
5650

57-
Installation
58-
-------------
51+
### Python
5952

60-
### PyPi Installation
61-
This repository is hosted on PyPi as the [sparkfun-qwiic-icm20948](https://pypi.org/project/sparkfun-qwiic-icm20948/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
53+
#### PyPi Installation
6254

63-
For all users (note: the user must have sudo privileges):
55+
The package is primarily installed using the `pip3` command, downloading the package from the Python Index - "PyPi".
56+
57+
Note - the below instructions outline installation on a Linux-based (Raspberry Pi) system.
58+
59+
First, setup a virtual environment from a specific directory using venv:
6460
```sh
65-
sudo pip install sparkfun-qwiic-icm20948
61+
python3 -m venv path/to/venv
6662
```
67-
For the current user:
63+
You can pass any path as path/to/venv, just make sure you use the same one for all future steps. For more information on venv [click here](https://docs.python.org/3/library/venv.html).
6864

65+
Next, install the qwiic package with:
66+
```sh
67+
path/to/venv/bin/pip3 install sparkfun-qwiic-icm20948
68+
```
69+
Now you should be able to run any example or custom python scripts that have `import qwiic_icm20948` by running e.g.:
6970
```sh
70-
pip install sparkfun-qwiic-icm20948
71+
path/to/venv/bin/python3 example_script.py
7172
```
7273

73-
### Local Installation
74-
To install, make sure the setuptools package is installed on the system.
74+
### MicroPython Installation
75+
If not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.
7576

76-
Direct installation at the command line:
77+
Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
7778
```sh
78-
python setup.py install
79+
mpremote mip install github:sparkfun/qwiic_9dof_imu_icm20948_py
7980
```
8081

81-
To build a package for use with pip:
82+
If you would also like to install the examples for this repository, issue the following mip command as well:
8283
```sh
83-
python setup.py sdist
84-
```
85-
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
84+
mprmeote mip install github:sparkfun/qwiic_9dof_imu_icm20948_py@examples
85+
```
86+
87+
### CircuitPython Installation
88+
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
89+
90+
Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
8691
```sh
87-
cd dist
88-
pip install sparkfun_qwiic_icm20948-<version>.tar.gz
89-
92+
circup bundle-add sparkfun/Qwiic_Py
9093
```
94+
95+
Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
96+
```sh
97+
circup install --py qwiic_icm20948
98+
```
99+
100+
If you would like to install any of the examples from this repository, issue the corresponding circup command from below. (NOTE: The below syntax assumes you are using CircUp on Windows. Linux and Mac will have different path seperators (i.e. "/" vs. "\"). See the [CircUp "example" command documentation](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/example-command) for more information)
101+
102+
```sh
103+
circup example qwiic_icm20948\ex1_qwiic_ICM20948
104+
```
105+
91106
Example Use
92107
---------------
93-
See the examples directory for more detailed use examples.
108+
Below is a quickstart program to print readings from the 9DOF.
109+
110+
See the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_9dof_py/blob/main/examples/README.md) for a summary of the available examples.
94111

95112
```python
96-
from __future__ import print_function
113+
97114
import qwiic_icm20948
98115
import time
99116
import sys
@@ -109,20 +126,20 @@ def runExample():
109126
return
110127

111128
IMU.begin()
112-
129+
113130
while True:
114131
if IMU.dataReady():
115132
IMU.getAgmt() # read all axis and temp from sensor, note this also updates all instance variables
116133
print(\
117-
'{: 06d}'.format(IMU.axRaw)\
118-
, '\t', '{: 06d}'.format(IMU.ayRaw)\
119-
, '\t', '{: 06d}'.format(IMU.azRaw)\
120-
, '\t', '{: 06d}'.format(IMU.gxRaw)\
121-
, '\t', '{: 06d}'.format(IMU.gyRaw)\
122-
, '\t', '{: 06d}'.format(IMU.gzRaw)\
123-
, '\t', '{: 06d}'.format(IMU.mxRaw)\
124-
, '\t', '{: 06d}'.format(IMU.myRaw)\
125-
, '\t', '{: 06d}'.format(IMU.mzRaw)\
134+
'ax: {: 06d}'.format(IMU.axRaw)\
135+
, '\t', 'ay: {: 06d}'.format(IMU.ayRaw)\
136+
, '\t', 'az: {: 06d}'.format(IMU.azRaw)\
137+
, '\t', 'gx: {: 06d}'.format(IMU.gxRaw)\
138+
, '\t', 'gy: {: 06d}'.format(IMU.gyRaw)\
139+
, '\t', 'gz: {: 06d}'.format(IMU.gzRaw)\
140+
, '\t', 'mx: {: 06d}'.format(IMU.mxRaw)\
141+
, '\t', 'my: {: 06d}'.format(IMU.myRaw)\
142+
, '\t', 'mz: {: 06d}'.format(IMU.mzRaw)\
126143
)
127144
time.sleep(0.03)
128145
else:
@@ -135,6 +152,9 @@ if __name__ == '__main__':
135152
except (KeyboardInterrupt, SystemExit) as exErr:
136153
print("\nEnding Example 1")
137154
sys.exit(0)
155+
156+
157+
138158
```
139159
<p align="center">
140160
<img src="https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png" alt="SparkFun - Start Something">

docs/images/gh-banner.png

829 KB
Loading

examples/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Sparkfun 9DOF 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_9dof_py/issues).
3+
4+
NOTE: Any numbering of examples is to retain consistency with the Arduino library from which this was ported.
5+
6+
## Ex1 Qwiic Icm20948
7+
Simple Example for the Qwiic ICM20948 Device
8+
9+

pyproject.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
4+
[project]
5+
name = "sparkfun_qwiic_icm20948"
6+
version = "0.0.1"
7+
description = long_description
8+
readme = "DESCRIPTION.rst"
9+
10+
authors = [{name="Sparkfun Electronics", email="[email protected]"}]
11+
dependencies = ["sparkfun_qwiic_i2c"]
12+
13+
classifiers=[
14+
# How mature is this project? Common values are
15+
# 3 - Alpha
16+
# 4 - Beta
17+
# 5 - Production/Stable
18+
"Development Status :: 5 - Production/Stable",
19+
20+
# Indicate who your project is intended for
21+
"Intended Audience :: Developers",
22+
"Topic :: Software Development :: Build Tools",
23+
24+
# Pick your license as you wish (should match "license" above)
25+
"License :: OSI Approved :: MIT License",
26+
27+
# Specify the Python versions you support here. In particular, ensure
28+
# that you indicate whether you support Python 2, Python 3 or both.
29+
"Programming Language :: Python :: 3.5",
30+
"Programming Language :: Python :: 3.6",
31+
"Programming Language :: Python :: 3.7",
32+
"Programming Language :: Python :: 3.8",
33+
"Programming Language :: Python :: 3.9",
34+
"Programming Language :: Python :: 3.10",
35+
"Programming Language :: Python :: 3.11",
36+
"Programming Language :: Python :: 3.12",
37+
"Programming Language :: Python :: 3.13",
38+
"Programming Language :: Python :: 3.14",
39+
"Programming Language :: Python :: Implementation :: MicroPython",
40+
# NOTE: CircuitPython is also supported, but no classifier exists for it
41+
]
42+
43+
keywords = ["electronics, maker"]
44+
45+
[project.urls]
46+
homepage = "https://www.sparkfun.com/products/15318"
47+
48+
[tool.setuptools]
49+
py-modules = ["qwiic_9dof_imu_icm20948"]

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)