Remarks

CharlieWing
Status
Source code GitHub
NuGet package

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    CharlieWing charlieWing;
    GraphicsLibrary graphics;

    public MeadowApp()
    {
        Initialize();

        FourCorners();

        Thread.Sleep(2000);
        Face();

        Thread.Sleep(2000);
        ScrollText();
    }

    void Initialize()
    {
        Console.WriteLine("Initialize hardware...");

        charlieWing = new CharlieWing(Device.CreateI2cBus());
        charlieWing.Clear();
        charlieWing.Brightness = 128;

        graphics = new GraphicsLibrary(charlieWing);
        graphics.CurrentFont = new Font4x8();
    }

    void FourCorners()
    {
        charlieWing.Frame = 0;
        charlieWing.Clear();
        charlieWing.DrawPixel(0, 0);
        charlieWing.DrawPixel(14, 0);
        charlieWing.DrawPixel(0, 6);
        charlieWing.DrawPixel(14, 6);
        charlieWing.Show(0);
    }

    void ScrollText()
    {
        Console.WriteLine("ScrollText...");
        charlieWing.Clear();

        string text = "MEADOW";

        int x = 0;
        byte frameIndex = 0;
        int scollWidth = (int)(-1 * (charlieWing.Width + graphics.CurrentFont.Width + 4));
        int resetWidth = (int)(charlieWing.Width);
        charlieWing.Frame = 0;

        while (true)
        {
            charlieWing.Frame = frameIndex;
            graphics.Clear();
            int offset = 0;
            foreach(var chr in text)
            {
                graphics.DrawText(x + offset, 0, chr.ToString());
                offset += graphics.CurrentFont.Width;
            }

            graphics.Show();

            frameIndex = (frameIndex == 0) ? (byte)1 : (byte)0;

            x--;

            if (x < scollWidth)
            {
                x = resetWidth;
            }
        }
    }

    void Face()
    {
        Console.WriteLine("Face...");
        charlieWing.Clear();

        charlieWing.Frame = 0;
        graphics.DrawCircle(6, 3, 3);

        graphics.DrawPixel(5, 2);
        graphics.DrawPixel(7, 2);

        graphics.DrawLine(5, 4, 7, 4, true);

        charlieWing.Show(0);

        charlieWing.Frame = 1;
        graphics.DrawCircle(6, 3, 3);

        graphics.DrawPixel(5, 2);
        graphics.DrawPixel(7, 2);
        graphics.DrawPixel(5, 4);
        graphics.DrawPixel(6, 5);
        graphics.DrawPixel(7, 4);

        byte frameIndex = 0;
        for(int i = 0; i < 10;i++)
        {
            charlieWing.Show(frameIndex);

            frameIndex = (frameIndex == 0) ? (byte)1 : (byte)0;

            Thread.Sleep(1000);
        }
    }
}
Characteristic Locus
Inheritance System.Object > CharlieWing
Namespace Meadow.Foundation.FeatherWings
Assembly CharlieWing.dll

Syntax

public class CharlieWing : DisplayBase

Constructors

CharlieWing(II2cBus, CharlieWing.I2cAddress)

Declaration
public CharlieWing(II2cBus i2cBus, CharlieWing.I2cAddress address = CharlieWing.I2cAddress.Adddress0x74)

Parameters

Type Name Description
II2cBus i2cBus
CharlieWing.I2cAddress address

Fields

iS31FL3731

Declaration
protected readonly Is31fl3731 iS31FL3731

Field Value

Type Description
Is31fl3731

Properties

Brightness

Declaration
public byte Brightness { get; set; }

Property Value

Type Description
System.Byte

ColorMode

Declaration
public override DisplayColorMode ColorMode { get; }

Property Value

Type Description
DisplayColorMode

Frame

Declaration
public byte Frame { get; set; }

Property Value

Type Description
System.Byte

Height

Declaration
public override uint Height { get; }

Property Value

Type Description
System.UInt32

Width

Declaration
public override uint Width { get; }

Property Value

Type Description
System.UInt32

Methods

Clear(Boolean)

Declaration
public override void Clear(bool updateDisplay = false)

Parameters

Type Name Description
System.Boolean updateDisplay

DrawPixel(Int32, Int32)

Declaration
public override void DrawPixel(int x, int y)

Parameters

Type Name Description
System.Int32 x
System.Int32 y

DrawPixel(Int32, Int32, Color)

Declaration
public override void DrawPixel(int x, int y, Color color)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
Color color

DrawPixel(Int32, Int32, Color, Byte)

Declaration
public virtual void DrawPixel(int x, int y, Color color, byte brightness)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
Color color
System.Byte brightness

DrawPixel(Int32, Int32, Boolean)

Declaration
public override void DrawPixel(int x, int y, bool colored)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
System.Boolean colored

DrawPixel(Int32, Int32, Byte)

Declaration
public virtual void DrawPixel(int x, int y, byte brightness)

Parameters

Type Name Description
System.Int32 x
System.Int32 y
System.Byte brightness

SetPenColor(Color)

Declaration
public override void SetPenColor(Color pen)

Parameters

Type Name Description
Color pen

Show()

Declaration
public override void Show()

Show(Byte)

Declaration
public virtual void Show(byte frame)

Parameters

Type Name Description
System.Byte frame