Introduction

Documentation Status Discord Build Status

CircuitPython driver for the IS31FL3731 charlieplex IC.

This driver supports the following hardware:

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Usage Example

Matrix:

import adafruit_is31fl3731
import board
import busio
with busio.I2C(board.SCL, board.SDA) as i2c:
    display = adafruit_is31fl3731.Matrix(i2c)
    display.fill(127)

Charlie Wing:

import adafruit_is31fl3731
import board
import busio
with busio.I2C(board.SCL, board.SDA) as i2c:
    display = adafruit_is31fl3731.CharlieWing(i2c)
    display.fill(127)

    # Turn off pixel 4,4, change its brightness and turn it back on
    display.pixel(4, 4, 0)   # Turn off.
    display.pixel(4, 4, 50)  # Low brightness (50)
    display.pixel(4, 4, 192) # Higher brightness (192)

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Building locally

To build this library locally you’ll need to install the circuitpython-build-tools package.

python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools

Once installed, make sure you are in the virtual environment:

source .env/bin/activate

Then run the build:

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-is31fl3731 --library_location .

Sphinx documentation

Sphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):

python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme

Now, once you have the virtual environment activated:

cd docs
sphinx-build -E -W -b html . _build/html

This will output the documentation to docs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.

Table of Contents

Simple test

Ensure your device works with this simple test.

examples/is31fl3731_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import board
import busio
import adafruit_is31fl3731

i2c = busio.I2C(board.SCL, board.SDA)

# initialize display using Feather CharlieWing LED 15 x 7
display = adafruit_is31fl3731.CharlieWing(i2c)

# uncomment next line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
#display = adafruit_is31fl3731.Matrix(i2c)

# uncomment next line if you are using Adafruit 16x8 Charlieplexed Bonnet
#display = adafruit_is31fl3731.CharlieBonnet(i2c)

# draw a box on the display
# first draw the top and bottom edges
for x in range(display.width):
    display.pixel(x, 0, 50)
    display.pixel(x, display.height - 1, 50)
# now draw the left and right edges
for y in range(display.height):
    display.pixel(0, y, 50)
    display.pixel(display.width - 1, y, 50)

For other examples, see the GitHub examples folder.

adafruit_is31fl3731

CircuitPython driver for the IS31FL3731 charlieplex IC.

  • Author(s): Tony DiCola

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_is31fl3731.CharlieBonnet(i2c, address=116)[source]

Supports the Charlieplexed bonnet

static pixel_addr(x, y)[source]

Calulate the offset into the device array for x,y pixel

class adafruit_is31fl3731.CharlieWing(i2c, address=116)[source]

Supports the Charlieplexed feather wing

static pixel_addr(x, y)[source]

Calulate the offset into the device array for x,y pixel

class adafruit_is31fl3731.Matrix(i2c, address=116)[source]

The Matrix class support the main function for driving the 16x9 matrix Display

Parameters:
  • i2c_device (i2c_device) – the connected i2c bus i2c_device
  • address – the device address; defaults to 0x74
audio_play(sample_rate, audio_gain=0, agc_enable=False, agc_fast=False)[source]

Controls the audio play feature

audio_sync(value=None)[source]

Set the audio sync feature register

autoplay(delay=0, loops=0, frames=0)[source]

Start autoplay

Parameters:
  • delay – in ms
  • loops – number of loops - 0->7
  • frames – number of frames: 0->7

Updates the blink register

fade(fade_in=None, fade_out=None, pause=0)[source]

Start and stop the fade feature. If both fade_in and fade_out are None (the default), the breath feature is used for fading. if fade_in is None, then fade_in = fade_out. If fade_out is None, then fade_out = fade_in

Parameters:
  • fade_in – positive number; 0->100
  • fade-out – positive number; 0->100
  • pause – breath register 2 pause value
fill(color=None, blink=None, frame=None)[source]

Fill the display with a brightness level

Parameters:
  • color – brightness 0->255
  • blink – True if blinking is required
  • frame – which frame to fill 0->7
frame(frame=None, show=True)[source]

Set the current frame

Parameters:
  • frame – frame number; 0-7 or None. If None function returns current frame
  • show – True to show the frame; False to not show.
pixel(x, y, color=None, blink=None, frame=None)[source]

Blink or brightness for x-, y-pixel

Parameters:
  • x – horizontal pixel position
  • y – vertical pixel position
  • color – brightness value 0->255
  • blink – True to blink
  • frame – the frame to set the pixel
static pixel_addr(x, y)[source]

Calulate the offset into the device array for x,y pixel

reset()[source]

Kill the display for 10MS

sleep(value)[source]

Set the Software Shutdown Register bit

Parameters:value – True to set software shutdown bit; False unset

Indices and tables