Remarks

Is31fl3731
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.ICs.IOExpanders.Is31fl3731

Code Example

Is31fl3731 iS31FL3731;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");
    iS31FL3731 = new Is31fl3731(Device.CreateI2cBus());
    iS31FL3731.Initialize();

    return base.Initialize();
}

public override Task Run()
{
    iS31FL3731.ClearAllFrames();
    iS31FL3731.SetFrame(frame: 0);
    iS31FL3731.DisplayFrame(frame: 0);

    //Turn on all LEDs in frame
    for (byte i = 0; i <= 144; i++)
    {
        iS31FL3731.SetLedPwm(
            frame: 0,
            ledIndex: i,
            brightness: 128);

        Thread.Sleep(50);
    }

    return base.Run();
}

Sample project(s) available on GitHub

Wiring Example

To wire a Is31fl3731 to your Meadow board, connect the following:

Characteristic Locus
Inheritance System.Object > Is31fl3731
Namespace Meadow.Foundation.ICs.IOExpanders
Assembly Is31fl3731.dll

Syntax

public class Is31fl3731 : object

Constructors

Is31fl3731(II2cBus, Byte)

Creaete a new Is31fl3731 object

Declaration
public Is31fl3731(II2cBus i2cBus, byte address = null)

Parameters

Type Name Description
II2cBus i2cBus

The I2C bus

System.Byte address

The I2C address

Properties

Frame

The current frame

Declaration
public byte Frame { get; }

Property Value

Type Description
System.Byte

Methods

Clear()

Turn off all LEDs for the specified frame

Declaration
public virtual void Clear()

Clear(Byte)

Turn off all LEDs for the specified frame

Declaration
public virtual void Clear(byte frame)

Parameters

Type Name Description
System.Byte frame

the frame to clear

ClearAllFrames()

Turn off all LEDs

Declaration
public virtual void ClearAllFrames()

DisplayFrame(Byte)

Display the specified frame

Declaration
public virtual void DisplayFrame(byte frame)

Parameters

Type Name Description
System.Byte frame

The frame number. 0-7

Initialize()

Initialize the IS31FL3731 by shutting it down, turning it back on and setting it to Picture mode.

Declaration
public void Initialize()

SelectPage(Byte)

Select the page/frame

Declaration
protected virtual void SelectPage(byte page)

Parameters

Type Name Description
System.Byte page

page/frame #

SetBlinkFunctionOnAllLeds(Boolean)

Blink all LEDs for the current frame. Blink Mode muse be enabled

Declaration
public virtual void SetBlinkFunctionOnAllLeds(bool on)

Parameters

Type Name Description
System.Boolean on

true = on, false = off

SetBlinkFunctionOnAllLeds(Byte, Boolean)

Blink all the LEDs for the specified frame

Declaration
public virtual void SetBlinkFunctionOnAllLeds(byte frame, bool on)

Parameters

Type Name Description
System.Byte frame

frame #

System.Boolean on

true = on, false = off

SetBlinkMode(Boolean, Byte)

Enable/disable blink mode

Declaration
public virtual void SetBlinkMode(bool enabled, byte period)

Parameters

Type Name Description
System.Boolean enabled

true = on, false = off

System.Byte period

the blink duration

SetFrame(Byte)

Sets the current frame.

Declaration
public virtual void SetFrame(byte frame)

Parameters

Type Name Description
System.Byte frame

The frame number. 0-7

SetLedPwm(Byte, Byte)

Set the PWM value for the specified LED

Declaration
public virtual void SetLedPwm(byte ledIndex, byte pwm)

Parameters

Type Name Description
System.Byte ledIndex

The LED number

System.Byte pwm

The pwm value 0-255

SetLedPwm(Byte, Byte, Byte)

Set the PWM value for the specified LED

Declaration
public virtual void SetLedPwm(byte frame, byte ledIndex, byte brightness)

Parameters

Type Name Description
System.Byte frame

Frame number. 0-7

System.Byte ledIndex

The LED number. 0-144

System.Byte brightness

The pwm value 0-255

SetLedState(Boolean)

Set the LED state for all LED's in the current Frame

Declaration
public virtual void SetLedState(bool on)

Parameters

Type Name Description
System.Boolean on

true = on, false = off

SetLedState(Byte, Boolean)

Sets the state for all LEDs for the specified frame

Declaration
public virtual void SetLedState(byte frame, bool on)

Parameters

Type Name Description
System.Byte frame
System.Boolean on

true = on, false = off

WriteRegister(Byte, Byte)

Write to the current frame register

Declaration
protected virtual void WriteRegister(byte register, byte data)

Parameters

Type Name Description
System.Byte register

Register to write to

System.Byte data

The data value

WriteRegister(Byte, Byte, Byte)

Write a value to a register

Declaration
protected virtual void WriteRegister(byte frame, byte register, byte data)

Parameters

Type Name Description
System.Byte frame

The frame

System.Byte register

Register to write to

System.Byte data

The data value