adafruit_is31fl3741

CircuitPython driver for the IS31FL3741 RGB Matrix IC.

Base library.

  • Author(s): Ladyada

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_is31fl3741.IS31FL3741(i2c: busio.I2C, address: int = 48, allocate: int = 0)[source]

The IS31FL3741 is an abstract class containing the main function related to this chip. It focuses on lowest-level I2C operations and chip registers, and has no concept of a 2D graphics coordinate system, nor of RGB colors (subclasses provide these). It is linear and monochromatic.

Parameters
  • i2c_device (i2c_device) – the connected i2c bus i2c_device

  • address – the device address; defaults to 0x30

  • allocate – buffer allocation strategy: NO_BUFFER = pixels are always sent to device as they’re set. PREFER_BUFFER = RAM permitting, buffer pixels in RAM, updating device only when show() is called, but fall back on NO_BUFFER behavior. MUST_BUFFER = buffer pixels in RAM, throw MemoryError if allocation fails.

property enable: bool

Enable

property global_current: int

Global current

property page: Optional[int]

Page

reset() None[source]

Reset

set_led_scaling(scale: int) None[source]

Set scaling level for all LEDs.

Parameters

scale – Scaling level from 0 (off) to 255 (brightest).

show() None[source]

Issue in-RAM pixel data to device. No effect if pixels are unbuffered.

unlock() None[source]

Unlock

class adafruit_is31fl3741.IS31FL3741_colorXY(i2c: busio.I2C, width: int, height: int, address: int = 48, allocate: int = 0, order: int = 36)[source]

Class encompassing IS31FL3741 and a minimal layer for RGB color 2D pixel operations (base class is hardware- and register-centric and lacks these concepts). Specific boards like the QT matrix or EyeLights glasses then subclass this. In theory, a companion monochrome XY class could be separately implemented in the future if required for anything. Mostly though, this is about providing a place for common RGB matrix functions like fill() that then work across all such devices.

Parameters
  • i2c_device (i2c_device) – the connected i2c bus i2c_device

  • width – Matrix width in pixels.

  • height – Matrix height in pixels.

  • address – the device address; defaults to 0x30

  • allocate – buffer allocation strategy: NO_BUFFER = pixels are always sent to device as they’re set. PREFER_BUFFER = RAM permitting, buffer pixels in RAM, updating device only when show() is called, but fall back on NO_BUFFER behavior. MUST_BUFFER = buffer pixels in RAM, throw MemoryError if allocation fails.

  • order – Pixel RGB color order, one of the IS3741_* color types above. Default is IS3741_BGR.

fill(color: int = 0) None[source]

Set all pixels to a given RGB color.

Parameters

color – Packed 24-bit color value (0xRRGGBB).

image(img: Union[adafruit_framebuf.FrameBuffer, PIL.ImageFile.ImageFile]) None[source]

Copy an in-memory image to the LED matrix. Image should be in 24-bit format (e.g. “RGB888”) and dimensions should match matrix, this isn’t super robust yet or anything.

Parameters

img – Source image – either a FrameBuffer object if running CircuitPython, or PIL image if running CPython w/Python Imaging Lib.

pixel(x: int, y: int, color: Optional[int] = None) Optional[int][source]

Set or retrieve RGB color of pixel at position (X,Y).

Parameters
  • x – Horizontal pixel position.

  • y – Vertical pixel position.

  • color – If setting, a packed 24-bit color value (0xRRGGBB). If getting, either None or leave off this argument.

Returns

If setting, returns None. If getting, returns a packed 24-bit color value (0xRRGGBB).

static pixel_addrs(x: int, y: int) Tuple[int, ...][source]

Calculate a device-specific LED offset for an X,Y 2D pixel.