eBoard ①⑧⑨
Written for SIA 2017/2018
NeoPixel Struct Reference

[NEO] this allows you to access Adafruit LED-stripes More...

#include <eagle_NeoPixel.h>

Public Member Functions

 NeoPixel (uint16_t n, uint8_t p=6, uint16_t t=((1<< 6)|(1<< 4)|(0<< 2)|(2))+0x0000)
 this is the default constructor that should be used whenever the amount of leds etc... connected is known at compile time (most cases) More...
 
 NeoPixel (void)
 the empty constructor More...
 
 ~NeoPixel (void)
 the destructor [calling free on pixel and freeing input pin] More...
 
void begin (void)
 this has to be called to start the communcation (you should call NeoPixel::setPin() before) More...
 
void show (void)
 this will reveal the setPixels [via NeoPixel::setPixelColor() etc...] More...
 
void setPin (uint8_t p)
 sets pin for communication More...
 
void setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b)
 sets the rgb color of a specific pixel More...
 
void setPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w)
 sets the rgbw color of a specific pixel More...
 
void setPixelColor (uint16_t n, uint32_t c)
 sets the rgbw color of a specific pixel More...
 
void setBrightness (uint8_t val)
 changes the brightness for all further acceses via NeoPixel::setPixelColor() More...
 
