Skip to content
Python package for the qwiic system.
Branch: master
Clone or download
Latest commit 06511d4 Jul 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs for docs Jul 4, 2019
qwiic updated submodules Jul 15, 2019
qwiic_i2c @ e09851b updated submodules Jul 15, 2019
.gitmodules cleanup, version bump Jul 15, 2019
.readthedocs.yml submodule work Jul 4, 2019
DESCRIPTION.rst cleanup - actual support of package Jun 24, 2019
LICENSE MIT License Jun 25, 2019
README.md Update README.md Jul 15, 2019
setup.cfg initial setup Jun 24, 2019
setup.py changes in how drivers are loaded - now drivers are found and loaded … Jul 15, 2019

README.md

Qwiic_Py

follow on Twitter

The SparkFun qwiic python package aggregates all python qwiic drivers/modules to provide a single entity for qwiic within a python environment. The qwiic package delivers the high-level functionality needed to dynamically discover connected qwiic devices and construct their associated driver object.

New to qwiic? Take a look at the entire SparkFun qwiic ecosystem.

Contents

Supported Platforms

The qwiic Python package current supports the following platforms:

Structure

Each qwiic board has an independent driver library that implements the required logic for the specific board. This driver implementation is structured as a python package that supports standard python package management operations and tools. Additionally, each driver is deployed in a distinct GitHub repository which provides a central area for package management and development.

To provide dynamic discovery and instantiation capabilities, the qwiic package imports all the underlying qwiic driver packages at runtime. As such the qwiic driver packages must be installed prior to using this package. These packages can be installed manually, or the overall package will install them automatically when using a PyPi based package manger (aka pip).

Dependent Modules

To make development and evaluation easer, the modules this package is dependent on are included in this repository as git submodules. This allows rapid checkout and access to the entire qwiic python ecosystem if needed.

This structure has the following layout:

Qwiic_Py/
   |
   +--- qwiic_i2c/                                   --> Link to the qwiic_i2c submodule repository
   |      |--- __index__.py
   |      `--- ... The cross platform I2C bus access driver 
   |
   +--- qwiic/
   |      |--- __index__.py
   |      +--- ... Package Implementation
   |      `--- drivers/
   |            |--- qwiic_bme280	             --> The qwiic_bme280 submodule
   |            |--- qwiic_micro_oled		     --> The qwiic_micro_oled submodule
   |            `--- ... links to qwiic driver submodule repositories
   |
   +--- README.md
   +--- setup.py
   `--- ...etc

Dependencies

The qwiic package depends on the qwiic I2C driver: Qwiic_I2C_Py

This package is also dependent on the driver packages contained in the drivers directory.

Documentation

The SparkFun qwiic package documentation is hosted at ReadTheDocs

Checkout Commands

To clone this repository, a standard git clone command will create a local copy of this repository:

git clone https://github.com/sparkfun/Qwiic_Py

This will create a local version of this repository, but the submodule directories (drivers/*, and qwiic_i2c/ ) will be empty. To clone the git repository and include the submodule contents, use the following command:

git clone --recurse-submodules https://github.com/sparkfun/Qwiic_Py.git 

Installation

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic package. On systems that support PyPi installation via pip, this package is installed using the following commands For all users (note: the user must have sudo privileges):

sudo pip install sparkfun-qwiic

For the current user:

pip install sparkfun-qwiic

This process will also install all modules the qwiic package requires for operation, including the needed qwiic driver packages.

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line:

python setup.py install

To build a package for use with pip:

python setup.py sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.

cd dist
pip install sparkfun_qwiic_-<version>.tar.gz

Example Use

import qwiic
		
results = qwiic.list_devices()
		
print(results)
>>	[(61, 'Qwiic Micro OLED', 'QwiicMicroOled'), (91, 'Qwiic CCS811', 'QwiicCcs811'), 
>>	(96, 'Qwiic Proximity Sensor', 'QwiicProximity'), (119, 'Qwiic BME280', 'QwiicBme280')]

# Create a Micro OLED driver object using the I2C address of the board.
mydevice = qwiic.create_device(results[0][0])
		
print(mydevice)
>>	<qwiic_micro_oled.qwiic_micro_oled.QwiicMicroOled object at 0x751fdab0>

SparkFun - Start Something

You can’t perform that action at this time.