Skip to content

Commit

Permalink
Revert "Autogenerated. Convert PyPi packaging and add Readme Updates"
Browse files Browse the repository at this point in the history
This reverts commit 3676a50. Packaging
is not yet published.
  • Loading branch information
malcolm-sparkfun committed Feb 5, 2025
1 parent 3676a50 commit 811c47a
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 152 deletions.
168 changes: 74 additions & 94 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,116 +1,99 @@
![Qwiic 9DOF - Python Package](docs/images/gh-banner.png "qwiic 9DOF Python Package")
Qwiic_9DoF_IMU_ICM20948_Py
==============

# SparkFun Qwiic 9DOF - Python Package

![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_9dof_imu_icm20948)
![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_9dof_imu_icm20948_py)
![License](https://img.shields.io/github/license/sparkfun/qwiic_9dof_imu_icm20948_py)
![X](https://img.shields.io/twitter/follow/sparkfun)
[![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)

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.

This repository implements a Python package for the SparkFun Qwiic 9DOF. This package works with Python, MicroPython and CircuitPython.
<p align="center">
<img src="https://cdn.sparkfun.com/assets/custom_pages/2/7/2/qwiic-logo-registered.jpg" width=200>
<img src="https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" width=240>
</p>
<p align="center">
<a href="https://pypi.org/project/sparkfun-qwiic-icm20948/" alt="Package">
<img src="https://img.shields.io/pypi/pyversions/sparkfun_qwiic_icm20948.svg" /></a>
<a href="https://github.com/sparkfun/Qwiic_9DoF_IMU_ICM20948_Py/issues" alt="Issues">
<img src="https://img.shields.io/github/issues/sparkfun/Qwiic_9DoF_IMU_ICM20948_Py.svg" /></a>
<a href="https://qwiic-9dof-imu-icm20948-py.readthedocs.io/en/latest/?" alt="Documentation">
<img src="https://readthedocs.org/projects/qwiic-9dof-imu-icm20948-py/badge/?version=latest&style=flat" /></a>
<a href="https://github.com/sparkfun/Qwiic_9DoF_IMU_ICM20948_Py/blob/master/LICENSE" alt="License">
<img src="https://img.shields.io/badge/license-MIT-blue.svg" /></a>
<a href="https://twitter.com/intent/follow?screen_name=sparkfun">
<img src="https://img.shields.io/twitter/follow/sparkfun.svg?style=social&logo=twitter"
alt="follow on Twitter"></a>

</p>

### Contents
<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)">

* [About](#about-the-package)
* [Getting Started](#getting-started)
* [Installation](#installation)
* [Supported Platforms](#supported-platforms)
* [Documentation](https://docs.sparkfun.com/qwiic_9dof_imu_icm20948_py/classqwiic__icm20948_1_1_qwiic_icm20948.html)
* [Examples](#examples)
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)

## About the Package
This python package is a port of the existing [SparkFun ICM-20948 Arduino Library](https://github.com/sparkfun/SparkFun_ICM-20948_ArduinoLibrary)

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.
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)

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

### Supported SparkFun Products
## Contents

This Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python.

* [SparkFun 9 Degrees of Freedom IMU Sensor - 9DOF](https://www.sparkfun.com/products/15318)

### Supported Platforms

| Python | Platform | Boards |
|--|--|--|
| 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) |
| 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)
|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)

> [!NOTE]
> 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.
## Installation

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.

### Python

#### PyPi Installation
* [Supported Platforms](#supported-platforms)
* [Dependencies](#dependencies)
* [Installation](#installation)
* [Documentation](#documentation)
* [Example Use](#example-use)

The package is primarily installed using the `pip3` command, downloading the package from the Python Index - "PyPi".
Supported Platforms
--------------------
The qwiic ICM20948 Python package current supports the following platforms:
* [Raspberry Pi](https://www.sparkfun.com/search/results?term=raspberry+pi)
* [NVidia Jetson Nano](https://www.sparkfun.com/products/15297)
* [Google Coral Development Board](https://www.sparkfun.com/products/15318)

Note - the below instructions outline installation on a Linux-based (Raspberry Pi) system.
Dependencies
---------------
This driver package depends on the qwiic I2C driver:
[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py)

First, setup a virtual environment from a specific directory using venv:
```sh
python3 -m venv path/to/venv
```
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).
Documentation
-------------
The SparkFun qwiic ICM20948 module documentation is hosted at [ReadTheDocs](https://qwiic-9dof-imu-icm20948-py.readthedocs.io/en/latest/?)

Next, install the qwiic package with:
```sh
path/to/venv/bin/pip3 install sparkfun-qwiic-icm20948
```
Now you should be able to run any example or custom python scripts that have `import qwiic_icm20948` by running e.g.:
```sh
path/to/venv/bin/python3 example_script.py
```
Installation
-------------

### MicroPython Installation
If not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.
### PyPi Installation
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

Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
For all users (note: the user must have sudo privileges):
```sh
mpremote mip install github:sparkfun/qwiic_9dof_imu_icm20948_py
sudo pip install sparkfun-qwiic-icm20948
```
For the current user:

If you would also like to install the examples for this repository, issue the following mip command as well:
```sh
mprmeote mip install github:sparkfun/qwiic_9dof_imu_icm20948_py@examples
pip install sparkfun-qwiic-icm20948
```

### CircuitPython Installation
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
### Local Installation
To install, make sure the setuptools package is installed on the system.

Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
Direct installation at the command line:
```sh
circup bundle-add sparkfun/Qwiic_Py
python setup.py install
```

Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
To build a package for use with pip:
```sh
circup install --py qwiic_icm20948
```

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)

python setup.py sdist
```
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
```sh
circup example qwiic_icm20948\ex1_qwiic_ICM20948
cd dist
pip install sparkfun_qwiic_icm20948-<version>.tar.gz

```

Example Use
---------------
Below is a quickstart program to print readings from the 9DOF.

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.
See the examples directory for more detailed use examples.

```python

from __future__ import print_function
import qwiic_icm20948
import time
import sys
Expand All @@ -126,20 +109,20 @@ def runExample():
return

IMU.begin()

while True:
if IMU.dataReady():
IMU.getAgmt() # read all axis and temp from sensor, note this also updates all instance variables
print(\
'ax: {: 06d}'.format(IMU.axRaw)\
, '\t', 'ay: {: 06d}'.format(IMU.ayRaw)\
, '\t', 'az: {: 06d}'.format(IMU.azRaw)\
, '\t', 'gx: {: 06d}'.format(IMU.gxRaw)\
, '\t', 'gy: {: 06d}'.format(IMU.gyRaw)\
, '\t', 'gz: {: 06d}'.format(IMU.gzRaw)\
, '\t', 'mx: {: 06d}'.format(IMU.mxRaw)\
, '\t', 'my: {: 06d}'.format(IMU.myRaw)\
, '\t', 'mz: {: 06d}'.format(IMU.mzRaw)\
'{: 06d}'.format(IMU.axRaw)\
, '\t', '{: 06d}'.format(IMU.ayRaw)\
, '\t', '{: 06d}'.format(IMU.azRaw)\
, '\t', '{: 06d}'.format(IMU.gxRaw)\
, '\t', '{: 06d}'.format(IMU.gyRaw)\
, '\t', '{: 06d}'.format(IMU.gzRaw)\
, '\t', '{: 06d}'.format(IMU.mxRaw)\
, '\t', '{: 06d}'.format(IMU.myRaw)\
, '\t', '{: 06d}'.format(IMU.mzRaw)\
)
time.sleep(0.03)
else:
Expand All @@ -152,9 +135,6 @@ if __name__ == '__main__':
except (KeyboardInterrupt, SystemExit) as exErr:
print("\nEnding Example 1")
sys.exit(0)



```
<p align="center">
<img src="https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png" alt="SparkFun - Start Something">
Expand Down
Binary file removed docs/images/gh-banner.png
Binary file not shown.
9 changes: 0 additions & 9 deletions examples/README.md

This file was deleted.

49 changes: 0 additions & 49 deletions pyproject.toml

This file was deleted.

2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal=1
101 changes: 101 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#------------------------------------------------------------------------
#
# This is a python install script written for qwiic python package.
#
# Written by SparkFun Electronics, May 2019
#
# This python library supports the SparkFun Electroncis qwiic
# ecosystem, providing an plaform indepenant interface to the
# I2C bus.
#
# More information on qwiic is at https://www.sparkfun.com/qwiic
#
# Do you like this library? Help support SparkFun. Buy a board!
#
#==================================================================================
# Copyright (c) 2019 SparkFun Electronics
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#==================================================================================

from setuptools import setup, find_packages # Always prefer setuptools over distutils
from os import path
import io

here = path.abspath(path.dirname(__file__))

# get the log description
with io.open(path.join(here, "DESCRIPTION.rst"), encoding="utf-8") as f:
long_description = f.read()

setup(

name='sparkfun_qwiic_icm20948',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='0.0.1',

description='SparkFun Electronics qwiic ICM20948',
long_description=long_description,

# The project's main homepage.
url='https://www.sparkfun.com/products/15318',

# Author details
author='SparkFun Electronics',
author_email='info@sparkfun.com',

install_requires=['sparkfun_qwiic_i2c'],

# Choose your license
license='MIT',

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 5 - Production/Stable',

# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],

# What does your project relate to?
keywords='electronics, maker',

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
py_modules=["qwiic_icm20948"],

)

0 comments on commit 811c47a

Please sign in to comment.