Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add binding for IS31FL3730 LED driver #1930

Merged
merged 48 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8299345
Binding for IS31FL3731 LED Matrix driver
richlander Sep 21, 2022
ccd9b9a
Add sample
richlander Sep 22, 2022
be62d43
Update sample
richlander Sep 23, 2022
7b78e6f
Update comments
richlander Sep 23, 2022
f0a1458
Add Matrix5x7 class
richlander Sep 24, 2022
1c6130a
Add higher-level bindings
richlander Sep 29, 2022
c795dbf
Rename sample project
richlander Sep 29, 2022
b4c9e37
Rename sample project
richlander Sep 29, 2022
13a95a8
Apply suggestions from code review
richlander Sep 29, 2022
bc4b4a4
Update src/devices/Is31fl3730/Bonnet5x7x6.cs
richlander Sep 29, 2022
565fa6e
Use lists/arrays more
richlander Sep 29, 2022
cd0dbc3
Add MicrDotpHat binding
richlander Sep 29, 2022
e920490
Cleanup
richlander Oct 5, 2022
3e81307
Update per feedback
richlander Nov 30, 2022
f7524ad
Merge branch 'main' into Is31fl3730
richlander Nov 30, 2022
d82f7ff
Add Index/Range support for netstandard2.0
richlander Nov 30, 2022
8f7d961
Enable decimal point
richlander Dec 14, 2022
5b8c341
Update target matrix
richlander Dec 14, 2022
0d1e95f
Add support for Micro Dot pHat
richlander Dec 17, 2022
5923b31
Add Length concept
richlander Dec 17, 2022
a900e7c
Update ordering of matrices
richlander Dec 17, 2022
a3800da
Update README
richlander Dec 17, 2022
bcd92dc
Change comment
richlander Dec 17, 2022
5712706
Merge branch 'main' into Is31fl3730
richlander Dec 17, 2022
ac4d819
Switch to Slice syntax
richlander Dec 17, 2022
230a212
Remove magic numbers
richlander Dec 18, 2022
57eacd2
Remove code duplication
richlander Dec 19, 2022
096bdce
Fix type name
richlander Dec 19, 2022
0992e82
Update README
richlander Dec 19, 2022
6322a24
Switch dimensional fields to properties
richlander Dec 20, 2022
0b24344
Remove code by subclassing
richlander Dec 20, 2022
62459d7
Add more value bounds checking
richlander Dec 20, 2022
4ef5b67
Update bounds checking
richlander Dec 20, 2022
6a34bc0
Add IMatrix interface
richlander Dec 20, 2022
18a685b
Fix markdown error
richlander Dec 20, 2022
c2c6916
Update fill value
richlander Dec 20, 2022
b151d50
Update README
richlander Dec 20, 2022
5fad1d5
Add solution file
richlander Jan 12, 2023
ecab9e3
Update src/devices/Is31fl3730/Current.cs
richlander Jan 16, 2023
bf10f22
Update per feedback
richlander Jan 16, 2023
9396154
Update to PinValue
richlander Jan 16, 2023
de781f6
Update per feedback
richlander Jan 16, 2023
0001fab
Update per feedback
richlander Jan 16, 2023
d0d0964
Remove IMatrix interface
richlander Jan 16, 2023
0921724
Update type names
richlander Jan 17, 2023
2a81f18
Update per feedback
richlander Jan 26, 2023
a4222e8
Fix fill logic
richlander Feb 2, 2023
67ca483
Update per feedback
richlander Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions src/devices/Is31fl3730/Bonnet5x7x6.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Device.I2c;
using System.Threading;

namespace Iot.Device.Display
{
/// <summary>
/// Represents LED Dot Matrix Breakout
/// </summary>
// Datasheet: https://cdn-shop.adafruit.com/product-files/3017/31FL3730.pdf
// Product: https://shop.pimoroni.com/products/led-dot-matrix-breakout
// Related repo: https://github.com/pimoroni/microdot-phat
public class Matrix5x7 : IDisposable
{
private readonly Is31fl3730 _is31fl3730;

/// <summary>
/// Initialize IS31FL3730 device
/// </summary>
/// <param name="is31fl3730">The <see cref="Iot.Device.Display.Is31fl3730"/> to create with.</param>
/// <param name="width">The width of the LED matrix.</param>
/// <param name="height">The height of the LED matrix.</param>
public Matrix5x7(Is31fl3730 is31fl3730, int width, int height, int matrix)
{
_is31fl3730 = is31fl3730;
Width = width;
Height = height;
Matrix = matrix;
}

/// <summary>
/// Indexer for matrix.
/// </summary>
public int this[int x, int y]
{
get => _is31fl3730.ReadLed(Matrix, x, y);
set => _is31fl3730.WriteLed(Matrix, x, y, value);
}

public static readonly int DefaultI2cAddress = 0x61;
richlander marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Width of LED matrix (x axis).
/// </summary>
public readonly int Width = 5;
richlander marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Height of LED matrix (y axis).
/// </summary>
public readonly int Height = 7;

/// <summary>
/// Identification of matrix (of 2).
/// </summary>
public readonly int Matrix = 0;
}
}
62 changes: 62 additions & 0 deletions src/devices/Is31fl3730/Breakout5x7x2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Device.I2c;
using System.Threading;

namespace Iot.Device.Display
{
/// <summary>
/// Represents an IS31FL3731 LED Matrix driver
/// </summary>
// Datasheet: https://cdn-shop.adafruit.com/product-files/3017/31FL3730.pdf
// Product: https://shop.pimoroni.com/products/microdot-phat
// Product: https://shop.pimoroni.com/products/led-dot-matrix-breakout
// Related repo: https://github.com/pimoroni/microdot-phat
public class Matrix5x7 : IDisposable
{
private readonly Is31fl3730 _is31fl3730;

/// <summary>
/// Initialize IS31FL3730 device
/// </summary>
/// <param name="is31fl3730">The <see cref="Iot.Device.Display.Is31fl3730"/> to create with.</param>
/// <param name="width">The width of the LED matrix.</param>
/// <param name="height">The height of the LED matrix.</param>
public Matrix5x7(Is31fl3730 is31fl3730, int width, int height, int matrix)
{
_is31fl3730 = is31fl3730;
Width = width;
Height = height;
Matrix = matrix;
}

/// <summary>
/// Indexer for matrix.
/// </summary>
public int this[int x, int y]
{
get => _is31fl3730.ReadLed(Matrix, x, y);
set => _is31fl3730.WriteLed(Matrix, x, y, value);
}

public static readonly int DefaultI2cAddress = 0x61;

/// <summary>
/// Width of LED matrix (x axis).
/// </summary>
public readonly int Width = 5;

/// <summary>
/// Height of LED matrix (y axis).
/// </summary>
public readonly int Height = 7;

/// <summary>
/// Identification of matrix (of 2).
/// </summary>
public readonly int Matrix = 0;
}
}
Loading