void clear (void)
 this will reset all set pixels [won't call NeoPixel::show()] More...
 
void updateLength (uint16_t n)
 this changes the length of the connected LED stripe More...
 
void updateType (uint16_t t)
 this changes the type of communication between arduino and LED stripe More...
 
uint8_t * getPixels (void) const
 this will give you access to the pixels More...
 
uint8_t getBrightness (void) const
 returns the current set brightness More...
 
int8_t getPin (void)
 this will return the set data pin More...
 
uint16_t numPixels (void) const
 returns the size of the LED stripe More...
 
uint32_t getPixelColor (uint16_t n) const
 returns the color of a specific pixel More...
 
bool canShow (void)
 this will determine if the next show is available [last show finished] More...
 

Static Public Member Functions

static uint32_t Color (uint8_t r, uint8_t g, uint8_t b)
 returns a color value that can be used with NeoPixel::setPixelColor() More...
 
static uint32_t Color (uint8_t r, uint8_t g, uint8_t b, uint8_t w)
 returns a color value that can be used with NeoPixel::setPixelColor() More...
 

Protected Attributes

bool is800KHz
 determines the speed the communcation is working on More...
 
bool begun
 true if NeoPixel::begin has been called More...
 
uint16_t numLEDs
 stores the amount of LEDs More...
 
uint16_t numBytes
 stores the byte size [pixels] used internally More...
 
int8_t pin
 stores the pin -1 if the pin wasn't set More...
 
uint8_t brightness
 stores the brightness More...
 
uint8_t * pixels
 stores the pixels More...
 
uint8_t aOffset [4]
 stores the offsets in rgbw format More...
 
uint32_t endTime
 stores the last call time of show for NeoPixel::canShow() More...
 

Detailed Description

[NEO] this allows you to access Adafruit LED-stripes

Author
Adafruit
Note
this code was documented and modified by EagleoutIce in 2018 for custom use!
Precondition
to use this class:
#define EBOARD_NEO 0x1

[NEO] You can use this class like this:

#define EBOARD_NEO 0x1
#include <eBoard.h>
//manual: '#include "/path/to/eBoard.h"'
NeoPixel nPixel = NeoPixel(5);
int main() {
nPixel.begin();
nPixel.setPixelColor(3,NeoPixel::Color(0,255,0)); //the order is based on your configuration
nPixel.show();
}

There is also an example code provided with this library, called neo_animation
If you've included eBoard as an Arduino Library it is available via the examples tab [as the corresponding .ino file]

Keep in mind:
The NeoPixel uses a one-wire interface and is therefore very timing sensitive!
You can't expect any interrupt or buffer working properly!
So you should always have a listening line that will be disabled whenever NeoPixel::show() is called

Definition at line 136 of file eagle_NeoPixel.h.

Constructor & Destructor Documentation

◆ NeoPixel() [1/2]

NeoPixel::NeoPixel ( uint16_t  n,
uint8_t  p = 6,
uint16_t  t = ((1<< 6)|(1<< 4)|(0<< 2)|(2))+0x0000 
)

this is the default constructor that should be used whenever the amount of leds etc... connected is known at compile time (most cases)

Parameters
nthe amount of LEDs connected to the pin
pthe (data) pin connected to the arduino
tthe type of com the NeoPixel should be talked to

◆ NeoPixel() [2/2]

NeoPixel::NeoPixel ( void  )

the empty constructor

Note
this has to be called manually then:

◆ ~NeoPixel()

NeoPixel::~NeoPixel ( void  )

the destructor [calling free on pixel and freeing input pin]

Member Function Documentation

◆ begin()

void NeoPixel::begin ( void  )

this has to be called to start the communcation (you should call NeoPixel::setPin() before)

Referenced by main().

+ Here is the caller graph for this function:

◆ canShow()

bool NeoPixel::canShow ( void  )
inline

this will determine if the next show is available [last show finished]

Returns
true if it is possible

◆ clear()

void NeoPixel::clear ( void  )

this will reset all set pixels [won't call NeoPixel::show()]

◆ Color() [1/2]

static uint32_t NeoPixel::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inlinestatic

returns a color value that can be used with NeoPixel::setPixelColor()

Parameters
rthe red color [can be different dependent on NeoPixel::updateType()]
gthe green color [can be different dependent on NeoPixel::updateType()]
bthe blue color [can be different dependent on NeoPixel::updateType()]

Referenced by shiftPx().

+ Here is the caller graph for this function:

◆ Color() [2/2]

static uint32_t NeoPixel::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  w 
)
inlinestatic

returns a color value that can be used with NeoPixel::setPixelColor()

Parameters
rthe red color [can be different dependent on NeoPixel::updateType()]
gthe green color [can be different dependent on NeoPixel::updateType()]
bthe blue color [can be different dependent on NeoPixel::updateType()]
wthe 'white' color [can be different dependent on NeoPixel::updateType()]

◆ getBrightness()

uint8_t NeoPixel::getBrightness ( void  ) const

returns the current set brightness

Returns
the brightness set via NeoPixel::setBrightness()

◆ getPin()

int8_t NeoPixel::getPin ( void  )

this will return the set data pin

Returns
the dataPin set via NeoPixel::setPin()

◆ getPixelColor()

uint32_t NeoPixel::getPixelColor ( uint16_t  n) const

returns the color of a specific pixel

Returns
the color value

◆ getPixels()

uint8_t* NeoPixel::getPixels ( void  ) const

this will give you access to the pixels

Returns
the pixels 'set'

◆ numPixels()

uint16_t NeoPixel::numPixels ( void  ) const

returns the size of the LED stripe

Returns
the size set via NeoPixel::updateLength()

◆ setBrightness()

void NeoPixel::setBrightness ( uint8_t  val)

changes the brightness for all further acceses via NeoPixel::setPixelColor()

Parameters
valthe brightness-value
Note
call this only once xD as this will affect timing

Referenced by main().

+ Here is the caller graph for this function:

◆ setPin()

void NeoPixel::setPin ( uint8_t  p)

sets pin for communication

Parameters
pthe (data) pin connected to the arduino

◆ setPixelColor() [1/3]

void NeoPixel::setPixelColor ( uint16_t  n,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

sets the rgb color of a specific pixel

Parameters
nthe index of the pixel (starting at 0)
rthe red color [can be different dependent on NeoPixel::updateType()]
gthe green color [can be different dependent on NeoPixel::updateType()]
bthe blue color [can be different dependent on NeoPixel::updateType()]

Referenced by shiftPx().

+ Here is the caller graph for this function:

◆ setPixelColor() [2/3]

void NeoPixel::setPixelColor ( uint16_t  n,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  w 
)

sets the rgbw color of a specific pixel

Parameters
nthe index of the pixel (starting at 0)
rthe red color [can be different dependent on NeoPixel::updateType()]
gthe green color [can be different dependent on NeoPixel::updateType()]
bthe blue color [can be different dependent on NeoPixel::updateType()]
wthe 'white' color [can be different dependent on NeoPixel::updateType()]

◆ setPixelColor() [3/3]

void NeoPixel::setPixelColor ( uint16_t  n,
uint32_t  c 
)

sets the rgbw color of a specific pixel

Parameters
nthe index of the pixel (starting at 0)
cthe NeoPixel::Color() you want

◆ show()

void NeoPixel::show ( void  )

this will reveal the setPixels [via NeoPixel::setPixelColor() etc...]

Referenced by shiftPx().

+ Here is the caller graph for this function:

◆ updateLength()

void NeoPixel::updateLength ( uint16_t  n)

this changes the length of the connected LED stripe

Parameters
nthe new length

◆ updateType()

void NeoPixel::updateType ( uint16_t  t)

this changes the type of communication between arduino and LED stripe

Parameters
tthe new type [constant starting with EBOARD_NEO]

Member Data Documentation

◆ aOffset

uint8_t NeoPixel::aOffset[4]
protected

stores the offsets in rgbw format

Definition at line 277 of file eagle_NeoPixel.h.

◆ begun

bool NeoPixel::begun
protected

true if NeoPixel::begin has been called

Definition at line 262 of file eagle_NeoPixel.h.

◆ brightness

uint8_t NeoPixel::brightness
protected

stores the brightness

Definition at line 273 of file eagle_NeoPixel.h.

◆ endTime

uint32_t NeoPixel::endTime
protected

stores the last call time of show for NeoPixel::canShow()

Definition at line 279 of file eagle_NeoPixel.h.

◆ is800KHz

bool NeoPixel::is800KHz
protected

determines the speed the communcation is working on

Definition at line 260 of file eagle_NeoPixel.h.

◆ numBytes

uint16_t NeoPixel::numBytes
protected

stores the byte size [pixels] used internally

Definition at line 266 of file eagle_NeoPixel.h.

◆ numLEDs

uint16_t NeoPixel::numLEDs
protected

stores the amount of LEDs

Definition at line 264 of file eagle_NeoPixel.h.

◆ pin

int8_t NeoPixel::pin
protected

stores the pin -1 if the pin wasn't set

Definition at line 271 of file eagle_NeoPixel.h.

◆ pixels

uint8_t* NeoPixel::pixels
protected

stores the pixels

Definition at line 275 of file eagle_NeoPixel.h.


The documentation for this struct was generated from the following file: