eBoard ๐Ÿ‰  โ‘ โ‘งโ‘จ
Written for SIA 2017/2018
NeoPixel Struct Reference

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

#include <eBoard.h>

Public Member Functions

 NeoPixel (uint16_t n, uint8_t p=6, uint16_t t=((0<< 6)|(0<< 4)|(1<< 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...
 
uint8_t sine8 (uint8_t x) const
 acces to the sine-8-bit table ;D More...
 
uint8_t gamma8 (uint8_t x) const
 acces to the gamma-correction-8-bit table ;D 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 rOffset
 stores the red color offset More...
 
uint8_t gOffset
 stores the green color offset More...
 
uint8_t bOffset
 stores the blue color offset More...
 
uint8_t wOffset
 stores the white color offset More...
 
uint32_t endTime
 stores the last call time of show for NeoPixel::canShow() More...
 
volatile uint8_t * port
 the used port register More...
 
uint8_t pinMask
 the used pinMask 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 "/home/eagleoutice/Dokumente/proj/_sia/src/eBoard.h"
NeoPixel nPixel = NeoPixel(5);
int main() {
nPixel.setPixelColor(3,NeoPixel::Color(0,255,0));
nPixel.show();
}

Definition at line 4312 of file eBoard.h.

Constructor & Destructor Documentation

◆ NeoPixel() [1/2]

NeoPixel::NeoPixel ( uint16_t  n,
uint8_t  p = 6,
uint16_t  t = ((0<< 6)|(0<< 4)|(1<< 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)

◆ 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()]

◆ 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()]

◆ gamma8()

uint8_t NeoPixel::gamma8 ( uint8_t  x) const

acces to the gamma-correction-8-bit table ;D

Parameters
xthe correction index
Returns
the corresponding gamma correction

◆ getBrightness()

uint8_t NeoPixel::getBrightness ( void  ) const
inline

returns the current set brightness

Returns
the brightness set via NeoPixel::setBrightness()

◆ getPin()

int8_t NeoPixel::getPin ( void  )
inline

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
inline

this will give you access to the pixels

Returns
the pixels 'set'

◆ numPixels()

uint16_t NeoPixel::numPixels ( void  ) const
inline

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

◆ 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()]

◆ 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...]

◆ sine8()

uint8_t NeoPixel::sine8 ( uint8_t  x) const

acces to the sine-8-bit table ;D

Parameters
xthe x-value in sin(x)
Returns
the corresponding y-value

◆ 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

◆ begun

bool NeoPixel::begun
protected

true if NeoPixel::begin has been called

Definition at line 4447 of file eBoard.h.

◆ bOffset

uint8_t NeoPixel::bOffset
protected

stores the blue color offset

Definition at line 4466 of file eBoard.h.

◆ brightness

uint8_t NeoPixel::brightness
protected

stores the brightness

Definition at line 4458 of file eBoard.h.

◆ endTime

uint32_t NeoPixel::endTime
protected

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

Definition at line 4470 of file eBoard.h.

◆ gOffset

uint8_t NeoPixel::gOffset
protected

stores the green color offset

Definition at line 4464 of file eBoard.h.

◆ is800kHz

bool NeoPixel::is800kHz
protected

determines the speed the communcation is working on

Definition at line 4445 of file eBoard.h.

◆ numBytes

uint16_t NeoPixel::numBytes
protected

stores the byte size [pixels] used internally

Definition at line 4451 of file eBoard.h.

◆ numLEDs

uint16_t NeoPixel::numLEDs
protected

stores the amount of LEDs

Definition at line 4449 of file eBoard.h.

◆ pin

int8_t NeoPixel::pin
protected

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

Definition at line 4456 of file eBoard.h.

◆ pinMask

uint8_t NeoPixel::pinMask
protected

the used pinMask

Definition at line 4475 of file eBoard.h.

◆ pixels

uint8_t* NeoPixel::pixels
protected

stores the pixels

Definition at line 4460 of file eBoard.h.

◆ port

volatile uint8_t* NeoPixel::port
protected

the used port register

Definition at line 4473 of file eBoard.h.

◆ rOffset

uint8_t NeoPixel::rOffset
protected

stores the red color offset

Definition at line 4462 of file eBoard.h.

◆ wOffset

uint8_t NeoPixel::wOffset
protected

stores the white color offset

Definition at line 4468 of file eBoard.h.


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