Skip to main content

Class As1115

Represents an As1115 led driver and key scanner

Assembly: As1115.dll
View Source
Declaration
public class As1115 : IPixelDisplay, IDisplay, II2cPeripheral, IDisposable

Implements:
Meadow.Peripherals.Displays.IPixelDisplay, Meadow.Peripherals.Displays.IDisplay, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties

KeyScanButtons

Readonly collection that contains all 16 key scan button objects

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

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

ColorMode

The currently set color mode for the display

View Source
Declaration
public ColorMode ColorMode { get; }

SupportedColorModes

The Color mode supported by the display

View Source
Declaration
public ColorMode SupportedColorModes { get; }

Width

Width of the display in pixels

View Source
Declaration
public int Width { get; }

Height

Height of the display in pixels

View Source
Declaration
public int Height { get; }

PixelBuffer

Provide a buffer that matches this display's color depth, height, and width This should be the buffer that is sent to the device when Show is called

View Source
Declaration
public IPixelBuffer PixelBuffer { get; }

DecodeMode

The display decode mode BCD character / Hex character / Pixel

View Source
Declaration
public As1115.DecodeType DecodeMode { get; }

IsDisposed

Is the peripheral disposed

View Source
Declaration
public bool IsDisposed { get; }

Fields

i2cComms

I2C Communication bus used to communicate with the peripheral

View Source
Declaration
protected readonly II2cCommunications i2cComms

Methods

GetButton(KeyScanButtonType)

Helper method to get IButton object references for keyscan buttons

View Source
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
public void SetIntensity(byte intensity)
Parameters
TypeNameDescription
System.ByteintensityIntensity from 0-15 (clamps above 15)

TestMode(bool)

Enable/disable test mode

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

Show()

Update the display

View Source
Declaration
public void Show()

Show(int, int, int, int)

Update the display from the display buffer

View Source
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
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
Declaration
public void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
Parameters
TypeNameDescription
System.Int32xX position in pixels
System.Int32yY position in pixels
Meadow.Peripherals.Displays.IPixelBufferdisplayBufferDisplay buffer to write

Dispose(bool)

Dispose of the object

View Source
Declaration
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
Declaration
public void Dispose()

Events

KeyScanPressStarted

Event raised when any key scan button is pressed

View Source
Declaration
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
Declaration
public event EventHandler<KeyScanEventArgs> KeyScanPressEnded
Event Type

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

Implements

  • Meadow.Peripherals.Displays.IPixelDisplay
  • Meadow.Peripherals.Displays.IDisplay
  • Meadow.Hardware.II2cPeripheral
  • System.IDisposable