Skip to content

Zyklop/AzureSphereLedLibs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

91c1ff5 · Nov 17, 2019

History

10 Commits
Nov 17, 2019
Nov 2, 2019
Nov 2, 2019
Nov 2, 2019
Nov 11, 2019

Repository files navigation

AzureSphereLedLibs

Led driver libraries for Azure Sphere

Supported Features

  • Driving Rgb-Leds and and simple rgb-led strips with PWM
  • Driving Apa102 and similar leds using SPI

Wiring

Single rgb led

  1. Connect the color channels to 3 pwm-enabled gpio pins
  2. Connect the leds ground to a ground pin

Rgb led strip

  1. Connect 3 pwm enabled gpio-pins to your booster circuit
  2. Connect the boosters output to your led-strip
  3. Connect the boosters positive input to a power-supply
  4. Connect the the boosters ground to the power supply and to the Sphere's ground

Apa 102 leds

  1. Connect the SPI-CLK pin to the led's CI connection
  2. Connect the SPI-MOSI pin to the led's DI connection
  3. Connect the led's 5v to a power supply
  4. Connect the led's GND to the power supply and to Sphere's GND pin

Usage

Use the provided samples or start from scratch

Pwm

  1. Find the controller_id and the ids of the pins you connected to
  2. Add "Pwm": [ "PWM-CONTROLLER-{yourControllerId}" ] to the applications manifest capabilities
  3. Add the setup and teardow methods:
SetupPwm(unsigned int controller_id, uint32_t redPin, uint32_t greenPin, uint32_t bluePin);
Teardown();
  1. Set the desired color by using the color-srtruct or by setting the values directly
SetColor(struct Color color);
SetColorFromInt(int red, int green, int blue);
SetColorFromBytes(uint8_t red, uint8_t green, uint8_t blue);

Apa 102

  1. Find the interface_id and the chipselct_id of the interface you used
  2. Add "SpiMaster": [ "ISU{interface_id}" ] to the applications manifest capabilities
  3. Add the setup and teardow methods:
SetupApa102(int interfaceId, int chipSelectId);
Teardown();

4.1. Set the whole strip to a solid color: SetSolid(struct ColorWithBrightness color, int length);

4.2. Set the whole strip to custom colors: SetCustom(struct ColorWithBrightness *color, int length);

4.3. Stream colors to the leds, from the first to the last:

PrepareForStreaming();
while(?)
{
  AppendColor(struct ColorWithBrightness color);
}
FinishStreaming();

About

Led Libraries for Azure Sphere

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published