Class As1115
Represents an As1115 led driver and key scanner
Assembly: As1115.dll
View Source
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
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 currently set color mode for the display
View Source
public ColorMode ColorMode { get; }
SupportedColorModes
The Color mode supported by the display
View Source
public ColorMode SupportedColorModes { get; }
Width
Width of the display in pixels
View Source
public int Width { get; }
Height
Height of the display in pixels
View Source
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
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
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.As1115.KeyScanButtonType | buttonType | The button type |
EnableBlink(bool, bool)
Enable or disable display blinking
View Source
public void EnableBlink(bool isEnabled, bool fastBlink = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isEnabled | Display will blink if true |
System.Boolean | fastBlink | True 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
Type | Name | Description |
---|---|---|
System.Int32 | value | the 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
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.As1115.BcdCharacterType | character | the character to display |
System.Int32 | digit | the digit index starting from the left |
System.Boolean | showDecimal | show 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
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.As1115.HexCharacterType | character | the character to display |
System.Int32 | digit | the digit index starting from the left |
System.Boolean | showDecimal | show the decimal with the character |
SetIntensity(byte)
Set display intensity (0-15)
View Source
public void SetIntensity(byte intensity)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | intensity | Intensity from 0-15 (clamps above 15) |
TestMode(bool)
Enable/disable test mode
View Source
public void TestMode(bool testOn)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | testOn | True 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
Type | Name |
---|---|
System.Int32 | left |
System.Int32 | top |
System.Int32 | right |
System.Int32 | bottom |
Clear(bool)
Clear the display buffer
View Source
public void Clear(bool updateDisplay = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | updateDisplay | If 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
Type | Name | Description |
---|---|---|
Meadow.Color | fillColor | The color to fill |
System.Boolean | updateDisplay | Update 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
Type | Name | Description |
---|---|---|
System.Int32 | x | X position in pixels |
System.Int32 | y | Y position in pixels |
System.Int32 | width | Width in pixels |
System.Int32 | height | Height in pixels |
Meadow.Color | fillColor | Color 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
Type | Name | Description |
---|---|---|
System.Int32 | x | X position in pixels |
System.Int32 | y | Y position in pixels |
Meadow.Color | color | Color 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
Type | Name | Description |
---|---|---|
System.Int32 | x | X position in pixels |
System.Int32 | y | Y position in pixels |
System.Boolean | enabled | If 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
Type | Name | Description |
---|---|---|
System.Int32 | x | X position in pixels |
System.Int32 | y | Y 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
Type | Name | Description |
---|---|---|
System.Int32 | x | X position in pixels |
System.Int32 | y | Y position in pixels |
Meadow.Peripherals.Displays.IPixelBuffer | displayBuffer | Display buffer to write |
Dispose(bool)
Dispose of the object
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Is 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
Meadow.Peripherals.Displays.IPixelDisplay
Meadow.Peripherals.Displays.IDisplay
Meadow.Hardware.II2cPeripheral
System.IDisposable