IS31FL3733 Async Driver 1.0.0
Asynchronous DMA-driven IS31FL3733 LED driver for Arduino SAMD
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IS31FL3733::IS31FL3733RgbMatrix Class Reference

Convenience RGB matrix API built on top of the core async driver. More...

#include <is31fl3733_rgb_matrix.hpp>

Inheritance diagram for IS31FL3733::IS31FL3733RgbMatrix:
Inheritance graph
[legend]
Collaboration diagram for IS31FL3733::IS31FL3733RgbMatrix:
Collaboration graph
[legend]

Public Member Functions

ColorOrder GetColorOrder () const
 Get the current color order.
 
void SetColorOrder (ColorOrder order)
 Set the color order for RGB pixel mapping.
 
Constructor
 IS31FL3733RgbMatrix (TwoWire *wire, uint8_t addr=0x50, uint8_t sdbPin=0xFF, uint8_t irqPin=0xFF, ColorOrder order=ColorOrder::GRB)
 Construct RGB matrix helper with same arguments as base driver.
 
Color Helpers
void SetPixelColor32 (uint8_t row, uint8_t col, uint32_t packedRgb, bool gamma=false)
 Set a logical RGB pixel from packed 0xRRGGBB value.
 
void SetPixelHSV (uint8_t row, uint8_t col, uint16_t hue, uint8_t sat=255, uint8_t val=255, bool gamma=true)
 Set a logical RGB pixel from HSV.
 
void FillColor32 (uint32_t packedRgb, bool gamma=false)
 Fill logical matrix with packed RGB color.
 
void FillHSV (uint16_t hue, uint8_t sat=255, uint8_t val=255, bool gamma=true)
 Fill logical matrix with HSV color.
 
- Public Member Functions inherited from IS31FL3733::IS31FL3733
 IS31FL3733 (TwoWire *wire, uint8_t addr=0x50, uint8_t sdbPin=0xFF, uint8_t irqPin=0xFF)
 Construct a new IS31FL3733 driver instance.
 
 ~IS31FL3733 ()
 Destroy the driver; calls end() if begin() succeeded.
 
bool begin (uint8_t pfs=0, uint8_t pur=0b111, uint8_t pdr=0b111)
 Initialize the device (blocking for initial config).
 
void end ()
 RESET device and disable (hardware shutdown). Reads RESET register to trigger software reset, then disables device. Useful for cleanup and testing.
 
void DeviceOn ()
 Enable the device (hardware and software startup).
 
void DeviceOff ()
 Disable the device (hardware and software shutdown).
 
void SetGCC (uint8_t gcc)
 Set global current control register (Page 3 GCC).
 
void SetSWPUR (uint8_t pur)
 Set SW pull-up resistor control (Page 3 SWPUR).
 
void SetCSPDR (uint8_t pdr)
 Set CS pull-down resistor control (Page 3 CSPDR).
 
void SetPFS (uint8_t pfs)
 Set PWM frequency selection bits in CR (PFS[6:5]). Preserves other tracked CR bits (e.g., ABM enable).
 
void SetIMR (uint8_t imrMask)
 Set interrupt mask register (Common IMR).
 
void SetShortFaultMaskEnabled (bool enable)
 Control whether LEDSHORT bits are applied when computing LEDONOFF mask.
 
bool GetShortFaultMaskEnabled () const
 Returns true when LEDSHORT contributes to LEDONOFF masking.
 
bool IsPwmUpdatePending () const
 Returns true while PWM row writes are in flight or queued.
 
void SetPixelPWM (uint8_t row, uint8_t col, uint8_t pwm)
 Set PWM duty cycle for a single LED (hardware coordinates).
 
void SetRowPWM (uint8_t row, const uint8_t *pwmValues)
 Set PWM values for an entire row (hardware coordinates).
 
void BeginPwmBatch ()
 Begin a batched PWM update.
 
void EndPwmBatch (bool flush=true)
 End a batched PWM update and optionally flush queued rows.
 
void SetPixelMode (uint8_t row, uint8_t col, ABMMode mode)
 Set mode for a single LED (hardware coordinates, Page 2).
 
void SetRowMode (uint8_t row, ABMMode mode)
 Set mode for an entire row (hardware coordinates, Page 2).
 
ABMMode GetPixelMode (uint8_t row, uint8_t col) const
 Get mode for a single LED (hardware coordinates, Page 2).
 
void SetPixelColor (uint8_t row, uint8_t col, uint8_t r, uint8_t g, uint8_t b)
 Set RGB color for a logical pixel (with color order mapping).
 
void SetPixelColorMode (uint8_t row, uint8_t col, ABMMode mode)
 Set mode for a logical RGB pixel (with color order mapping).
 
void SetColorOrder (ColorOrder order)
 Set the color order for RGB pixel mapping.
 
ColorOrder GetColorOrder () const
 Get the current color order.
 
void Fill (uint8_t pwm=0)
 Fill the entire matrix with a PWM value.
 
void SetMatrixMode (ABMMode mode)
 Set mode for the entire matrix (Page 2).
 
void SetABMCallback (uint8_t abmNum, std::function< void()> callback)
 Register callback for ABM1/2/3 completion.
 
void ConfigureABM (uint8_t abmNumber, const ABMConfig &config)
 Configure ABM timing/loop registers for ABM1/2/3 on Page 3.
 
void ConfigureABM1 (const ABMConfig &config)
 Configure ABM-1 control registers (Page 3 ABM1CR..ABM1CR+4).
 
void ConfigureABM2 (const ABMConfig &config)
 Configure ABM-2 control registers (Page 3 ABM2CR..ABM2CR+4).
 
void ConfigureABM3 (const ABMConfig &config)
 Configure ABM-3 control registers (Page 3 ABM3CR..ABM3CR+4).
 
void EnableABM (bool enable=true)
 Enable or disable ABM engine in CR (Page 3).
 
void TriggerABM ()
 Latch ABM timing updates by writing TUR on Page 3.
 
const uint8_t * GetLEDOpen () const
 Get the cached LED open status (from last fault detection).
 
const uint8_t * GetLEDShort () const
 Get the cached LED short status (from last fault detection).
 
const uint8_t * GetLEDOn () const
 Get the cached LED on/off mask (last value written to LEDONOFF).
 

Static Public Member Functions

Validation Helpers
static bool IsValidRow (uint8_t row)
 Validate a logical RGB row index.
 
static bool IsValidCol (uint8_t col)
 Validate a logical RGB column index.
 

Static Public Attributes

Constants
static constexpr uint8_t kRows = 4
 Logical RGB matrix row count.
 
static constexpr uint8_t kCols = 16
 Logical RGB matrix column count.
 

Detailed Description

Convenience RGB matrix API built on top of the core async driver.

Inherits all base driver features (begin/end, ABM, raw pixel/mode control) and adds higher-level color helpers for 32-bit packed RGB and HSV.

Definition at line 21 of file is31fl3733_rgb_matrix.hpp.

Constructor & Destructor Documentation

◆ IS31FL3733RgbMatrix()

IS31FL3733::IS31FL3733RgbMatrix::IS31FL3733RgbMatrix ( TwoWire *  wire,
uint8_t  addr = 0x50,
uint8_t  sdbPin = 0xFF,
uint8_t  irqPin = 0xFF,
ColorOrder  order = ColorOrder::GRB 
)
inline

Construct RGB matrix helper with same arguments as base driver.

Parameters
wirePointer to TwoWire I2C interface.
addr7-bit I2C address (typically 0x50).
sdbPinOptional SDB (shutdown) pin (active high). Use 0xFF to disable.
irqPinOptional IRQ pin for open/short detection. Use 0xFF to disable.
orderInitial logical RGB channel order.

Definition at line 39 of file is31fl3733_rgb_matrix.hpp.

41 : IS31FL3733(wire, addr, sdbPin, irqPin) {
42 SetColorOrder(order);
43 }
void SetColorOrder(ColorOrder order)
Set the color order for RGB pixel mapping.
IS31FL3733(TwoWire *wire, uint8_t addr=0x50, uint8_t sdbPin=0xFF, uint8_t irqPin=0xFF)
Construct a new IS31FL3733 driver instance.

References SetColorOrder().

Member Function Documentation

◆ FillColor32()

void IS31FL3733::IS31FL3733RgbMatrix::FillColor32 ( uint32_t  packedRgb,
bool  gamma = false 
)
inline

Fill logical matrix with packed RGB color.

Parameters
packedRgbPacked RGB color (0xRRGGBB).
gammaIf true, applies Gamma32() before writing.

Definition at line 103 of file is31fl3733_rgb_matrix.hpp.

103 {
104 for (uint8_t row = 1; row <= kRows; row++) {
105 for (uint8_t col = 1; col <= kCols; col++) {
106 SetPixelColor32(row, col, packedRgb, gamma);
107 }
108 }
109 }
static constexpr uint8_t kRows
Logical RGB matrix row count.
void SetPixelColor32(uint8_t row, uint8_t col, uint32_t packedRgb, bool gamma=false)
Set a logical RGB pixel from packed 0xRRGGBB value.
static constexpr uint8_t kCols
Logical RGB matrix column count.

References kCols, kRows, and SetPixelColor32().

Referenced by FillHSV().

◆ FillHSV()

void IS31FL3733::IS31FL3733RgbMatrix::FillHSV ( uint16_t  hue,
uint8_t  sat = 255,
uint8_t  val = 255,
bool  gamma = true 
)
inline

Fill logical matrix with HSV color.

Parameters
hueHue (0..65535).
satSaturation (0..255).
valValue (0..255).
gammaIf true, applies Gamma32() after HSV conversion.

Definition at line 116 of file is31fl3733_rgb_matrix.hpp.

