CheeseBoard
A library for use with the CheeseBoard Cheddar platform
|
Wrapper around Adafruit_NeoPixel with Millis() correction. More...
#include <CbLeds.h>
Public Member Functions | |
CbNeoPixel (uint16_t n, uint8_t p=6, neoPixelType t=NEO_GRB+NEO_KHZ800) | |
void | show (void) |
Wrapper around Adafruit_NeoPixel with Millis() correction.
When the Adafruit_NeoPixel.show() member is called interrupts are temporarily disabled to allow the precise timing required when sending data out to the LEDs. This has a few side-effects, including a drift in the timer which is used by millis().
This is usually a small effect, but when LEDs are updated very frequently the offset can add up and become noticable. In one application, the author noticed the value of millis being 50% slower than real time!
This class is a simple sub-class of the Adafruit_NeoPixel class which estimates the offset to the millis() timer, and updates the offset for the Millis() call.
CbNeoPixel::CbNeoPixel | ( | uint16_t | n, |
uint8_t | p = 6 , |
||
neoPixelType | t = NEO_GRB+NEO_KHZ800 |
||
) |
Constructor.
Parameter names kept the same as the Adafruit_NeoPixel docs for consistency.
n | The number of LEDs in the strip. |
p | The pin for the LED data line. |
t | RGB LED type. |
Definition at line 7 of file CbLeds.cpp.
void CbNeoPixel::show | ( | void | ) |
Send updated pixel state to LEDs.
This calls Adafruit_NeoPixel.show() and then makes an adjustment to the Millis() offset, so that Millis() returns about the right time.
Definition at line 12 of file CbLeds.cpp.