libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::NeoPixel< Transport > Class Template Reference

Device support for Adafruit Neopixel Device. More...

Detailed Description

template<typename Transport>
class daisy::NeoPixel< Transport >

Device support for Adafruit Neopixel Device.

Author
beserge
Date
December 2021

#include <neopixel.h>

Classes

struct  Config
 

Public Types

enum  Result { OK = 0 , ERR }
 
enum  ModBaseAdd {
  SEESAW_STATUS_BASE = 0x00 , SEESAW_GPIO_BASE = 0x01 , SEESAW_SERCOM0_BASE = 0x02 , SEESAW_TIMER_BASE = 0x08 ,
  SEESAW_ADC_BASE = 0x09 , SEESAW_DAC_BASE = 0x0A , SEESAW_INTERRUPT_BASE = 0x0B , SEESAW_DAP_BASE = 0x0C ,
  SEESAW_EEPROM_BASE = 0x0D , SEESAW_NEOPIXEL_BASE = 0x0E , SEESAW_TOUCH_BASE = 0x0F , SEESAW_KEYPAD_BASE = 0x10 ,
  SEESAW_ENCODER_BASE = 0x11 , SEESAW_SPECTRUM_BASE = 0x12
}
 
enum  ModAddReg {
  SEESAW_NEOPIXEL_STATUS = 0x00 , SEESAW_NEOPIXEL_PIN = 0x01 , SEESAW_NEOPIXEL_SPEED = 0x02 , SEESAW_NEOPIXEL_BUF_LENGTH = 0x03 ,
  SEESAW_NEOPIXEL_BUF = 0x04 , SEESAW_NEOPIXEL_SHOW = 0x05
}
 
enum  StatAddReg {
  SEESAW_STATUS_HW_ID = 0x01 , SEESAW_STATUS_VERSION = 0x02 , SEESAW_STATUS_OPTIONS = 0x03 , SEESAW_STATUS_TEMP = 0x04 ,
  SEESAW_STATUS_SWRST = 0x7F
}
 
typedef uint16_t neoPixelType
 

Public Member Functions

 NeoPixel ()
 
 ~NeoPixel ()
 
Result Init (Config config)
 
void Write (uint8_t reg_high, uint8_t reg_low, uint8_t *buff, uint8_t size)
 
void Write8 (uint8_t reg_high, uint8_t reg_low, uint8_t value)
 
uint8_t Read8 (uint8_t reg_high, uint8_t reg_low)
 
void ReadLen (uint8_t reg_high, uint8_t reg_low, uint8_t *buff, uint8_t len)
 
Result GetTransportError ()
 
void SWReset ()
 
void UpdateLength (uint16_t n)
 
void UpdateType (neoPixelType t)
 
bool CanShow (void)
 
void Show (void)
 
void SetPin (uint8_t p)
 
void SetPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b)
 
void SetPixelColor (uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t w)
 
void SetPixelColor (uint16_t n, uint32_t c)
 
uint32_t Color (uint8_t r, uint8_t g, uint8_t b)
 
uint32_t Color (uint8_t r, uint8_t g, uint8_t b, uint8_t w)
 
uint32_t GetPixelColor (uint16_t n) const
 
uint8_tGetPixels (void) const
 
uint16_t NumPixels (void) const
 
void Clear ()
 
void SetBrightness (uint8_t b)
 

Protected Attributes

bool is800KHz
 
bool begun
 
uint16_t numLEDs
 
uint16_t numBytes
 
int8_t pin
 
uint8_t pixelsd [256]
 
uint8_t brightness
 
uint8_tpixels
 
uint8_t rOffset
 
uint8_t gOffset
 
uint8_t bOffset
 
uint8_t wOffset
 
uint32_t endTime
 
uint16_t type
 

Member Typedef Documentation

◆ neoPixelType

Member Enumeration Documentation

◆ ModAddReg

neopixel module function address registers

Enumerator
SEESAW_NEOPIXEL_STATUS 
SEESAW_NEOPIXEL_PIN 
SEESAW_NEOPIXEL_SPEED 
SEESAW_NEOPIXEL_BUF_LENGTH 
SEESAW_NEOPIXEL_BUF 
SEESAW_NEOPIXEL_SHOW 

◆ ModBaseAdd

Module Base Addreses The module base addresses for different seesaw modules.

Enumerator
SEESAW_STATUS_BASE 
SEESAW_GPIO_BASE 
SEESAW_SERCOM0_BASE 
SEESAW_TIMER_BASE 
SEESAW_ADC_BASE 
SEESAW_DAC_BASE 
SEESAW_INTERRUPT_BASE 
SEESAW_DAP_BASE 
SEESAW_EEPROM_BASE 
SEESAW_NEOPIXEL_BASE 
SEESAW_TOUCH_BASE 
SEESAW_KEYPAD_BASE 
SEESAW_ENCODER_BASE 
SEESAW_SPECTRUM_BASE 

◆ Result

Enumerator
OK 
ERR 

◆ StatAddReg

status module function address registers

Enumerator
SEESAW_STATUS_HW_ID 
SEESAW_STATUS_VERSION 
SEESAW_STATUS_OPTIONS 
SEESAW_STATUS_TEMP 
SEESAW_STATUS_SWRST 

Constructor & Destructor Documentation

◆ NeoPixel()

template<typename Transport >
daisy::NeoPixel< Transport >::NeoPixel ( )
inline

◆ ~NeoPixel()

template<typename Transport >
daisy::NeoPixel< Transport >::~NeoPixel ( )
inline

Member Function Documentation

◆ CanShow()

template<typename Transport >
bool daisy::NeoPixel< Transport >::CanShow ( void  )
inline

◆ Clear()

template<typename Transport >
void daisy::NeoPixel< Transport >::Clear ( )
inline

◆ Color() [1/2]

template<typename Transport >
uint32_t daisy::NeoPixel< Transport >::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

◆ Color() [2/2]

template<typename Transport >
uint32_t daisy::NeoPixel< Transport >::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  w 
)
inline

◆ GetPixelColor()

template<typename Transport >
uint32_t daisy::NeoPixel< Transport >::GetPixelColor ( uint16_t  n) const
inline

◆ GetPixels()

template<typename Transport >
uint8_t * daisy::NeoPixel< Transport >::GetPixels ( void  ) const
inline

◆ GetTransportError()

template<typename Transport >
Result daisy::NeoPixel< Transport >::GetTransportError ( )
inline

Get and reset the transport error flag

Returns
Whether the transport has errored since the last check

◆ Init()

template<typename Transport >
Result daisy::NeoPixel< Transport >::Init ( Config  config)
inline

Initialize the NeoPixel device

Parameters
configConfiguration settings

◆ NumPixels()

template<typename Transport >
uint16_t daisy::NeoPixel< Transport >::NumPixels ( void  ) const
inline

◆ Read8()

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::Read8 ( uint8_t  reg_high,
uint8_t  reg_low 
)
inline

Reads an 8 bit value

Parameters
regthe register address to read from
Returns
the data uint8_t read from the device

◆ ReadLen()

template<typename Transport >
void daisy::NeoPixel< Transport >::ReadLen ( uint8_t  reg_high,
uint8_t  reg_low,
uint8_t buff,
uint8_t  len 
)
inline

◆ SetBrightness()

template<typename Transport >
void daisy::NeoPixel< Transport >::SetBrightness ( uint8_t  b)
inline

◆ SetPin()

template<typename Transport >
void daisy::NeoPixel< Transport >::SetPin ( uint8_t  p)
inline

◆ SetPixelColor() [1/3]

template<typename Transport >
void daisy::NeoPixel< Transport >::SetPixelColor ( uint16_t  n,
uint32_t  c 
)
inline

◆ SetPixelColor() [2/3]

template<typename Transport >
void daisy::NeoPixel< Transport >::SetPixelColor ( uint16_t  n,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

◆ SetPixelColor() [3/3]

template<typename Transport >
void daisy::NeoPixel< Transport >::SetPixelColor ( uint16_t  n,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  w 
)
inline

◆ Show()

template<typename Transport >
void daisy::NeoPixel< Transport >::Show ( void  )
inline

◆ SWReset()

template<typename Transport >
void daisy::NeoPixel< Transport >::SWReset ( )
inline

Perform a software reset. This resets all seesaw registers to their default values. This is called automatically from Init().

◆ UpdateLength()

template<typename Transport >
void daisy::NeoPixel< Transport >::UpdateLength ( uint16_t  n)
inline

◆ UpdateType()

template<typename Transport >
void daisy::NeoPixel< Transport >::UpdateType ( neoPixelType  t)
inline

◆ Write()

template<typename Transport >
void daisy::NeoPixel< Transport >::Write ( uint8_t  reg_high,
uint8_t  reg_low,
uint8_t buff,
uint8_t  size 
)
inline

◆ Write8()

template<typename Transport >
void daisy::NeoPixel< Transport >::Write8 ( uint8_t  reg_high,
uint8_t  reg_low,
uint8_t  value 
)
inline

Writes an 8 bit value

Parameters
regthe register address to write to
valuethe value to write to the register

Member Data Documentation

◆ begun

template<typename Transport >
bool daisy::NeoPixel< Transport >::begun
protected

◆ bOffset

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::bOffset
protected

◆ brightness

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::brightness
protected

◆ endTime

template<typename Transport >
uint32_t daisy::NeoPixel< Transport >::endTime
protected

◆ gOffset

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::gOffset
protected

◆ is800KHz

template<typename Transport >
bool daisy::NeoPixel< Transport >::is800KHz
protected

◆ numBytes

template<typename Transport >
uint16_t daisy::NeoPixel< Transport >::numBytes
protected

◆ numLEDs

template<typename Transport >
uint16_t daisy::NeoPixel< Transport >::numLEDs
protected

◆ pin

template<typename Transport >
int8_t daisy::NeoPixel< Transport >::pin
protected

◆ pixels

template<typename Transport >
uint8_t * daisy::NeoPixel< Transport >::pixels
protected

◆ pixelsd

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::pixelsd[256]
protected

◆ rOffset

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::rOffset
protected

◆ type

template<typename Transport >
uint16_t daisy::NeoPixel< Transport >::type
protected

◆ wOffset

template<typename Transport >
uint8_t daisy::NeoPixel< Transport >::wOffset
protected

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