CheeseBoard
A library for use with the CheeseBoard Cheddar platform
Public Member Functions | List of all members
CbNeoPixel Class Reference

Wrapper around Adafruit_NeoPixel with Millis() correction. More...

#include <CbLeds.h>

Inheritance diagram for CbNeoPixel:
Inheritance graph

Public Member Functions

 CbNeoPixel (uint16_t n, uint8_t p=6, neoPixelType t=NEO_GRB+NEO_KHZ800)
 
void show (void)
 

Detailed Description

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.

Definition at line 21 of file CbLeds.h.

Constructor & Destructor Documentation

◆ CbNeoPixel()

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.

Parameters
nThe number of LEDs in the strip.
pThe pin for the LED data line.
tRGB LED type.

Definition at line 7 of file CbLeds.cpp.

Member Function Documentation

◆ show()

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.


The documentation for this class was generated from the following files: