Adafruit IS31FL3741 Library
Public Member Functions | Protected Attributes | List of all members
Adafruit_IS31FL3741_buffered Class Reference

Class for a "buffered" Lumissil IS31FL3741 LED driver – LED PWM state is staged in RAM (requiring 352 extra bytes vs base class) and sent to device only when show() is called. Otherwise functionally identical. LED scaling values (vs PWM) are NOT staged in RAM and are issued individually as normal; scaling is infrequently used and not worth the extra memory it would incur. More...

#include <Adafruit_IS31FL3741.h>

Inheritance diagram for Adafruit_IS31FL3741_buffered:
Adafruit_IS31FL3741 Adafruit_IS31FL3741_colorGFX_buffered Adafruit_EyeLights_buffered Adafruit_IS31FL3741_EVB_buffered Adafruit_IS31FL3741_QT_buffered

Public Member Functions

 Adafruit_IS31FL3741_buffered ()
 Constructor for buffered IS31FL3741. LED data is stored in RAM and only pushed to device when show() is explicitly called.
 
bool begin (uint8_t addr=IS3741_ADDR_DEFAULT, TwoWire *theWire=&Wire)
 Initialize I2C and IS31FL3741 hardware, clear LED buffer. More...
 
void show (void)
 Push buffered LED data from RAM to device. More...
 
uint8_t * getBuffer (void)
 Return address of LED buffer. More...
 
- Public Member Functions inherited from Adafruit_IS31FL3741
 Adafruit_IS31FL3741 ()
 Constructor for IS31FL3741 LED driver.
 
bool begin (uint8_t addr=IS3741_ADDR_DEFAULT, TwoWire *theWire=&Wire)
 Initialize I2C and IS31FL3741 hardware. More...
 
bool reset (void)
 Perform software reset, update all registers to POR values. More...
 
bool enable (bool en)
 Enable/disable output via the shutdown register bit. More...
 
bool unlock (void)
 Allows changing of command register by writing 0xC5 to 0xFE. More...
 
bool setGlobalCurrent (uint8_t current)
 Set global current-mirror from 0 (off) to 255 (brightest). More...
 
uint8_t getGlobalCurrent (void)
 Get the global current-mirror register setting. More...
 
bool setLEDscaling (uint16_t lednum, uint8_t scale)
 Set the scaling level for a single LED. More...
 
bool setLEDscaling (uint8_t scale)
 Set the scaling level for all LEDs. Optimized for fewer I2C transfers vs. setting each individually. More...
 
bool setLEDPWM (uint16_t lednum, uint8_t pwm)
 Set the PWM level for a single LED. More...
 
bool fill (uint8_t fillpwm=0)
 Set the PWM value for all LEDs - great for clearing the whole display at once. Optimized for fewer I2C transfers vs. setting each individually. More...
 
void show (void)
 Empty function makes direct & buffered code more interchangeable. Direct classes have an immediate effect when setting LED states, only buffered ones need an explicit call to show(), but it gets annoying when moving code back and forth. So this does nothing in the direct case. For code that you KNOW will always be strictly unbuffered, don't call this, it sets a bad precedent.
 

Protected Attributes

uint8_t ledbuf [352]
 LEDs in RAM. +1 byte is intentional, see show()
 
- Protected Attributes inherited from Adafruit_IS31FL3741
int8_t _page = -1
 Cached value of the page we're currently addressing.
 
Adafruit_I2CDevice * _i2c_dev = NULL
 Pointer to I2C device.
 

Additional Inherited Members

- Static Public Member Functions inherited from Adafruit_IS31FL3741
static uint16_t color565 (uint8_t red, uint8_t green, uint8_t blue)
 Converter for RGB888-format color (separate) to RGB565-format. More...
 
static uint16_t color565 (uint32_t color)
 Converter for RGB888-format color (packed) to RGB565-format. More...
 
static uint32_t Color (uint8_t r, uint8_t g, uint8_t b)
 Convert separate red, green and blue values into a single "packed" 24-bit RGB color. More...
 
static uint8_t gamma8 (uint8_t x)
 An 8-bit gamma-correction function for basic pixel brightness adjustment. Makes color transitions appear more perceptially correct. More...
 
static uint32_t gamma32 (uint32_t x)
 A gamma-correction function for 32-bit packed RGB colors. Makes color transitions appear more perceptially correct. More...
 
static uint32_t ColorHSV (uint16_t hue, uint8_t sat=255, uint8_t val=255)
 Convert hue, saturation and value into a packed 32-bit RGB color that can be passed to setPixelColor() or Color565(). Swiped directly from Adafruit_NeoPixel. More...
 
- Protected Member Functions inherited from Adafruit_IS31FL3741
bool selectPage (uint8_t page)
 Select a given bank/page in the chip memory for subsequent reads/writes. More...
 
bool setLEDvalue (uint8_t first_page, uint16_t lednum, uint8_t value)
 Set either the PWM or scaling level for a single LED; used by the setLEDPWM() and setLEDscaling() functions, not directly. More...
 
bool fillTwoPages (uint8_t first_page, uint8_t value)
 Fill two pages of IS31FL3741 registers related to PWM levels or scaling; used by the fill() and setLEDscaling() functions, not directly. More...
 

Detailed Description

Class for a "buffered" Lumissil IS31FL3741 LED driver – LED PWM state is staged in RAM (requiring 352 extra bytes vs base class) and sent to device only when show() is called. Otherwise functionally identical. LED scaling values (vs PWM) are NOT staged in RAM and are issued individually as normal; scaling is infrequently used and not worth the extra memory it would incur.

Member Function Documentation

◆ begin()

bool Adafruit_IS31FL3741_buffered::begin ( uint8_t  addr = IS3741_ADDR_DEFAULT,
TwoWire *  theWire = &Wire 
)

Initialize I2C and IS31FL3741 hardware, clear LED buffer.

Parameters
addrI2C address where we expect to find the chip.
theWirePointer to TwoWire I2C bus to use, defaults to &Wire.
Returns
true on success, false if chip isn't found.

◆ show()

void Adafruit_IS31FL3741_buffered::show ( void  )

Push buffered LED data from RAM to device.

Note
This looks a lot like the base class' fillTwoPages() function, but works differently and they are not interchangeable or refactorable into a single function. This relies on the LED buffer that's part of the Adafruit_IS31FL3741_buffered object and does some temporary element swaps to make larger transfers if the host device allows. Really, don't.

◆ getBuffer()

uint8_t* Adafruit_IS31FL3741_buffered::getBuffer ( void  )
inline

Return address of LED buffer.

Returns
uint8_t* Pointer to first LED position in buffer.

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