Skip to main content

Meadow.Foundation.ICs.IOExpanders.Is31fl3731

Is31fl3731
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet 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:

Class Is31fl3731

Represents the IS31FL3731 IC The Is31fl3731 is a compact LED driver for 144 single LEDs

Assembly: Is31fl3731.dll
View Source
Declaration
public class Is31fl3731 : II2cPeripheral

Implements:
Meadow.Hardware.II2cPeripheral

Properties

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

Frame

The current frame

View Source
Declaration
public byte Frame { get; }

Fields

i2cComms

I2C Communication bus used to communicate with the peripheral

View Source
Declaration
protected readonly II2cCommunications i2cComms

Methods

Initialize()

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

View Source
Declaration
public void Initialize()

SetLedState(bool)

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

View Source
Declaration
public virtual void SetLedState(bool on)
Parameters
TypeNameDescription
System.Booleanontrue = on, false = off

SetLedState(byte, bool)

Sets the state for all LEDs for the specified frame

View Source
Declaration
public virtual void SetLedState(byte frame, bool on)
Parameters
TypeNameDescription
System.Byteframe
System.Booleanontrue = on, false = off

WriteRegister(byte, byte)

Write to the current frame register

View Source
Declaration
protected virtual void WriteRegister(byte register, byte data)
Parameters
TypeNameDescription
System.ByteregisterRegister to write to
System.BytedataThe data value

WriteRegister(byte, byte, byte)

Write a value to a register

View Source
Declaration
protected virtual void WriteRegister(byte frame, byte register, byte data)
Parameters
TypeNameDescription
System.ByteframeThe frame
System.ByteregisterRegister to write to
System.BytedataThe data value

SetBlinkMode(bool, byte)

Enable/disable blink mode

View Source
Declaration
public virtual void SetBlinkMode(bool enabled, byte period)
Parameters
TypeNameDescription
System.Booleanenabledtrue = on, false = off
System.Byteperiodthe blink duration

Clear()

Turn off all LEDs for the specified frame

View Source
Declaration
public virtual void Clear()

Clear(byte)

Turn off all LEDs for the specified frame

View Source
Declaration
public virtual void Clear(byte frame)
Parameters
TypeNameDescription
System.Byteframethe frame to clear

ClearAllFrames()

Turn off all LEDs

View Source
Declaration
public virtual void ClearAllFrames()

SetLedPwm(byte, byte)

Set the PWM value for the specified LED

View Source
Declaration
public virtual void SetLedPwm(byte ledIndex, byte pwm)
Parameters
TypeNameDescription
System.ByteledIndexThe LED number
System.BytepwmThe pwm value 0-255

SetLedPwm(byte, byte, byte)

Set the PWM value for the specified LED

View Source
Declaration
public virtual void SetLedPwm(byte frame, byte ledIndex, byte brightness)
Parameters
TypeNameDescription
System.ByteframeFrame number. 0-7
System.ByteledIndexThe LED number. 0-144
System.BytebrightnessThe pwm value 0-255

DisplayFrame(byte)

Display the specified frame

View Source
Declaration
public virtual void DisplayFrame(byte frame)
Parameters
TypeNameDescription
System.ByteframeThe frame number. 0-7

SetFrame(byte)

Sets the current frame.

View Source
Declaration
public virtual void SetFrame(byte frame)
Parameters
TypeNameDescription
System.ByteframeThe frame number. 0-7

SetBlinkFunctionOnAllLeds(bool)

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

View Source
Declaration
public virtual void SetBlinkFunctionOnAllLeds(bool on)
Parameters
TypeNameDescription
System.Booleanontrue = on, false = off

SetBlinkFunctionOnAllLeds(byte, bool)

Blink all the LEDs for the specified frame

View Source
Declaration
public virtual void SetBlinkFunctionOnAllLeds(byte frame, bool on)
Parameters
TypeNameDescription
System.Byteframeframe #
System.Booleanontrue = on, false = off

SelectPage(byte)

Select the page/frame

View Source
Declaration
protected virtual void SelectPage(byte page)
Parameters
TypeNameDescription
System.Bytepagepage/frame #

Implements

  • Meadow.Hardware.II2cPeripheral