nanoFramework.Iot.Device.Apa102 1.2.889

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Apa102 --version 1.2.889
                    
NuGet\Install-Package nanoFramework.Iot.Device.Apa102 -Version 1.2.889
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Apa102" Version="1.2.889" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Apa102" Version="1.2.889" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Apa102" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Apa102 --version 1.2.889
                    
#r "nuget: nanoFramework.Iot.Device.Apa102, 1.2.889"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.Apa102@1.2.889
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Apa102&version=1.2.889
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Apa102&version=1.2.889
                    
Install as a Cake Tool

APA102 - Double line transmission integrated control LED

APA102 is a intelligent control LED light source that the control circuit and RGB chip are integrated in a package of 5050/2020 components. It internal include 3 groups shift register and Selfdetection sign decoder circuit.

It's different from WS2812. In addition to the data line, it has a clock line. So APA102 has no strict requirements for timing. It's more friendly to devices such as Raspberry Pi that can't precisely control the timing of data lines.

There are other models like APA107, HD107s, SK9822, etc. The controls are exactly the same.

Model SCLK PWM
APA102 20 MHz 20 kHz
APA107 30 MHz 9 kHz
HD107s 40 MHz 27 kHz
SK9822 15 MHz 4.7 kHz

Documentation

Usage

Important: make sure you properly setup the SPI pins especially for ESP32 before creating the SpiDevice, make sure you install the nanoFramework.Hardware.ESP32 nuget:

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the SPI GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.SPI1_MOSI);
Configuration.SetPinFunction(22, DeviceFunction.SPI1_MISO);
Configuration.SetPinFunction(23, DeviceFunction.SPI1_CLOCK);
// Make sure as well you are using the right chip select

For other devices like STM32, please make sure you're using the pre-set pins for the SPI bus you want to use. The chip select can as well be pre setup.

Here is an example how to use the APA102:

using System;
using System.Device.Spi;
using System.Drawing;
using System.Threading;
using Iot.Device.Apa102;

var random = new Random();

using SpiDevice spiDevice = SpiDevice.Create(new SpiConnectionSettings(1, 42)
{
    ClockFrequency = 20_000_000,
    DataFlow = DataFlow.MsbFirst,
    Mode = SpiMode.Mode0 // ensure data is ready at clock rising edge
});
using Apa102 apa102 = new Apa102(spiDevice, 16);