116 {
117 const uint32_t color = ColorUtils::ColorHSV(hue, sat, val);
118 FillColor32(color, gamma);
119 }
void FillColor32(uint32_t packedRgb, bool gamma=false)
Fill logical matrix with packed RGB color.

References FillColor32().

◆ GetColorOrder()

ColorOrder IS31FL3733::IS31FL3733::GetColorOrder ( ) const
inline

Get the current color order.

Returns
Current color order.

Definition at line 439 of file is31fl3733.hpp.

439 {
440 return _colorOrder;
441 }
ColorOrder _colorOrder
RGB pixel color order.

◆ IsValidCol()

static bool IS31FL3733::IS31FL3733RgbMatrix::IsValidCol ( uint8_t  col)
inlinestatic

Validate a logical RGB column index.

Parameters
colLogical column (1..kCols).
Returns
True if column is in range.

Definition at line 61 of file is31fl3733_rgb_matrix.hpp.

61 {
62 return col >= 1 && col <= kCols;
63 }

References kCols.

Referenced by SetPixelColor32().

◆ IsValidRow()

static bool IS31FL3733::IS31FL3733RgbMatrix::IsValidRow ( uint8_t  row)
inlinestatic

Validate a logical RGB row index.

Parameters
rowLogical row (1..kRows).
Returns
True if row is in range.

Definition at line 54 of file is31fl3733_rgb_matrix.hpp.

54 {
55 return row >= 1 && row <= kRows;
56 }

References kRows.

Referenced by SetPixelColor32().

◆ SetColorOrder()

void IS31FL3733::IS31FL3733::SetColorOrder ( ColorOrder  order)
inline

Set the color order for RGB pixel mapping.

Parameters
orderColor order (RGB, GRB, BRG, RBG, GBR, BGR).

Definition at line 433 of file is31fl3733.hpp.

433 {
434 _colorOrder = order;
435 }

Referenced by IS31FL3733RgbMatrix().

◆ SetPixelColor32()

void IS31FL3733::IS31FL3733RgbMatrix::SetPixelColor32 ( uint8_t  row,
uint8_t  col,
uint32_t  packedRgb,
bool  gamma = false 
)
inline

Set a logical RGB pixel from packed 0xRRGGBB value.

Parameters
rowLogical row (1..4).
colLogical column (1..16).
packedRgbPacked RGB color (0xRRGGBB).
gammaIf true, applies Gamma32() before writing.

Definition at line 73 of file is31fl3733_rgb_matrix.hpp.

73 {
74 if (!IsValidRow(row) || !IsValidCol(col)) {
75 return;
76 }
77
78 uint32_t color = gamma ? ColorUtils::Gamma32(packedRgb) : packedRgb;
79
80 const uint8_t r = static_cast<uint8_t>((color >> 16) & 0xFF);
81 const uint8_t g = static_cast<uint8_t>((color >> 8) & 0xFF);
82 const uint8_t b = static_cast<uint8_t>(color & 0xFF);
83
84 IS31FL3733::SetPixelColor(row, col, r, g, b);
85 }
static bool IsValidCol(uint8_t col)
Validate a logical RGB column index.
static bool IsValidRow(uint8_t row)
Validate a logical RGB row index.
void SetPixelColor(uint8_t row, uint8_t col, uint8_t r, uint8_t g, uint8_t b)
Set RGB color for a logical pixel (with color order mapping).

References IsValidCol(), IsValidRow(), and IS31FL3733::IS31FL3733::SetPixelColor().

Referenced by FillColor32(), and SetPixelHSV().

◆ SetPixelHSV()

void IS31FL3733::IS31FL3733RgbMatrix::SetPixelHSV ( uint8_t  row,
uint8_t  col,
uint16_t  hue,
uint8_t  sat = 255,
uint8_t  val = 255,
bool  gamma = true 
)
inline

Set a logical RGB pixel from HSV.

Parameters
rowLogical row (1..4).
colLogical column (1..16).
hueHue (0..65535).
satSaturation (0..255).
valValue (0..255).
gammaIf true, applies Gamma32() after HSV conversion.

Definition at line 94 of file is31fl3733_rgb_matrix.hpp.

95 {
96 uint32_t color = ColorUtils::ColorHSV(hue, sat, val);
97 SetPixelColor32(row, col, color, gamma);
98 }

References SetPixelColor32().

Member Data Documentation

◆ kCols

constexpr uint8_t IS31FL3733::IS31FL3733RgbMatrix::kCols = 16
staticconstexpr

Logical RGB matrix column count.

Definition at line 28 of file is31fl3733_rgb_matrix.hpp.

Referenced by FillColor32(), and IsValidCol().

◆ kRows

constexpr uint8_t IS31FL3733::IS31FL3733RgbMatrix::kRows = 4
staticconstexpr

Logical RGB matrix row count.

Definition at line 26 of file is31fl3733_rgb_matrix.hpp.

Referenced by FillColor32(), and IsValidRow().


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