ScrollHat.IS31FL3731 (scroll_hat v0.2.3)

Copy Markdown View Source

Integration for the IS31FL3731 I2C LED Driver

Summary

Functions

Display the specified frame

Set the LEDs settings for the specified frame

Set the configuration mode of the driver

Set software shutdown or normal operation

Types

frame()

@type frame() :: 0..7

i2c()

@type i2c() :: Circuits.I2C.bus()

result()

@type result() :: :ok | {:error, term()}

Functions

display_frame(i2c, frame)

@spec display_frame(i2c(), frame()) :: result()

Display the specified frame

In picture mode, this will display the specified frame according to the settings for that frame stored in memory

set_frame(i2c, frame, led_map)

@spec set_frame(i2c(), frame(), iodata()) :: result()

Set the LEDs settings for the specified frame

This would be used to set LED's on/off, LED blink state, and the PWM of each LED and requires the bytes to be formatted already according to tables 3-6 in the IS31FL3731 datasheet.

set_mode(i2c, mode, frame_start \\ 0)

@spec set_mode(i2c(), mode :: 0..2, frame()) :: result()

Set the configuration mode of the driver

Supported modes: 0x00: Picture 0x01: Auto frame play 0x02: Audio frame play

The third argument is only used to set the starting frame when using Auto frame play mode.

shutdown_control(i2c, mode)

@spec shutdown_control(i2c(), mode :: 1 | 0) :: result()

Set software shutdown or normal operation

modes: 0 -> shutdown 1 -> normal operation