while (true)
{
    for (var i = 0; i < apa102.Pixels.Length; i++)
    {
        apa102.Pixels[i] = Color.FromArgb(255, random.Next(256), random.Next(256), random.Next(256));
    }

    apa102.Flush();
    Thread.Sleep(1000);
}
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.889 97 7/28/2025
1.2.869 215 4/2/2025
1.2.864 197 4/2/2025
1.2.852 219 3/11/2025
1.2.846 216 3/10/2025
1.2.822 156 2/26/2025
1.2.785 160 2/4/2025
1.2.776 158 2/4/2025
1.2.775 156 2/4/2025
1.2.772 145 2/4/2025
1.2.759 141 1/31/2025
1.2.755 155 1/31/2025
1.2.743 153 1/20/2025
1.2.737 118 1/13/2025
1.2.718 154 12/30/2024
1.2.696 159 12/16/2024
1.2.673 155 10/23/2024
1.2.665 150 10/16/2024
1.2.656 155 10/3/2024
1.2.651 166 9/27/2024
1.2.639 169 9/6/2024
1.2.631 160 8/28/2024
1.2.613 180 8/9/2024
1.2.601 145 7/26/2024
1.2.590 184 7/17/2024
1.2.580 162 6/28/2024
1.2.573 169 6/19/2024
1.2.570 190 6/14/2024
1.2.560 180 5/29/2024
1.2.548 164 5/15/2024
1.2.536 183 4/15/2024
1.2.514 181 3/22/2024
1.2.494 183 2/28/2024
1.2.474 193 1/24/2024
1.2.462 206 1/5/2024
1.2.458 207 12/20/2023
1.2.436 217 11/10/2023
1.2.403 203 10/6/2023
1.2.396 190 9/27/2023
1.2.384 221 9/6/2023
1.2.378 223 8/16/2023
1.2.369 254 8/2/2023
1.2.363 231 7/28/2023
1.2.357 225 7/19/2023
1.2.354 226 7/14/2023
1.2.345 236 6/21/2023
1.2.341 234 6/14/2023
1.2.337 282 6/7/2023
1.2.335 279 6/2/2023
1.2.329 269 5/26/2023
1.2.313 259 5/12/2023
1.2.308 256 5/11/2023
1.2.304 251 5/10/2023
1.2.302 270 5/10/2023
1.2.297 278 5/3/2023
1.2.273 338 3/17/2023
1.2.267 330 3/10/2023
1.2.263 334 3/8/2023
1.2.259 337 2/27/2023
1.2.256 372 2/24/2023
1.2.253 366 2/22/2023
1.2.222 417 1/9/2023
1.2.212 428 1/5/2023
1.2.208 419 1/3/2023
1.2.203 406 12/28/2022
1.2.159 460 11/14/2022
1.2.153 487 11/5/2022
1.2.141 525 10/25/2022
1.2.122 589 10/12/2022
1.2.114 503 10/8/2022
1.2.95 544 9/22/2022
1.2.87 652 9/15/2022
1.2.73 554 9/8/2022
1.2.63 545 9/3/2022
1.2.47 531 8/15/2022
1.2.40 585 8/6/2022
1.2.38 587 8/5/2022
1.2.28 573 8/1/2022
1.2.13 574 7/24/2022
1.2.10 549 7/23/2022
1.2.5 602 7/13/2022
1.1.145.58726 563 7/7/2022
1.1.141.41205 570 7/6/2022
1.1.133.52556 573 6/30/2022
1.1.121.35854 573 6/26/2022
1.1.116.8772 571 6/24/2022
1.1.113.2032 560 6/23/2022
1.1.102.51394 554 6/15/2022
1.1.99.36719 559 6/14/2022
1.1.72.29765 567 5/31/2022
1.1.64.21380 570 5/26/2022
1.1.54.28879 600 5/23/2022
1.1.40 576 5/5/2022
1.1.27 605 4/26/2022
1.1.20 625 4/21/2022
1.1.3 594 4/15/2022
1.1.1 602 4/14/2022
1.0.300 574 3/31/2022
1.0.288-preview.114 208 3/25/2022
1.0.288-preview.113 202 3/25/2022
1.0.288-preview.110 207 3/25/2022
1.0.288-preview.103 211 3/21/2022
1.0.288-preview.100 202 3/19/2022
1.0.288-preview.99 213 3/18/2022
1.0.288-preview.98 197 3/18/2022
1.0.288-preview.93 201 3/15/2022
1.0.288-preview.86 217 3/8/2022
1.0.288-preview.77 215 2/27/2022
1.0.288-preview.75 211 2/26/2022
1.0.288-preview.73 205 2/25/2022
1.0.288-preview.65 200 2/18/2022
1.0.288-preview.63 207 2/16/2022
1.0.288-preview.61 220 2/12/2022
1.0.288-preview.58 216 2/10/2022
1.0.288-preview.53 211 2/9/2022
1.0.288-preview.48 217 2/4/2022
1.0.288-preview.41 226 1/31/2022
1.0.288-preview.29 233 1/28/2022
1.0.288-preview.22 218 1/27/2022
1.0.288-preview.20 220 1/27/2022
1.0.288-preview.19 238 1/27/2022
1.0.288-preview.18 220 1/27/2022
1.0.288-preview.5 223 1/24/2022
1.0.288-preview.1 210 1/21/2022
1.0.272 261 1/10/2022
1.0.270 450 1/6/2022
1.0.259 475 12/9/2021
1.0.258 472 12/7/2021
1.0.243 6,085 11/23/2021
1.0.242 6,365 11/23/2021
1.0.221 256 10/19/2021
1.0.219 264 10/19/2021
1.0.218 290 10/18/2021
1.0.157 461 9/4/2021
1.0.155 464 8/31/2021
1.0.153 254 8/14/2021
1.0.151 269 8/6/2021
1.0.146 262 7/22/2021
1.0.136 335 7/17/2021
1.0.135 258 7/16/2021
1.0.134 271 7/15/2021
1.0.133 287 7/14/2021
1.0.129 255 7/6/2021
1.0.127 274 7/5/2021
1.0.125 292 7/5/2021
1.0.122 311 6/30/2021
1.0.121 309 6/29/2021
1.0.119 326 6/28/2021
1.0.111 288 6/14/2021
1.0.105 376 5/29/2021
1.0.104 343 5/29/2021
1.0.97 273 5/28/2021
1.0.63 271 5/26/2021
1.0.23 325 5/21/2021