Remarks
Ws2812 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Characteristic | Locus |
---|---|
Inheritance | object > Ws2812 |
Implements | ISpiPeripheral IDisposable |
Inherited Members | object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString() |
Namespace | Meadow.Foundation.Leds |
Assembly | Ws2812.dll |
Syntax
public class Ws2812 : ISpiPeripheral, IDisposable
Constructors
Ws2812(ISpiBus, IPin, int)
Creates a new WS2812 object
Declaration
public Ws2812(ISpiBus spiBus, IPin chipSelectPin, int numberOfLeds)
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spiBus | SPI bus |
IPin | chipSelectPin | Chip select pin |
int | numberOfLeds | Number of leds |
Remarks
Ws2812(ISpiBus, int, IDigitalOutputPort?)
Creates a new WS2812 object
Declaration
public Ws2812(ISpiBus spiBus, int numberOfLeds, IDigitalOutputPort? chipSelectPort = null)
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spiBus | SPI bus |
int | numberOfLeds | Number of leds |
IDigitalOutputPort | chipSelectPort | SPI chip select port (optional) |
Remarks
Fields
spiComms
SPI Communication bus used to communicate with the peripheral
Declaration
protected ISpiCommunications spiComms
Field Value
Type | Description |
---|---|
ISpiCommunications |
Remarks
Properties
DefaultSpiBusMode
The default SPI bus mode for the device
Declaration
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }
Property Value
Type | Description |
---|---|
SpiClockConfiguration.Mode |
Remarks
DefaultSpiBusSpeed
The default SPI bus speed for the device
Declaration
public Frequency DefaultSpiBusSpeed { get; }
Property Value
Type | Description |
---|---|
Frequency |
Remarks
IsDisposed
Is the object disposed
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
NumberOfLeds
Total number of leds
Declaration
public int NumberOfLeds { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
SpiBusMode
The SPI bus mode for the device
Declaration
public SpiClockConfiguration.Mode SpiBusMode { get; set; }
Property Value
Type | Description |
---|---|
SpiClockConfiguration.Mode |
Remarks
SpiBusSpeed
The SPI bus speed for the device
Declaration
public Frequency SpiBusSpeed { get; set; }
Property Value
Type | Description |
---|---|
Frequency |
Remarks
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Remarks
Dispose(bool)
Dispose of the object
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Is disposing |
Remarks
SetLed(int, Color)
Set the color of the specified LED
Declaration
public void SetLed(int index, Color color)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the LED to change |
Color | color | The color |
Remarks
SetLed(int, byte[])
Set the color of the specified LED
Declaration
public void SetLed(int index, byte[] rgb)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the LED to change |
byte[] | rgb | Byte array representing the color RGB values. byte[0] = Red, byte[1] = Green, byte[2] = Blue |
Remarks
Show()
Transmit the buffer to the LEDs
Declaration
public void Show()