A Class representing a WS2812 or compatible RGB LED string connected to a Serial Wombat pin.
More...
|
| SerialWombatWS2812 (SerialWombatChip &serialWombat) |
| Constructor for SerialWombatWS2812 class. More...
|
|
int16_t | begin (uint8_t pin, uint8_t numberOfLEDs, uint16_t userBufferIndex) |
| Initialize a WS2812 LED driver object. More...
|
|
int16_t | write (uint8_t led, uint32_t color) |
| Set an LED color. More...
|
|
int16_t | write (uint8_t led, int16_t color) |
| An overload for Write in case write(x,0); is interpreted as an int16_t rather than uint32_t. More...
|
|
int16_t | write (uint8_t led, int32_t color) |
| An overload for Write in case write(x,0); is interpreted as an int32_t rather than uint32_t. More...
|
|
int16_t | write (uint8_t led, uint8_t length, uint32_t colors[]) |
|
int16_t | writeAnimationLED (uint8_t frame, uint8_t led, uint32_t color) |
|
int16_t | writeAnimationLED (uint8_t frame, uint8_t led, int16_t color) |
| An overload color is interpreted as an int16_t rather than uint32_t. More...
|
|
int16_t | writeAnimationLED (uint8_t frame, uint8_t led, int32_t color) |
| An overload color is interpreted as an int32_t rather than uint32_t. More...
|
|
int16_t | writeAnimationFrame (uint8_t frame, uint32_t colors[]) |
| Store an array of colors for an entire animation frame. More...
|
|
int16_t | writeAnimationFrameDelay (uint8_t frame, uint16_t delay_mS) |
| Set how long an animation frame should be displayed before moving to the next frame. More...
|
|
int16_t | writeAnimationUserBufferIndex (uint16_t index, uint8_t numberOfFrames) |
| set the location in UserBuffer where the animation array will be stored and number of frames More...
|
|
int16_t | readBufferSize () |
| returns the number of bytes of UserBuffer required to service the configured number of LEDs More...
|
|
int16_t | writeMode (SWWS2812Mode mode) |
| Sets the mode of the WS2812 LED Driver. More...
|
|
int16_t | barGraph (uint8_t sourcePin, uint32_t offRGB, uint32_t onRGB, uint16_t min, uint16_t max) |
| Display a bargraph using the configured ws2812 class. More...
|
|
| SerialWombatPin (SerialWombatChip &serialWombatChip) |
| Instantiates a Serial Wombat Pin. More...
|
|
| SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin) |
| Instantiates a Serial Wombat Pin. More...
|
|
uint16_t | readPublicData () |
| Read the 16 Bit public data associated with this pin. More...
|
|
void | pinMode (uint8_t mode, bool pullDown=false, bool openDrain=false) |
| Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings. More...
|
|
void | digitalWrite (uint8_t val) |
| Set output pin High or Low. More...
|
|
int | digitalRead () |
| Reads the state of the Pin. More...
|
|
uint16_t | writePublicData (uint16_t value) |
| Write a 16 bit value to this pin. More...
|
|
uint8_t | pin () |
| Returns the current SW pin number. Used primarily for virtual calls by derived classes. More...
|
|
uint8_t | swPinModeNumber () |
| Returns the Mode number. Used primarily by derived classes to populate packet data. More...
|
|
int16_t | initPacketNoResponse (uint8_t packetNumber, uint8_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55, uint8_t param4=0x55) |
|
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55) |
|
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0, uint16_t param1, uint8_t param2=0x55) |
|
int16_t | disable () |
| Disables the pin mode (if applicable) More...
|
|
A Class representing a WS2812 or compatible RGB LED string connected to a Serial Wombat pin.
This class is only supported on the Serial Wombat SW18AB chip. It is not supported on the Serial Wombat 4X line. This pin mode can only be used on enhanced capability pins (WP0-4, WP7, or WP9-19)
This class controls a State Machine driven driver for a WS2812 compatible RGB LED string.
Each instance of this class uses an average of approximately TBD% of the SW18's processing time. This varies by configuration options and usage.
The Serial Wombat WS2812 driver can be configured in a number of ways: The driver lights up the LEDs one at a time in sequence The driver shows colors as commanded by the host The driver cycles through arrays of colors at a specified rate
See the available examples in the Arduino Library for usage.
- Warning
- Different WS2812 pcbs behave differently based on how the manufacturer routed the LEDs on the PCB Board. For instance a square 4x4 matrix may not light in the order expected. This is not an issue with the library.
-
An array of WS2812 LEDs can pull lots of current. Lighting multiple LEDs at full brightness may consume more power than your supply can provide, causing the system voltage to become unstable. An unstable system voltage can cause unreliable operation of the Serial Wombat chip.
The Serial Wombat WS2812 driver is extremely efficient in terms of processor time since it uses the PIC24FJ256GA702's DMA and SPI hardware to generate the WS2812 signal. This allows the Serial Wombat firmware to easily clock out WS2812 signals while doing other thigns. However, this method is very RAM intensive, requiring about 50 bytes of ram for each LED.
The RAM used for buffering this signal is stored in the User Buffer RAM, an array available for the user to allocate to various PIN modes' uses. In Version 2.0.3 of the Serial Wombat 18AB firmware there is 8k of RAM allocated to User Buffer, allowing about 160 LEDs to be used if all RAM is allocated to the WS2812.
A number of frames to be shown in rotation with configurable delays inbetween can also be stored in the User Buffer. This is in additional to the rendering buffer. Each animation frame requires 2+3*NumberOfLEDs bytes.
The Update rate is variable with the number of LEDs so that rendering of colors into the User Buffer is spread across multiple Serial Wombat 1mS execution frames. The LEDs will be updated approximately every X mS, where X is the number of LEDs plus 20.
A tutorial is available here:
https://youtu.be/WoXvLBJFpXk