Skip to main content

Class As1115

Represents an As1115 led driver and key scanner

Assembly: As1115.dll
View Source
public class As1115 : IGraphicsDisplay, II2cPeripheral, IDisposable

Implements:
Meadow.Foundation.Graphics.IGraphicsDisplay, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties

KeyScanButtons

Readonly collection that contains all 16 key scan button objects

View Source
public ReadOnlyDictionary<As1115.KeyScanButtonType, KeyScanButton>? KeyScanButtons { get; protected set; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

ColorMode

The display color mode (1 bit per pixel)

View Source
public ColorMode ColorMode { get; }

SupportedColorModes

The Color mode supported by the display

View Source
public ColorMode SupportedColorModes { get; }

Width

Display width in pixels for 8x8 matrix displays

View Source
public int Width { get; }

Height

Display height in pixels for 8x8 matrix displays

View Source
public int Height { get; }

PixelBuffer

The buffer that holds the pixel data for 8x8 matrix displays

View Source
public IPixelBuffer PixelBuffer { get; }

DecodeMode

The display decode mode BCD character / Hex character / Pixel

View Source
public As1115.DecodeType DecodeMode { get; }

IsDisposed

Is the peripheral disposed

View Source
public bool IsDisposed { get; }

Fields

i2cComms

I2C Communication bus used to communicate with the peripheral

View Source
protected readonly II2cCommunications i2cComms

Methods

GetButton(KeyScanButtonType)

Helper method to get IButton object references for keyscan buttons

View Source
public IButton GetButton(As1115.KeyScanButtonType buttonType)
Returns

Meadow.Peripherals.Sensors.Buttons.IButton: The button object reference

Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.As1115.KeyScanButtonTypebuttonTypeThe button type

EnableBlink(bool, bool)

Enable or disable display blinking

View Source
public void EnableBlink(bool isEnabled, bool fastBlink = true)
Parameters
TypeNameDescription
System.BooleanisEnabledDisplay will blink if true
System.BooleanfastBlinkTrue for fast blink (period of 1s), False for slow blink (period of 2s)

SetNumber(int)

Set number to display (left aligned)

View Source
public void SetNumber(int value)
Parameters
TypeNameDescription
System.Int32valuethe number to display
Exceptions

System.ArgumentOutOfRangeException

SetCharacter(BcdCharacterType, int, bool)

Set a single character

View Source
public void SetCharacter(As1115.BcdCharacterType character, int digit, bool showDecimal = false)
Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.As1115.BcdCharacterTypecharacterthe character to display
System.Int32digitthe digit index starting from the left
System.BooleanshowDecimalshow the decimal with the character

SetCharacter(HexCharacterType, int, bool)

Set a single character

View Source
public void SetCharacter(As1115.HexCharacterType character, int digit, bool showDecimal = false)
Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.As1115.HexCharacterTypecharacterthe character to display
System.Int32digitthe digit index starting from the left
System.BooleanshowDecimalshow the decimal with the character

SetIntensity(byte)

Set display intensity (0-15)

View Source
public void SetIntensity(byte intensity)
Parameters
TypeNameDescription
System.ByteintensityIntensity from 0-15 (clamps above 15)

TestMode(bool)

Enable/disable test mode

View Source
public void TestMode(bool testOn)
Parameters
TypeNameDescription
System.BooleantestOnTrue to enable, false to disable

Show()

Update the display

View Source
public void Show()

Show(int, int, int, int)

Update the display from the display buffer

View Source
public void Show(int left, int top, int right, int bottom)
Parameters
TypeName
System.Int32left
System.Int32top
System.Int32right
System.Int32bottom

Clear(bool)

Clear the display buffer

View Source
public void Clear(bool updateDisplay = false)
Parameters
TypeNameDescription
System.BooleanupdateDisplayIf true, update the display

Fill(Color, bool)

Fill the display buffer with a color Black will clear the display, any other color will turn on all leds

View Source
public void Fill(Color fillColor, bool updateDisplay = false)
Parameters
TypeNameDescription
Meadow.ColorfillColorThe color to fill
System.BooleanupdateDisplayUpdate the display

Fill(int, int, int, int, Color)

Fill a region of the display buffer with a color Black will clear the display, any other color will turn on all leds

View Source
public void Fill(int x, int y, int width, int height, Color fillColor)
Parameters
TypeNameDescription
System.Int32xX position in pixels
System.Int32yY position in pixels
System.Int32widthWidth in pixels
System.Int32heightHeight in pixels
Meadow.ColorfillColorColor to fill - Black will turn pixels off, any color will turn pixels on

DrawPixel(int, int, Color)

Draw a pixel at a given location

View Source
public void DrawPixel(int x, int y, Color color)
Parameters
TypeNameDescription
System.Int32xX position in pixels
System.Int32yY position in pixels
Meadow.ColorcolorColor to draw - Black will turn pixels off, any color will turn pixels on

DrawPixel(int, int, bool)

Draw a pixel at a given location

View Source
public void DrawPixel(int x, int y, bool enabled)
Parameters
TypeNameDescription
System.Int32xX position in pixels
System.Int32yY position in pixels
System.BooleanenabledIf true, turn led on at location

InvertPixel(int, int)

Invert pixel at location (switch on/off)

View Source
public void InvertPixel(int x, int y)
Parameters
TypeNameDescription
System.Int32xX position in pixels
System.Int32yY position in pixels

WriteBuffer(int, int, IPixelBuffer)

Write a pixel buffer to the display buffer

View Source
public void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
Parameters
TypeNameDescription
System.Int32xX position in pixels
System.Int32yY position in pixels
Meadow.Foundation.Graphics.Buffers.IPixelBufferdisplayBufferDisplay buffer to write

Dispose(bool)

Dispose of the object

View Source
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Events

KeyScanPressStarted

Event raised when any key scan button is pressed

View Source
public event EventHandler<KeyScanEventArgs> KeyScanPressStarted
Event Type

System.EventHandler<Meadow.Foundation.ICs.IOExpanders.KeyScanEventArgs>

KeyScanPressEnded

Event raised when any key scan button is released

View Source
public event EventHandler<KeyScanEventArgs> KeyScanPressEnded
Event Type

System.EventHandler<Meadow.Foundation.ICs.IOExpanders.KeyScanEventArgs>

Implements