IS31FL3733 Async Driver 1.0.0
Asynchronous DMA-driven IS31FL3733 LED driver for Arduino SAMD
Loading...
Searching...
No Matches
Classes | Private Attributes | List of all members
IS31FL3733::IS31FL3733 Class Reference

Asynchronous DMA-driven IS31FL3733 LED driver for SAMD SERCOM I2C. More...

#include <is31fl3733.hpp>

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

Classes

struct  CmdTxnContext
 Context passed to SERCOM ISR callback for command-chain transactions. More...
 

Public Member Functions

Constructor / Destructor
 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.
 
Initialization
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.
 
Device Control
void DeviceOn ()
 Enable the device (hardware and software startup).
 
void DeviceOff ()
 Disable the device (hardware and software shutdown).
 
Runtime Configuration (Page 3/Common)
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.
 
PWM & ABM Control (Raw Hardware Interface)
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).
 
RGB Pixel Control (Logical Coordinates with Color Order)
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.
 
Bulk Operations
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.
 
ABM Page 3 Control
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.
 
Fault Detection (Read-Only)
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).
 

Private Member Functions

Private Methods (Transaction Management)
void _sendRowPWM ()
 Dequeue and transmit next pending PWM row.
 
void _sendRowMode ()
 Dequeue and transmit next pending ABM row.
 
void _ensurePage (uint8_t page)
 Ensure we're on the target page (skips if already there, enqueues unlock + page-select if needed).
 
void _resumeDataTransfers ()
 Restore Page 1, clear _pwmLocked, resume PWM writes.
 
void _asyncWrite (uint16_t pagereg, const uint8_t *data, uint8_t len, void(*callback)(void *, int)=nullptr, void *user=nullptr)
 Generic async write helper (inline for performance).
 
void _asyncRead (uint16_t pagereg, uint8_t *dest, uint8_t len, void(*callback)(void *, int)=nullptr, void *user=nullptr)
 Generic async read helper (inline for performance).
 
bool _syncWrite (uint16_t pagereg, const uint8_t *data, uint8_t len)
 Blocking write helper used by begin() setup flow.
 
bool _syncRead (uint16_t pagereg, uint8_t *dest, uint8_t len)
 Blocking read helper used by begin() setup flow.
 

Static Private Member Functions

Static Callbacks
static void _txnCallback (void *user, int status)
 PWM row transaction callback, enqueues the next pending row if any.
 
static void _txnModeCallback (void *user, int status)
 ABM row transaction callback, enqueues the next pending mode row if any.
 
static void _irqCallback ()
 GPIO IRQ callback (triggered by IRQ pin edge).
 
static void _onServiceCallback (void *user, int status)
 ISR completion callback (processes _lastISR after F1h read).
 
static void _cmdCallback (void *user, int status)
 Command transaction callback (triggered by SERCOM ISR).
 
static void _osbCallback (void *user, int status)
 Open/Short detection callback (updates LED On/Off mask).
 
static void _abm1CallbackWrapper ()
 Static wrappers for ABM completion callback dispatch (PendSV-safe entry points).
 
static void _abm2CallbackWrapper ()
 Dispatch ABM2 completion callback on a safe context.
 
static void _abm3CallbackWrapper ()
 Dispatch ABM3 completion callback on a safe context.
 

Private Attributes

bool _begun
 True after successful begin(); used for destructor auto-end safety.
 
PWM Matrix and Transaction State (Page 1)
uint8_t _pwm_matrix [kHardwareRows][kHardwareCols+1]
 [row][0] = Page 1 row addr, [1..16] = PWM data
 
SercomTxn _pwmTxn
 Single in-flight PWM transaction descriptor.
 
uint8_t _pwmTxPtr [kHardwareCols+1]
 Shadow buffer for current transaction.
 
RingBufferN< kHardwareRows+1 > _pwmPendingRows
 Effective capacity: kHardwareRows.
 
uint16_t _pwmEnqueued
 Bitfield tracking enqueued rows (0x0001..0x0FFF)
 
bool _pwmLocked
 True when command chain has preempted PWM.
 
bool _pwmBatchActive
 True while staged PWM updates are being batched.
 
Mode Matrix and Transaction State (Page 2)
uint8_t _abm_matrix [kHardwareRows][kHardwareCols+1]
 [row][0] = Page 2 row addr, [1..16] = ABM data
 
SercomTxn _abmTxn
 Single in-flight ABM transaction descriptor.
 
uint8_t _abmTxPtr [kHardwareCols+1]
 Shadow buffer for current transaction.
 
RingBufferN< kHardwareRows+1 > _abmPendingRows
 Effective capacity: kHardwareRows.
 
uint16_t _abmEnqueued
 Bitfield tracking enqueued rows (0x0001..0x0FFF)
 
bool _abmLocked
 True when command chain has preempted ABM.
 
std::function< void()> _abmCallbacks [3]
 Completion callbacks for ABM1/2/3.
 
Command Transaction Chain (Non-PWM Operations)
SercomTxn _cmdTxn [4]
 [0]=unlock, [1]=page, [2]=write, [3]=read
 
CmdTxnContext _cmdCtx [4]
 Context for each command transaction (for callbacks)
 
uint8_t _crwlTx [2]
 Pre-staged unlock transaction {PSWL, PSWL_ENABLE}.
 
uint8_t _pgSelTx [2]
 Page select transaction buffer {PSR, page}.
 
uint8_t _cmdTx [25]
 TX buffer (max: 1 addr + 24 data for LED On/Off)
 
uint8_t _cmdRx [24]
 RX buffer (max: 24 bytes for LED Open/Short)
 
volatile uint8_t _cmdReturn
 Bitfield of completed command transactions (bits 0..3)
 
volatile uint8_t _cmdError
 Bitfield of command transactions with nonzero status.
 
volatile bool _syncComplete
 Blocking command completion flag.
 
volatile int _syncStatus
 Blocking command final status.
 
volatile int8_t _syncTargetCmd
 Index of command awaited by blocking API.
 
Fault Detection and ISR Cache
uint8_t _ledOpen [24]
 Cached LED open status (Page 0, 0x18)
 
uint8_t _ledShort [24]
 Cached LED short status (Page 0, 0x30)
 
uint8_t _ledOn [24]
 Computed LED On/Off mask (Page 0, 0x00)
 
uint8_t _lastISR
 Cached ISR value from last fault detection.
 
Configuration
uint8_t _crValue
 Shadow of CR register state for runtime updates.
 
ColorOrder _colorOrder
 RGB pixel color order.
 
bool _maskShortFaults
 Include LEDSHORT bits in computed LEDONOFF mask.
 

Hardware Handles

SERCOM * _hw
 SERCOM I2C hardware interface.
 
uint8_t _addr
 7-bit I2C address
 
uint8_t _sdbPin
 SDB (shutdown) pin (0xFF = not used)
 
uint8_t _irqPin
 IRQ pin (0xFF = not used)
 
uint8_t _currentPage
 Tracks current page (0-3, 0xFF=unknown) to minimize page selects.
 
static IS31FL3733_instance = nullptr
 Static instance pointer for ISR access.
 

Detailed Description

Asynchronous DMA-driven IS31FL3733 LED driver for SAMD SERCOM I2C.

Provides non-blocking I2C operations, ABM control, and RGB pixel helpers.

Definition at line 271 of file is31fl3733.hpp.

Constructor & Destructor Documentation

◆ IS31FL3733()

IS31FL3733::IS31FL3733::IS31FL3733 ( TwoWire *  wire,
uint8_t  addr = 0x50,
uint8_t  sdbPin = 0xFF,
uint8_t  irqPin = 0xFF 
)

Construct a new IS31FL3733 driver instance.

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.

Definition at line 33 of file is31fl3733.cpp.

34 : _hw(wire ? wire->getSercom() : nullptr), _addr(addr), _sdbPin(sdbPin), _irqPin(irqPin),
35 _currentPage(0xFF), _pwmEnqueued(0), _pwmLocked(false), _pwmBatchActive(false),
36 _abmEnqueued(0), _abmLocked(false), _cmdReturn(0), _cmdError(0), _syncComplete(false),
37 _syncStatus(0), _syncTargetCmd(-1), _begun(false), _lastISR(0), _crValue(CR_SSD),
38 _colorOrder(ColorOrder::GRB), _maskShortFaults(false) {
39
40 // Pre-stage unlock transaction and page buffers
41 _crwlTx[0] = PSWL;
42 _crwlTx[1] = PSWL_ENABLE;
43 _pgSelTx[0] = PSR;
44 // _pgSelTx[1] will be set dynamically based on target register page during transactions
45
46 // CRWL Txn (unlock)
47 _cmdTxn[0].config = I2C_CFG_STOP;
48 _cmdTxn[0].address = _addr;
49 _cmdTxn[0].txPtr = _crwlTx;
50 _cmdTxn[0].length = 2;
51 _cmdCtx[0] = {this, 0, nullptr, nullptr};
52 _cmdTxn[0].onComplete = _cmdCallback;
53 _cmdTxn[0].user = &_cmdCtx[0];
54 _cmdTxn[0].chainNext = false;
55
56 // Page Selection Txn
57 _cmdTxn[1].config = I2C_CFG_STOP;
58 _cmdTxn[1].address = _addr;
59 _cmdTxn[1].txPtr = _pgSelTx;
60 _cmdTxn[1].length = 2;
61 _cmdCtx[1] = {this, 1, nullptr, nullptr};
62 _cmdTxn[1].onComplete = _cmdCallback;
63 _cmdTxn[1].user = &_cmdCtx[1];
64 _cmdTxn[1].chainNext = false;
65
66 // Command Write Txn
67 _cmdTxn[2].config = I2C_CFG_STOP;
68 _cmdTxn[2].address = _addr;
69 _cmdTxn[2].txPtr = _cmdTx;
70 _cmdCtx[2] = {this, 2, nullptr, nullptr};
71 _cmdTxn[2].onComplete = _cmdCallback;
72 _cmdTxn[2].user = &_cmdCtx[2];
73 _cmdTxn[2].chainNext = false;
74
75 // Command Read Txn
76 _cmdTxn[3].config = I2C_CFG_READ | I2C_CFG_STOP;
77 _cmdTxn[3].address = _addr;
78 _cmdTxn[3].rxPtr = _cmdRx;
79 _cmdCtx[3] = {this, 3, nullptr, nullptr};
80 _cmdTxn[3].onComplete = _cmdCallback;
81 _cmdTxn[3].user = &_cmdCtx[3];
82 _cmdTxn[3].chainNext = false;
83
84 // PWM Txn
85 _pwmTxn.config = I2C_CFG_STOP;
86 _pwmTxn.address = _addr;
87 _pwmTxn.length = 17;
88 _pwmTxn.txPtr = nullptr;
89 _pwmTxn.onComplete = _txnCallback;
90 _pwmTxn.user = this;
91 _pwmTxn.chainNext = false;
92
93 // ABM Txn
94 _abmTxn.config = I2C_CFG_STOP;
95 _abmTxn.address = _addr;
96 _abmTxn.length = 17;
97 _abmTxn.txPtr = nullptr;
98 _abmTxn.onComplete = _txnModeCallback;
99 _abmTxn.user = this;
100 _abmTxn.chainNext = false;
101
102 // set all LED's on by default (will be updated in begin()) after OSD reads if enabled
103 memset(_ledOn, 0xFF, sizeof(_ledOn));
104
105 // Initialize row start-register addresses with 16-byte row stride:
106 // row0=0x00, row1=0x10, ... row11=0xB0
107 for (uint8_t row = 0; row < kHardwareRows; row++)
108 _pwm_matrix[row][0] = static_cast<uint8_t>(row * kHardwareCols);
109
110 for (uint8_t row = 0; row < kHardwareRows; row++)
111 _abm_matrix[row][0] = static_cast<uint8_t>(row * kHardwareCols);
112}
bool _begun
True after successful begin(); used for destructor auto-end safety.
uint8_t _currentPage
Tracks current page (0-3, 0xFF=unknown) to minimize page selects.
uint16_t _pwmEnqueued
Bitfield tracking enqueued rows (0x0001..0x0FFF)
volatile uint8_t _cmdReturn
Bitfield of completed command transactions (bits 0..3)
uint8_t _cmdRx[24]
RX buffer (max: 24 bytes for LED Open/Short)
uint8_t _sdbPin
SDB (shutdown) pin (0xFF = not used)
volatile bool _syncComplete
Blocking command completion flag.
bool _pwmLocked
True when command chain has preempted PWM.
static void _txnCallback(void *user, int status)
PWM row transaction callback, enqueues the next pending row if any.
SERCOM * _hw
SERCOM I2C hardware interface.
SercomTxn _pwmTxn
Single in-flight PWM transaction descriptor.
uint8_t _crwlTx[2]
Pre-staged unlock transaction {PSWL, PSWL_ENABLE}.
uint8_t _irqPin
IRQ pin (0xFF = not used)
uint8_t _lastISR
Cached ISR value from last fault detection.
volatile uint8_t _cmdError
Bitfield of command transactions with nonzero status.
uint16_t _abmEnqueued
Bitfield tracking enqueued rows (0x0001..0x0FFF)
SercomTxn _abmTxn
Single in-flight ABM transaction descriptor.
bool _maskShortFaults
Include LEDSHORT bits in computed LEDONOFF mask.
uint8_t _addr
7-bit I2C address
ColorOrder _colorOrder
RGB pixel color order.
volatile int8_t _syncTargetCmd
Index of command awaited by blocking API.
uint8_t _abm_matrix[kHardwareRows][kHardwareCols+1]
[row][0] = Page 2 row addr, [1..16] = ABM data
SercomTxn _cmdTxn[4]
[0]=unlock, [1]=page, [2]=write, [3]=read
bool _pwmBatchActive
True while staged PWM updates are being batched.
uint8_t _cmdTx[25]
TX buffer (max: 1 addr + 24 data for LED On/Off)
static void _txnModeCallback(void *user, int status)
ABM row transaction callback, enqueues the next pending mode row if any.
uint8_t _ledOn[24]
Computed LED On/Off mask (Page 0, 0x00)
volatile int _syncStatus
Blocking command final status.
bool _abmLocked
True when command chain has preempted ABM.
uint8_t _crValue
Shadow of CR register state for runtime updates.
uint8_t _pwm_matrix[kHardwareRows][kHardwareCols+1]
[row][0] = Page 1 row addr, [1..16] = PWM data
static void _cmdCallback(void *user, int status)
Command transaction callback (triggered by SERCOM ISR).
uint8_t _pgSelTx[2]
Page select transaction buffer {PSR, page}.
CmdTxnContext _cmdCtx[4]
Context for each command transaction (for callbacks)
void * user
User pointer passed to callback.

◆ ~IS31FL3733()

IS31FL3733::IS31FL3733::~IS31FL3733 ( )

Destroy the driver; calls end() if begin() succeeded.

Definition at line 114 of file is31fl3733.cpp.

114 {
115 if (_begun)
116 end();
117}
void end()
RESET device and disable (hardware shutdown). Reads RESET register to trigger software reset,...

Member Function Documentation

◆ _abm1CallbackWrapper()

void IS31FL3733::IS31FL3733::_abm1CallbackWrapper ( )
staticprivate

Static wrappers for ABM completion callback dispatch (PendSV-safe entry points).

Dispatch ABM1 completion callback on a safe context.

Definition at line 777 of file is31fl3733.cpp.

777 {
780}
static IS31FL3733 * _instance
Static instance pointer for ISR access.
std::function< void()> _abmCallbacks[3]
Completion callbacks for ABM1/2/3.

◆ _abm2CallbackWrapper()

void IS31FL3733::IS31FL3733::_abm2CallbackWrapper ( )
staticprivate

Dispatch ABM2 completion callback on a safe context.

Definition at line 782 of file is31fl3733.cpp.

782 {
785}

◆ _abm3CallbackWrapper()

void IS31FL3733::IS31FL3733::_abm3CallbackWrapper ( )
staticprivate

Dispatch ABM3 completion callback on a safe context.

Definition at line 787 of file is31fl3733.cpp.

787 {
790}

◆ _asyncRead()

void IS31FL3733::IS31FL3733::_asyncRead ( uint16_t  pagereg,
uint8_t *  dest,
uint8_t  len,
void(*)(void *, int)  callback = nullptr,
void *  user = nullptr 
)
inlineprivate

Generic async read helper (inline for performance).

Definition at line 800 of file is31fl3733.hpp.

801 {
802 uint8_t page = pagereg >> 8;
803
804 // Ensure page if needed
805 if (page < 4) {
806 _ensurePage(page);
807 _cmdTx[0] = pagereg & 0xFF;
808 } else if (page >= IMR)
809 _cmdTx[0] = page;
810 else
811 return;
812
813 // Configure write transaction (send register address) - NOT final
814 _cmdTxn[2].length = 1;
815 _cmdCtx[2].userCallback = nullptr;
816 _cmdCtx[2].user = nullptr;
817 _cmdCtx[2].isFinal = false; // Address phase doesn't trigger callback
818 _cmdCtx[2].initialStatus = 0;
819 _cmdTxn[2].onComplete = _cmdCallback;
820 _cmdTxn[2].user = &_cmdCtx[2];
821 _cmdTxn[2].chainNext = false;
822
823 // Configure read transaction - IS final (will invoke user callback)
824 _cmdTxn[3].rxPtr = dest;
825 _cmdTxn[3].length = len;
826 _cmdCtx[3].userCallback = callback;
827 _cmdCtx[3].user = user;
828 _cmdCtx[3].isFinal = true; // Data phase is final, triggers callback
829 _cmdCtx[3].initialStatus = 0; // Can be populated by write phase if needed
830 _cmdTxn[3].onComplete = _cmdCallback;
831 _cmdTxn[3].user = &_cmdCtx[3];
832 _cmdTxn[3].chainNext = false;
833
834 // Enqueue both transactions
835 _hw->enqueueWIRE(&_cmdTxn[2]);
836 _hw->enqueueWIRE(&_cmdTxn[3]);
837}
void _ensurePage(uint8_t page)
Ensure we're on the target page (skips if already there, enqueues unlock + page-select if needed).
int initialStatus
First error status observed in the chain.
bool isFinal
If true, invoke userCallback on this transaction.
void(* userCallback)(void *, int)
Optional user callback for final status.

References IS31FL3733::IS31FL3733::CmdTxnContext::initialStatus, IS31FL3733::IS31FL3733::CmdTxnContext::isFinal, IS31FL3733::IS31FL3733::CmdTxnContext::user, and IS31FL3733::IS31FL3733::CmdTxnContext::userCallback.

◆ _asyncWrite()

void IS31FL3733::IS31FL3733::_asyncWrite ( uint16_t  pagereg,
const uint8_t *  data,
uint8_t  len,
void(*)(void *, int)  callback = nullptr,
void *  user = nullptr 
)
inlineprivate

Generic async write helper (inline for performance).

Definition at line 772 of file is31fl3733.hpp.

773 {
774 uint8_t page = pagereg >> 8;
775
776 // Ensure page if needed (pages 0-3)
777 if (page < 4) {
778 _ensurePage(page);
779 _cmdTx[0] = pagereg & 0xFF;
780 } else if (page >= IMR)
781 _cmdTx[0] = page;
782 else
783 return;
784
785 // Copy data to TX buffer
786 memcpy(_cmdTx + 1, data, len);
787
788 // Configure and enqueue write transaction
789 _cmdTxn[2].length = 1 + len;
790 _cmdCtx[2].userCallback = callback;
791 _cmdCtx[2].user = user;
792 _cmdCtx[2].isFinal = true; // This is the only transaction
793 _cmdCtx[2].initialStatus = 0;
794 _cmdTxn[2].onComplete = _cmdCallback;
795 _cmdTxn[2].user = &_cmdCtx[2];
796 _cmdTxn[2].chainNext = false;
797 _hw->enqueueWIRE(&_cmdTxn[2]);
798}

References IS31FL3733::IS31FL3733::CmdTxnContext::initialStatus, IS31FL3733::IS31FL3733::CmdTxnContext::isFinal, IS31FL3733::IS31FL3733::CmdTxnContext::user, and IS31FL3733::IS31FL3733::CmdTxnContext::userCallback.

◆ _cmdCallback()

void IS31FL3733::IS31FL3733::_cmdCallback ( void *  user,
int  status 
)
staticprivate

Command transaction callback (triggered by SERCOM ISR).

Parameters
userPointer to IS31FL3733 instance.
statusTransaction status (0 = success).

Definition at line 743 of file is31fl3733.cpp.

743 {
744 auto *context = static_cast<CmdTxnContext *>(user);
745 if (!context || !context->self)
746 return;
747
748 IS31FL3733 *self = context->self;
749 const uint8_t bit = static_cast<uint8_t>(1u << context->index);
750
751 self->_cmdReturn |= bit;
752 if (status != 0)
753 self->_cmdError |= bit;
754
755 if (self->_syncTargetCmd == static_cast<int8_t>(context->index)) {
756 self->_syncStatus = status;
757 self->_syncComplete = true;
758 self->_syncTargetCmd = -1;
759 }
760
761 // For non-final phases: accumulate status in next phase's context
762 if (!context->isFinal && context->index < 3) {
763 // Chain accumulated status forward: next phase sees all previous failures
764 self->_cmdCtx[context->index + 1].initialStatus |= status;
765 return; // Don't invoke user callback on intermediate phase
766 }
767
768 // Only invoke user callback on final transaction
769 if (context->isFinal && context->userCallback)
770 context->userCallback(context->user, status);
771}
IS31FL3733(TwoWire *wire, uint8_t addr=0x50, uint8_t sdbPin=0xFF, uint8_t irqPin=0xFF)
Construct a new IS31FL3733 driver instance.

◆ _ensurePage()

void IS31FL3733::IS31FL3733::_ensurePage ( uint8_t  page)
private

Ensure we're on the target page (skips if already there, enqueues unlock + page-select if needed).

Parameters
pagePage number (0..3).

Definition at line 568 of file is31fl3733.cpp.

568 {
569 // Skip page select if we're already on the target page
570 if (_currentPage == page)
571 return;
572
573 // Enqueue unlock transaction (pre-staged in constructor)
574 _cmdTxn[0].chainNext = false;
575 _hw->enqueueWIRE(&_cmdTxn[0]);
576
577 // Update and enqueue page select transaction
578 _pgSelTx[0] = PSR;
579 _pgSelTx[1] = page & 0b11; // Mask to 2 bits (0-3)
580 _cmdTxn[1].chainNext = false;
581 _hw->enqueueWIRE(&_cmdTxn[1]);
582
583 // Update tracked page
584 _currentPage = page;
585}

◆ _irqCallback()

void IS31FL3733::IS31FL3733::_irqCallback ( )
inlinestaticprivate

GPIO IRQ callback (triggered by IRQ pin edge).

Definition at line 865 of file is31fl3733.hpp.

865 {
866 // Hardware ISR: Read F1h (ISR register) into _lastISR, with _onServiceCallback as completion
867 // No page select needed for common register F1h
868 if (_instance)
869 _instance->_asyncRead((uint16_t)ISR << 8, &_instance->_lastISR, 1, _onServiceCallback,
870 _instance);
871}
void _asyncRead(uint16_t pagereg, uint8_t *dest, uint8_t len, void(*callback)(void *, int)=nullptr, void *user=nullptr)
Generic async read helper (inline for performance).
static void _onServiceCallback(void *user, int status)
ISR completion callback (processes _lastISR after F1h read).

◆ _onServiceCallback()

void IS31FL3733::IS31FL3733::_onServiceCallback ( void *  user,
int  status 
)
inlinestaticprivate

ISR completion callback (processes _lastISR after F1h read).

Parameters
userPointer to IS31FL3733 instance.
statusTransaction status (0 = success).

Definition at line 873 of file is31fl3733.hpp.

873 {
874 // Static callback after ISR read completes - dispatch to instance method
875 IS31FL3733 *self = (IS31FL3733 *)user;
876 (void)status;
877 // Process _lastISR value (already read by _irqCallback)
878 // Lock PWM writes during fault handling
879 self->_pwmLocked = true;
880 self->_abmLocked = true;
881
882 uint8_t isr = self->_lastISR;
883
884 if (isr & 0x1C) { // ABM1 (0x04), ABM2 (0x08), ABM3 (0x10)
885 // Dispatch ABM completion to registered callback(s)
886 if (isr & ISR_ABM1)
888 if (isr & ISR_ABM2)
890 if (isr & ISR_ABM3)
892 }
893
894 const bool hasOpenFault = (isr & ISR_OB) != 0;
895 const bool hasShortFault = ((isr & ISR_SB) != 0) && self->_maskShortFaults;
896
897 // Service open faults always; service short faults only when short masking is enabled.
898 if (hasOpenFault || hasShortFault) {
899 // Determine which fault register to read
900 uint16_t pagereg = hasOpenFault ? LEDOPEN : LEDSHORT;
901 uint8_t *dest = hasOpenFault ? self->_ledOpen : self->_ledShort;
902
903 // Read fault register asynchronously
904 self->_asyncRead(pagereg, dest, 24, _osbCallback, self);
905
906 return;
907 }
908
909 // No recognized interrupts - just unlock PWM/ABM
910 self->_resumeDataTransfers();
911}
static void _osbCallback(void *user, int status)
Open/Short detection callback (updates LED On/Off mask).
static void _abm3CallbackWrapper()
Dispatch ABM3 completion callback on a safe context.
static void _abm1CallbackWrapper()
Static wrappers for ABM completion callback dispatch (PendSV-safe entry points).
static void _abm2CallbackWrapper()
Dispatch ABM2 completion callback on a safe context.

◆ _osbCallback()

void IS31FL3733::IS31FL3733::_osbCallback ( void *  user,
int  status 
)
staticprivate

Open/Short detection callback (updates LED On/Off mask).

Definition at line 727 of file is31fl3733.cpp.

727 {
728 IS31FL3733 *self = (IS31FL3733 *)user;
729
730 // Update LED On/Off mask from open faults only. Short detection is not used for
731 // masking because this hardware reports spurious shorts on active LED rows.
732 for (size_t i = 0; i < 24; i++) {
733 self->_ledOn[i] = static_cast<uint8_t>(self->_ledOn[i] & ~self->_ledOpen[i]);
734 }
735
736 // Write updated LED On/Off register
737 self->_asyncWrite(LEDONOFF, self->_ledOn, 24, nullptr, nullptr);
738
739 // Restore Page 1 and resume PWM/ABM
740 self->_resumeDataTransfers();
741}

◆ _resumeDataTransfers()

void IS31FL3733::IS31FL3733::_resumeDataTransfers ( )
private

Restore Page 1, clear _pwmLocked, resume PWM writes.

Definition at line 587 of file is31fl3733.cpp.

587 {
588 _pwmLocked = false; // Clear PWM lock flag
589 _abmLocked = false; // Clear ABM lock flag
590 _sendRowPWM(); // Resume pending PWM writes
591 _sendRowMode(); // Resume pending ABM writes
592}
void _sendRowPWM()
Dequeue and transmit next pending PWM row.
void _sendRowMode()
Dequeue and transmit next pending ABM row.

◆ _sendRowMode()

void IS31FL3733::IS31FL3733::_sendRowMode ( )
inlineprivate

Dequeue and transmit next pending ABM row.

Definition at line 735 of file is31fl3733.hpp.

735 {
736 // Don't send if ABM is locked by command chain or if transaction already in-flight
737 if (_abmLocked || _abmTxn.txPtr)
738 return;
739
740 // Dequeue next row
741 int row = _abmPendingRows.read_char();
742 if (row < 0) {
743 // Queue can be full with one row represented only in _abmEnqueued.
744 for (uint8_t candidate = 0; candidate < kHardwareRows; candidate++) {
745 if (_abmEnqueued & (1u << candidate)) {
746 row = candidate;
747 break;
748 }
749 }
750 }
751
752 if (row < 0)
753 return; // Nothing pending
754
755 // Clear enqueued bit
756 _abmEnqueued &= ~(1 << row);
757
758 // Copy row data to transmit buffer
759 // [row][0] is the page 2 row address (0x00..0x0B)
760 memcpy(_abmTxPtr, _abm_matrix[row], 17);
761
762 // Point transaction at prepared ABM row buffer
763 _abmTxn.txPtr = _abmTxPtr;
764 _abmTxn.chainNext = false;
765
766 _ensurePage(2);
767
768 // Enqueue transaction
769 _hw->enqueueWIRE(&_abmTxn);
770}
RingBufferN< kHardwareRows+1 > _abmPendingRows
Effective capacity: kHardwareRows.
uint8_t _abmTxPtr[kHardwareCols+1]
Shadow buffer for current transaction.

◆ _sendRowPWM()

void IS31FL3733::IS31FL3733::_sendRowPWM ( )
inlineprivate

Dequeue and transmit next pending PWM row.

Definition at line 699 of file is31fl3733.hpp.

699 {
700 // Don't send if PWM is locked, batch staging is active, or if transaction is in-flight
701 if (_pwmLocked || _pwmBatchActive || _pwmTxn.txPtr)
702 return;
703
704 // Dequeue next row
705 int row = _pwmPendingRows.read_char();
706 if (row < 0) {
707 // Queue can be full with one row represented only in _pwmEnqueued.
708 for (uint8_t candidate = 0; candidate < kHardwareRows; candidate++) {
709 if (_pwmEnqueued & (1u << candidate)) {
710 row = candidate;
711 break;
712 }
713 }
714 }
715
716 if (row < 0)
717 return; // Nothing pending
718
719 // Clear enqueued bit
720 _pwmEnqueued &= ~(1 << row);
721
722 // Copy row data to transmit buffer
723 memcpy(_pwmTxPtr, _pwm_matrix[row], 17);
724
725 // Point transaction at prepared PWM row buffer
726 _pwmTxn.txPtr = _pwmTxPtr;
727 _pwmTxn.chainNext = false;
728
729 _ensurePage(1);
730
731 // Enqueue transaction
732 _hw->enqueueWIRE(&_pwmTxn);
733}
RingBufferN< kHardwareRows+1 > _pwmPendingRows
Effective capacity: kHardwareRows.
uint8_t _pwmTxPtr[kHardwareCols+1]
Shadow buffer for current transaction.

◆ _syncRead()

bool IS31FL3733::IS31FL3733::_syncRead ( uint16_t  pagereg,
uint8_t *  dest,
uint8_t  len 
)
private

Blocking read helper used by begin() setup flow.

Definition at line 620 of file is31fl3733.cpp.

620 {
621 _syncComplete = false;
622 _syncStatus = 0;
623 _syncTargetCmd = 3;
624 _cmdError &= ~((1u << 0) | (1u << 1) | (1u << 2) | (1u << 3));
625 _cmdCtx[3].initialStatus = 0;
626
627 _asyncRead(pagereg, dest, len, nullptr, nullptr);
628
629 constexpr uint32_t timeoutUs = 100000ul; // 100 ms
630 const uint32_t start = micros();
631 while (!_syncComplete && (static_cast<uint32_t>(micros() - start) < timeoutUs)) {
632 yield();
633 }
634
635 if (!_syncComplete) {
636 _syncStatus = -1;
637 _syncTargetCmd = -1;
638 _syncComplete = true;
639 return false;
640 }
641
642 return (_syncStatus == 0) &&
643 ((_cmdError & ((1u << 0) | (1u << 1) | (1u << 2) | (1u << 3))) == 0) &&
644 (_cmdCtx[3].initialStatus == 0);
645}

◆ _syncWrite()

bool IS31FL3733::IS31FL3733::_syncWrite ( uint16_t  pagereg,
const uint8_t *  data,
uint8_t  len 
)
private

Blocking write helper used by begin() setup flow.

Definition at line 594 of file is31fl3733.cpp.

594 {
595 _syncComplete = false;
596 _syncStatus = 0;
597 _syncTargetCmd = 2;
598 _cmdError &= ~((1u << 0) | (1u << 1) | (1u << 2));
599 _cmdCtx[2].initialStatus = 0;
600
601 _asyncWrite(pagereg, data, len, nullptr, nullptr);
602
603 constexpr uint32_t timeoutUs = 100000ul; // 100 ms
604 const uint32_t start = micros();
605 while (!_syncComplete && (static_cast<uint32_t>(micros() - start) < timeoutUs)) {
606 yield();
607 }
608
609 if (!_syncComplete) {
610 _syncStatus = -1;
611 _syncTargetCmd = -1;
612 _syncComplete = true;
613 return false;
614 }
615
616 return (_syncStatus == 0) && ((_cmdError & ((1u << 0) | (1u << 1) | (1u << 2))) == 0) &&
617 (_cmdCtx[2].initialStatus == 0);
618}
void _asyncWrite(uint16_t pagereg, const uint8_t *data, uint8_t len, void(*callback)(void *, int)=nullptr, void *user=nullptr)
Generic async write helper (inline for performance).

◆ _txnCallback()

void IS31FL3733::IS31FL3733::_txnCallback ( void *  user,
int  status 
)
inlinestaticprivate

PWM row transaction callback, enqueues the next pending row if any.

Parameters
userPointer to IS31FL3733 instance.
statusTransaction status (0 = success).

Definition at line 843 of file is31fl3733.hpp.

843 {
844 IS31FL3733 *self = (IS31FL3733 *)user;
845 (void)status;
846
847 // Clear PWM transaction in-progress flag
848 self->_pwmTxn.txPtr = nullptr;
849
850 // Transaction complete - send next PWM row if available
851 self->_sendRowPWM();
852}

◆ _txnModeCallback()

void IS31FL3733::IS31FL3733::_txnModeCallback ( void *  user,
int  status 
)
inlinestaticprivate

ABM row transaction callback, enqueues the next pending mode row if any.

Parameters
userPointer to IS31FL3733 instance.
statusTransaction status (0 = success).

Definition at line 854 of file is31fl3733.hpp.

854 {
855 IS31FL3733 *self = (IS31FL3733 *)user;
856 (void)status;
857
858 // Clear ABM transaction in-progress flag
859 self->_abmTxn.txPtr = nullptr;
860
861 // Transaction complete - send next ABM row if available
862 self->_sendRowMode();
863}

◆ begin()

bool IS31FL3733::IS31FL3733::begin ( uint8_t  pfs = 0,
uint8_t  pur = 0b111,
uint8_t  pdr = 0b111 
)

Initialize the device (blocking for initial config).

Parameters
pfsPWM Frequency Setting value (0..3) for initial configuration. See Table 13 for setting values. Default is 0 (slowest PWM frequency, 8.4 kHz).
purPull-up resistor setting for de-ghosting (3 bits, 0..7). Default is 0b111 (32 kOhm pull-up). See Table 19 for resistor values.
pdrPull-down resistor setting for de-ghosting (3 bits, 0..7). Default is 0b111 (32 kOhm pull-down). See Table 20 for resistor values.
Returns
true if successful, false otherwise.

Definition at line 123 of file is31fl3733.cpp.

123 {
124 // ---------------------------------------------------------------------------------
125 // STEP 1: Configure pins
126 // ---------------------------------------------------------------------------------
127 // SDB pin (active high)
128 if (_sdbPin != 0xFF) {
129 pinMode(_sdbPin, OUTPUT);
130 digitalWrite(_sdbPin, LOW); // Start disabled
131 delay(1);
132 digitalWrite(_sdbPin, HIGH); // Enable device
133 delay(1);
134 }
135
136 // IRQ pin (if provided). Defer ISR attachment until initialization completes.
137 if (_irqPin != 0xFF)
138 pinMode(_irqPin, INPUT_PULLUP);
139
140 // ---------------------------------------------------------------------------------
141 // Force software RESET
142 // ---------------------------------------------------------------------------------
143
144 // Reading RESET triggers the IS31FL3733 software reset.
145 uint8_t dummy;
146 if (!_syncRead(RESET, &dummy, 1))
147 return false;
148 delay(1);
149
150 // ---------------------------------------------------------------------------------
151 // Configure Page 3 registers
152 // ---------------------------------------------------------------------------------
153
154 // CR: Normal operation (without OSD initially)
155 _crValue = static_cast<uint8_t>(CR_SSD | CR_PFS(pfs & 0x03));
156 if (!_syncWrite(CR, &_crValue, 1))
157 return false;
158
159 // ---------------------------------------------------------------------------------
160 // Configure Page 0: LED On/Off and Open/Short Detection
161 // ---------------------------------------------------------------------------------
162 // Step 1: Enable all LEDs in LEDONOFF
163 if (!_syncWrite(LEDONOFF, _ledOn, 24))
164 return false;
165
166 // Step 2: Set GCC to 0x01 for OSD
167 uint8_t gcc_osd = 0x01;
168 if (!_syncWrite(GCC, &gcc_osd, 1))
169 return false;
170
171 // Step 3: Trigger OSD strobe (CR with OSD bit set)
172 uint8_t cr_osd = static_cast<uint8_t>(_crValue | CR_OSD);
173 if (!_syncWrite(CR, &cr_osd, 1))
174 return false;
175
176 // Step 4: Wait for OSD to complete
177 delay(10); // 10ms to ensure completion
178
179 // Step 5: Read LEDOPEN and LEDSHORT registers
180 if (!_syncRead(LEDOPEN, _ledOpen, 24))
181 return false;
182 if (!_syncRead(LEDSHORT, _ledShort, 24))
183 return false;
184
185 // Store ISR status read after OSD.
186 uint8_t isr_status = 0;
187 if (_syncRead((uint16_t)ISR << 8, &isr_status, 1))
188 _lastISR = isr_status;
189
190 // Compute LED On/Off mask based on configured fault policy.
191 // NOTE: Short circuit detection disabled due to spurious shorts detected on
192 // red LED rows during OSD sequence. Only OPEN detection is used to disable LEDs.
193 for (size_t i = 0; i < 24; i++) {
194 // Only disable LEDs if they are detected as open (not shorted)
195 _ledOn[i] = static_cast<uint8_t>(_ledOn[i] & ~_ledOpen[i]);
196 }
197
198 // Write updated LEDONOFF mask (if faults detected)
199 if (!_syncWrite(LEDONOFF, _ledOn, 24))
200 return false;
201
202 // Step 6: Restore GCC to normal operating value (0xFF)
203 uint8_t gcc_normal = 0xFF;
204 if (!_syncWrite(GCC, &gcc_normal, 1))
205 return false;
206
207 // Step 7: Clear CR OSD bit for normal operation
208 if (!_syncWrite(CR, &_crValue, 1))
209 return false;
210
211 // Step 8: Force all LED mode registers to normal PWM mode. RESET should leave
212 // Page 2 at 0x00, but write it explicitly during begin so no previous ABM state
213 // can survive a partial init or bus fault.
214 uint8_t pwmMode[kHardwareCols];
215 memset(pwmMode, static_cast<uint8_t>(ABMMode::PWM_MODE), sizeof(pwmMode));
216 for (uint8_t row = 0u; row < kHardwareRows; ++row) {
217 if (!_syncWrite(static_cast<uint16_t>(LEDABM + (row * kHardwareCols)), pwmMode,
218 sizeof(pwmMode)))
219 return false;
220 memset(_abm_matrix[row] + 1, static_cast<uint8_t>(ABMMode::PWM_MODE), kHardwareCols);
221 }
222
223 // Step 9: Minimal OSD sequence (if IRQ pin provided)
224 if (_irqPin != 0xFF) {
225 // Unmask interrupts for runtime fault detection.
226 uint8_t imr_value = IMR_IO;
228 imr_value = static_cast<uint8_t>(imr_value | IMR_IS);
229 if (!_syncWrite((uint16_t)IMR << 8, &imr_value, 1))
230 return false;
231 }
232
233 // Step 10: Set pull-up/down for de-ghosting (default to all enabled)
234 uint8_t purValue = pur & 0b111; // Mask to 3 bits
235 uint8_t pdrValue = pdr & 0b111; // Mask to 3 bits
236 if (!_syncWrite(SWPUR, &purValue, 1))
237 return false;
238 if (!_syncWrite(CSPDR, &pdrValue, 1))
239 return false;
240
241 // ---------------------------------------------------------------------------------
242 // Clear command transaction pointers and set default page to Page 1 (PWM)
243 // ---------------------------------------------------------------------------------
244
245 _cmdCtx[2].userCallback = nullptr;
246 _cmdCtx[2].user = nullptr;
247 _cmdCtx[3].userCallback = nullptr;
248 _cmdCtx[3].user = nullptr;
249
250 _ensurePage(1);
251
252 if (_irqPin != 0xFF) {
253 _instance = this; // Set static instance for ISR access
254 attachInterrupt(digitalPinToInterrupt(_irqPin), _irqCallback, FALLING);
255 }
256
257 _begun = true;
258
259 return true;
260}
static void _irqCallback()
GPIO IRQ callback (triggered by IRQ pin edge).
uint8_t _ledShort[24]
Cached LED short status (Page 0, 0x30)
uint8_t _ledOpen[24]
Cached LED open status (Page 0, 0x18)
bool _syncWrite(uint16_t pagereg, const uint8_t *data, uint8_t len)
Blocking write helper used by begin() setup flow.
bool _syncRead(uint16_t pagereg, uint8_t *dest, uint8_t len)
Blocking read helper used by begin() setup flow.

◆ BeginPwmBatch()

void IS31FL3733::IS31FL3733::BeginPwmBatch ( )

Begin a batched PWM update.

While active, PWM row writes are staged in the internal matrix and queued, but transmission to the device is deferred until EndPwmBatch() is called.

Definition at line 378 of file is31fl3733.cpp.

378 {
379 _pwmBatchActive = true;
380}

◆ ConfigureABM()

void IS31FL3733::IS31FL3733::ConfigureABM ( uint8_t  abmNumber,
const ABMConfig config 
)

Configure ABM timing/loop registers for ABM1/2/3 on Page 3.

Parameters
abmNumberABM selector (1..3).
configABM timing/loop configuration fields.

Definition at line 658 of file is31fl3733.cpp.

658 {
659 if (abmNumber < 1 || abmNumber > 3)
660 return;
661 uint16_t pagereg = 0;
662 // Route to specific ABM configurator
663 switch (abmNumber) {
664 case 1:
665 pagereg = ABM1CR;
666 break;
667 case 2:
668 pagereg = ABM2CR;
669 break;
670 case 3:
671 pagereg = ABM3CR;
672 break;
673 }
674
675 const uint8_t cfg[4] = {
676 static_cast<uint8_t>(static_cast<uint8_t>(config.T1) | static_cast<uint8_t>(config.T2)),
677 static_cast<uint8_t>(static_cast<uint8_t>(config.T3) | static_cast<uint8_t>(config.T4)),
678 static_cast<uint8_t>(static_cast<uint8_t>(config.Tend) |
679 static_cast<uint8_t>(config.Tbegin) |
680 static_cast<uint8_t>((config.Times >> 8) & 0x0F)),
681 static_cast<uint8_t>(config.Times & 0xFF),
682 };
683 _asyncWrite(pagereg, cfg, 4, nullptr, nullptr);
684
685 // Write 1 byte of zeros to TUR (0x0E) to complete latch (per datasheet: "Any write to
686 // 0Eh will latch the ABM configuration")
687 uint8_t turPadding[1] = {0};
688 _asyncWrite(TUR, turPadding, 1, nullptr, nullptr);
689}

References IS31FL3733::ABMConfig::T1, IS31FL3733::ABMConfig::T2, IS31FL3733::ABMConfig::T3, IS31FL3733::ABMConfig::T4, IS31FL3733::ABMConfig::Tbegin, IS31FL3733::ABMConfig::Tend, and IS31FL3733::ABMConfig::Times.

◆ ConfigureABM1()

void IS31FL3733::IS31FL3733::ConfigureABM1 ( const ABMConfig config)

Configure ABM-1 control registers (Page 3 ABM1CR..ABM1CR+4).

Definition at line 691 of file is31fl3733.cpp.

691 {
692 ConfigureABM(1, config);
693}
void ConfigureABM(uint8_t abmNumber, const ABMConfig &config)
Configure ABM timing/loop registers for ABM1/2/3 on Page 3.

◆ ConfigureABM2()

void IS31FL3733::IS31FL3733::ConfigureABM2 ( const ABMConfig config)

Configure ABM-2 control registers (Page 3 ABM2CR..ABM2CR+4).

Definition at line 695 of file is31fl3733.cpp.

695 {
696 ConfigureABM(2, config);
697}

◆ ConfigureABM3()

void IS31FL3733::IS31FL3733::ConfigureABM3 ( const ABMConfig config)

Configure ABM-3 control registers (Page 3 ABM3CR..ABM3CR+4).

Definition at line 699 of file is31fl3733.cpp.

699 {
700 ConfigureABM(3, config);
701}

◆ DeviceOff()

void IS31FL3733::IS31FL3733::DeviceOff ( )

Disable the device (hardware and software shutdown).

Definition at line 293 of file is31fl3733.cpp.

293 {
294 const uint8_t cr_off = 0x00;
295 _syncWrite(CR, &cr_off, 1); // Ensure CR write completes before cutting power
296
297 if (_sdbPin != 0xFF)
298 digitalWrite(_sdbPin, LOW);
299}

◆ DeviceOn()

void IS31FL3733::IS31FL3733::DeviceOn ( )

Enable the device (hardware and software startup).

Definition at line 283 of file is31fl3733.cpp.

283 {
284 if (_sdbPin != 0xFF)
285 digitalWrite(_sdbPin, HIGH);
286
287 // Write cached CR register (SSD + runtime config bits)
288 _asyncWrite(CR, &_crValue, 1, nullptr, nullptr);
289
291}
void _resumeDataTransfers()
Restore Page 1, clear _pwmLocked, resume PWM writes.

◆ EnableABM()

void IS31FL3733::IS31FL3733::EnableABM ( bool  enable = true)

Enable or disable ABM engine in CR (Page 3).

Parameters
enableTrue to set CR_BEN, false to clear it.

Definition at line 703 of file is31fl3733.cpp.

703 {
704 if (enable)
705 _crValue |= CR_BEN;
706 else
707 _crValue &= static_cast<uint8_t>(~CR_BEN);
708
709 _asyncWrite(CR, &_crValue, 1, nullptr, nullptr);
710}

◆ end()

void IS31FL3733::IS31FL3733::end ( )

RESET device and disable (hardware shutdown). Reads RESET register to trigger software reset, then disables device. Useful for cleanup and testing.

Definition at line 262 of file is31fl3733.cpp.

262 {
263 if (!_begun)
264 return;
265
266 _syncRead(CR, _cmdTx, 1); // RESET the device state
267
268 DeviceOff();
269
270 // Detach IRQ if configured
271 if (_irqPin != 0xFF) {
272 detachInterrupt(digitalPinToInterrupt(_irqPin));
273 _instance = nullptr;
274 }
275
276 _begun = false;
277}
void DeviceOff()
Disable the device (hardware and software shutdown).

◆ EndPwmBatch()

void IS31FL3733::IS31FL3733::EndPwmBatch ( bool  flush = true)

End a batched PWM update and optionally flush queued rows.

Parameters
flushIf true, starts sending queued rows immediately (if bus is idle).

Definition at line 382 of file is31fl3733.cpp.

382 {
383 _pwmBatchActive = false;
384
385 if (flush && !_pwmTxn.txPtr && !_pwmLocked)
386 _sendRowPWM();
387}

◆ Fill()

void IS31FL3733::IS31FL3733::Fill ( uint8_t  pwm = 0)

Fill the entire matrix with a PWM value.

Parameters
pwmPWM value (0..255).

Definition at line 444 of file is31fl3733.cpp.

444 {
445 // Fill all rows with the same PWM value
446 for (uint8_t row = 0; row < kHardwareRows; row++) {
447 memset(_pwm_matrix[row] + 1, pwm, kHardwareCols);
448
449 // Enqueue row
450 uint16_t rowBit = 1 << row;
451 if (!(_pwmEnqueued & rowBit)) {
452 _pwmEnqueued |= rowBit;
453 _pwmPendingRows.store(row);
454 }
455 }
456
457 // Kick transmission if not already in-flight
458 if (!_pwmTxn.txPtr && !_pwmLocked)
459 _sendRowPWM();
460}

◆ 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 }

◆ GetLEDOn()

const uint8_t * IS31FL3733::IS31FL3733::GetLEDOn ( ) const
inline

Get the cached LED on/off mask (last value written to LEDONOFF).

Returns
Pointer to 24-byte array (Page 0, 0x00..0x17).

Definition at line 509 of file is31fl3733.hpp.

509 {
510 return _ledOn;
511 }

◆ GetLEDOpen()

const uint8_t * IS31FL3733::IS31FL3733::GetLEDOpen ( ) const
inline

Get the cached LED open status (from last fault detection).

Returns
Pointer to 24-byte array (Page 0, 0x18..0x2F).

Definition at line 497 of file is31fl3733.hpp.

497 {
498 return _ledOpen;
499 }

◆ GetLEDShort()

const uint8_t * IS31FL3733::IS31FL3733::GetLEDShort ( ) const
inline

Get the cached LED short status (from last fault detection).

Returns
Pointer to 24-byte array (Page 0, 0x30..0x47).

Definition at line 503 of file is31fl3733.hpp.

503 {
504 return _ledShort;
505 }

◆ GetPixelMode()

ABMMode IS31FL3733::IS31FL3733::GetPixelMode ( uint8_t  row,
uint8_t  col 
) const

Get mode for a single LED (hardware coordinates, Page 2).

Parameters
rowHardware row (1..12 = SW1..SW12).
colHardware column (1..16 = CS1..CS16).
Returns
Current cached LED mode.

Definition at line 534 of file is31fl3733.cpp.

534 {
535 // guard against out-of-bounds and 0 (1-based indexing)
536 if (row > kHardwareRows || col > kHardwareCols || !row || !col)
537 return ABMMode::PWM_MODE;
538
539 // Convert 1-based to 0-based index
540 uint8_t idx = row - 1;
541
542 // Read from cached ABM matrix
543 return static_cast<ABMMode>(_abm_matrix[idx][col]);
544}

◆ GetShortFaultMaskEnabled()

bool IS31FL3733::IS31FL3733::GetShortFaultMaskEnabled ( ) const
inline

Returns true when LEDSHORT contributes to LEDONOFF masking.

Definition at line 358 of file is31fl3733.hpp.

358 {
359 return _maskShortFaults;
360 }

◆ IsPwmUpdatePending()

bool IS31FL3733::IS31FL3733::IsPwmUpdatePending ( ) const
inline

Returns true while PWM row writes are in flight or queued.

Definition at line 363 of file is31fl3733.hpp.

363 {
364 return _pwmTxn.txPtr != nullptr || _pwmEnqueued != 0u || _pwmLocked || _pwmBatchActive;
365 }

◆ SetABMCallback()

void IS31FL3733::IS31FL3733::SetABMCallback ( uint8_t  abmNum,
std::function< void()>  callback 
)

Register callback for ABM1/2/3 completion.

Parameters
abmNumABM selector (1..3).
callbackInvoked when selected ABM completes.

Definition at line 651 of file is31fl3733.cpp.

651 {
652 if (abmNum < 1 || abmNum > 3)
653 return;
654
655 _abmCallbacks[abmNum - 1] = callback;
656}

◆ 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 }

◆ SetCSPDR()

void IS31FL3733::IS31FL3733::SetCSPDR ( uint8_t  pdr)

Set CS pull-down resistor control (Page 3 CSPDR).

Parameters
pdrPull-down value (lower 3 bits are used).

Definition at line 310 of file is31fl3733.cpp.

310 {
311 uint8_t pdrValue = static_cast<uint8_t>(pdr & 0x07);
312 _asyncWrite(CSPDR, &pdrValue, 1, nullptr, nullptr);
313}

◆ SetGCC()

void IS31FL3733::IS31FL3733::SetGCC ( uint8_t  gcc)

Set global current control register (Page 3 GCC).

Parameters
gccGlobal current value (0x00..0xFF).

Definition at line 301 of file is31fl3733.cpp.

301 {
302 _asyncWrite(GCC, &gcc, 1, nullptr, nullptr);
303}

◆ SetIMR()

void IS31FL3733::IS31FL3733::SetIMR ( uint8_t  imrMask)

Set interrupt mask register (Common IMR).

Parameters
imrMaskIMR bitmask (IMR_IO/IMR_IS/IMR_IAB/IMR_IAC).

Definition at line 320 of file is31fl3733.cpp.

320 {
321 uint8_t mask = static_cast<uint8_t>(imrMask & 0x0F);
322 _asyncWrite((uint16_t)IMR << 8, &mask, 1, nullptr, nullptr);
323}

◆ SetMatrixMode()

void IS31FL3733::IS31FL3733::SetMatrixMode ( ABMMode  mode)

Set mode for the entire matrix (Page 2).

Parameters
modeLED mode value (PWM/ABM1/ABM2/ABM3).

Definition at line 515 of file is31fl3733.cpp.

515 {
516 // Fill all rows with the same mode value (Page 2)
517 for (uint8_t row = 0; row < kHardwareRows; row++) {
518 memset(_abm_matrix[row] + 1, static_cast<uint8_t>(mode), kHardwareCols);
519
520 // Enqueue row
521 uint16_t rowBit = 1 << row;
522 if (!(_abmEnqueued & rowBit)) {
523 _abmEnqueued |= rowBit;
524 _abmPendingRows.store(row);
525 }
526 }
527
528 // Kick transmission if not already in-flight
529 if (!_abmTxn.txPtr && !_abmLocked) {
530 _sendRowMode();
531 }
532}

◆ SetPFS()

void IS31FL3733::IS31FL3733::SetPFS ( uint8_t  pfs)

Set PWM frequency selection bits in CR (PFS[6:5]). Preserves other tracked CR bits (e.g., ABM enable).

Parameters
pfsPWM frequency selector (0..3).

Definition at line 315 of file is31fl3733.cpp.

315 {
316 _crValue = static_cast<uint8_t>((_crValue & ~0x60u) | CR_PFS(pfs & 0x03));
317 _asyncWrite(CR, &_crValue, 1, nullptr, nullptr);
318}

◆ SetPixelColor()

void IS31FL3733::IS31FL3733::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).

Parameters
rowLogical pixel row (1..4).
colLogical pixel column (1..16).
rRed channel (0..255).
gGreen channel (0..255).
bBlue channel (0..255).

Definition at line 393 of file is31fl3733.cpp.

393 {
394 if (row > kLogicalRows || col > kHardwareCols || !row || !col)
395 return;
396
397 // Convert 1-based to 0-based index
398 uint8_t idx = row - 1;
399
400 // Map logical row to hardware rows based on color order
401 // baseRow will be 0, 3, 6, or 9 for logical rows 0-3
402 // Add 1 to convert to 1-based indexing for SetPixelPWM
403 uint8_t baseRow = idx * 3 + 1;
404
405 // Set PWM for each channel based on color order
406 switch (_colorOrder) {
407 case ColorOrder::RGB:
408 SetPixelPWM(baseRow + 0, col, r); // R on first row
409 SetPixelPWM(baseRow + 1, col, g); // G on second row
410 SetPixelPWM(baseRow + 2, col, b); // B on third row
411 break;
412 case ColorOrder::GRB:
413 SetPixelPWM(baseRow + 0, col, g); // G on first row
414 SetPixelPWM(baseRow + 1, col, r); // R on second row
415 SetPixelPWM(baseRow + 2, col, b); // B on third row
416 break;
417 case ColorOrder::BRG:
418 SetPixelPWM(baseRow + 0, col, b); // B on first row
419 SetPixelPWM(baseRow + 1, col, r); // R on second row
420 SetPixelPWM(baseRow + 2, col, g); // G on third row
421 break;
422 case ColorOrder::RBG:
423 SetPixelPWM(baseRow + 0, col, r); // R on first row
424 SetPixelPWM(baseRow + 1, col, b); // B on second row
425 SetPixelPWM(baseRow + 2, col, g); // G on third row
426 break;
427 case ColorOrder::GBR:
428 SetPixelPWM(baseRow + 0, col, g); // G on first row
429 SetPixelPWM(baseRow + 1, col, b); // B on second row
430 SetPixelPWM(baseRow + 2, col, r); // R on third row
431 break;
432 case ColorOrder::BGR:
433 SetPixelPWM(baseRow + 0, col, b); // B on first row
434 SetPixelPWM(baseRow + 1, col, g); // G on second row
435 SetPixelPWM(baseRow + 2, col, r); // R on third row
436 break;
437 }
438}
void SetPixelPWM(uint8_t row, uint8_t col, uint8_t pwm)
Set PWM duty cycle for a single LED (hardware coordinates).

Referenced by IS31FL3733::IS31FL3733RgbMatrix::SetPixelColor32().

◆ SetPixelColorMode()

void IS31FL3733::IS31FL3733::SetPixelColorMode ( uint8_t  row,
uint8_t  col,
ABMMode  mode 
)

Set mode for a logical RGB pixel (with color order mapping).

Parameters
rowLogical pixel row (1..4).
colLogical pixel column (1..16).
modeABM mode.

Definition at line 546 of file is31fl3733.cpp.

546 {
547 if (row > kLogicalRows || col > kHardwareCols || !row || !col)
548 return;
549
550 // Convert 1-based to 0-based index
551 uint8_t idx = row - 1;
552
553 // Map logical row to hardware rows based on color order
554 // baseRow will be 0, 3, 6, or 9 for logical rows 0-3
555 // Add 1 to convert to 1-based indexing for SetPixelMode
556 uint8_t baseRow = idx * 3 + 1;
557
558 // Set mode for each channel (all three use the same ABM mode for "color")
559 SetPixelMode(baseRow + 0, col, mode);
560 SetPixelMode(baseRow + 1, col, mode);
561 SetPixelMode(baseRow + 2, col, mode);
562}
void SetPixelMode(uint8_t row, uint8_t col, ABMMode mode)
Set mode for a single LED (hardware coordinates, Page 2).

◆ SetPixelMode()

void IS31FL3733::IS31FL3733::SetPixelMode ( uint8_t  row,
uint8_t  col,
ABMMode  mode 
)

Set mode for a single LED (hardware coordinates, Page 2).

Parameters
rowHardware row (1..12 = SW1..SW12).
colHardware column (1..16 = CS1..CS16).
modeLED mode value (PWM/ABM1/ABM2/ABM3).

Definition at line 466 of file is31fl3733.cpp.

466 {
467 // guard against out-of-bounds and 0 (1-based indexing)
468 if (row > kHardwareRows || col > kHardwareCols || !row || !col)
469 return;
470
471 // Convert 1-based to 0-based index
472 uint8_t idx = row - 1;
473
474 // [idx][0] is reserved for row address, so column data starts at offset 1
475 _abm_matrix[idx][col] = static_cast<uint8_t>(mode);
476
477 // Enqueue row for transmission (if not already enqueued)
478 uint16_t rowBit = 1 << idx;
479 if (_abmEnqueued & rowBit)
480 return; // Already enqueued
481
482 _abmEnqueued |= rowBit;
483 _abmPendingRows.store(idx);
484
485 // Kick transmission if not already in-flight
486 if (!_abmTxn.txPtr && !_abmLocked)
487 _sendRowMode();
488}

◆ SetPixelPWM()

void IS31FL3733::IS31FL3733::SetPixelPWM ( uint8_t  row,
uint8_t  col,
uint8_t  pwm 
)

Set PWM duty cycle for a single LED (hardware coordinates).

Parameters
rowHardware row (1..12 = SW1..SW12).
colHardware column (1..16 = CS1..CS16).
pwmPWM value (0..255).

Definition at line 329 of file is31fl3733.cpp.

329 {
330 // guard against out-of-bounds and 0 (1-based indexing)
331 if (row > kHardwareRows || col > kHardwareCols || !row || !col)
332 return;
333
334 // Convert 1-based to 0-based index
335 uint8_t idx = row - 1;
336
337 // [idx][0] is reserved for row address, so column data starts at offset 1
338 _pwm_matrix[idx][col] = pwm;
339
340 // Enqueue row for transmission (if not already enqueued)
341 uint16_t rowBit = 1 << idx;
342 if (_pwmEnqueued & rowBit)
343 return; // Already enqueued
344
345 _pwmEnqueued |= rowBit;
346 _pwmPendingRows.store(idx);
347
348 // Kick transmission if not already in-flight
349 if (!_pwmTxn.txPtr && !_pwmLocked)
350 _sendRowPWM();
351}

◆ SetRowMode()

void IS31FL3733::IS31FL3733::SetRowMode ( uint8_t  row,
ABMMode  mode 
)

Set mode for an entire row (hardware coordinates, Page 2).

Parameters
rowHardware row (1..12 = SW1..SW12).
modeLED mode value (PWM/ABM1/ABM2/ABM3).

Definition at line 490 of file is31fl3733.cpp.

490 {
491 // guard against out-of-bounds and 0 (1-based indexing)
492 if (row > kHardwareRows || !row)
493 return;
494
495 // Convert 1-based to 0-based index
496 uint8_t idx = (row - 1) & 0x0F;
497
498 // Update mode buffer for the row (starting at offset 1 since [idx][0] is reserved for row
499 // address)
500 memset(_abm_matrix[idx] + 1, static_cast<uint8_t>(mode), kHardwareCols);
501
502 // Enqueue row for transmission (if not already enqueued)
503 uint16_t rowBit = 1 << idx;
504 if (_abmEnqueued & rowBit)
505 return; // Already enqueued
506
507 _abmEnqueued |= rowBit;
508 _abmPendingRows.store(idx);
509
510 // Kick transmission if not already in-flight
511 if (!_abmTxn.txPtr && !_abmLocked)
512 _sendRowMode();
513}

◆ SetRowPWM()

void IS31FL3733::IS31FL3733::SetRowPWM ( uint8_t  row,
const uint8_t *  pwmValues 
)

Set PWM values for an entire row (hardware coordinates).

Parameters
rowHardware row (1..12 = SW1..SW12).
pwmValuesArray of 16 PWM values.

Definition at line 353 of file is31fl3733.cpp.

353 {
354 // guard against out-of-bounds and 0 (1-based indexing)
355 if (row > kHardwareRows || !row)
356 return;
357
358 // Convert 1-based to 0-based index
359 uint8_t idx = (row - 1) & 0x0F;
360
361 // Update pwm buffer for the row (starting at offset 1 since [idx][0] is reserved for row
362 // address)
363 memcpy(_pwm_matrix[idx] + 1, pwmValues, kHardwareCols);
364
365 // Enqueue row for transmission (if not already enqueued)
366 uint16_t rowBit = 1 << idx;
367 if (_pwmEnqueued & rowBit)
368 return; // Already enqueued
369
370 _pwmEnqueued |= rowBit;
371 _pwmPendingRows.store(idx);
372
373 // Kick transmission if not already in-flight
374 if (!_pwmTxn.txPtr && !_pwmLocked)
375 _sendRowPWM();
376}

◆ SetShortFaultMaskEnabled()

void IS31FL3733::IS31FL3733::SetShortFaultMaskEnabled ( bool  enable)
inline

Control whether LEDSHORT bits are applied when computing LEDONOFF mask.

Some boards can report persistent short false-positives on specific channels during OSD. When disabled, only LEDOPEN contributes to LEDONOFF masking.

Parameters
enableTrue to mask shorts and opens, false to mask opens only.

Definition at line 353 of file is31fl3733.hpp.

353 {
354 _maskShortFaults = enable;
355 }

◆ SetSWPUR()

void IS31FL3733::IS31FL3733::SetSWPUR ( uint8_t  pur)

Set SW pull-up resistor control (Page 3 SWPUR).

Parameters
purPull-up value (lower 3 bits are used).

Definition at line 305 of file is31fl3733.cpp.

305 {
306 uint8_t purValue = static_cast<uint8_t>(pur & 0x07);
307 _asyncWrite(SWPUR, &purValue, 1, nullptr, nullptr);
308}

◆ TriggerABM()

void IS31FL3733::IS31FL3733::TriggerABM ( )

Latch ABM timing updates by writing TUR on Page 3.

Definition at line 712 of file is31fl3733.cpp.

712 {
713 // Ensure Page 3
714 _ensurePage(3);
715
716 // Write any value to TUR (0x0E) to latch configuration
717 // Per datasheet: "Any write to 0Eh will latch the ABM configuration"
718 // We write 0x00 as the trigger value
719 uint8_t tur_value = 0x00;
720 _asyncWrite(TUR, &tur_value, 1, nullptr, nullptr);
721}

Member Data Documentation

◆ _abm_matrix

uint8_t IS31FL3733::IS31FL3733::_abm_matrix[kHardwareRows][kHardwareCols+1]
private

[row][0] = Page 2 row addr, [1..16] = ABM data

Definition at line 553 of file is31fl3733.hpp.

◆ _abmCallbacks

std::function<void()> IS31FL3733::IS31FL3733::_abmCallbacks[3]
private

Completion callbacks for ABM1/2/3.

Definition at line 563 of file is31fl3733.hpp.

◆ _abmEnqueued

uint16_t IS31FL3733::IS31FL3733::_abmEnqueued
private

Bitfield tracking enqueued rows (0x0001..0x0FFF)

Definition at line 559 of file is31fl3733.hpp.

◆ _abmLocked

bool IS31FL3733::IS31FL3733::_abmLocked
private

True when command chain has preempted ABM.

Definition at line 561 of file is31fl3733.hpp.

◆ _abmPendingRows

RingBufferN<kHardwareRows + 1> IS31FL3733::IS31FL3733::_abmPendingRows
private

Effective capacity: kHardwareRows.

Definition at line 558 of file is31fl3733.hpp.

◆ _abmTxn

SercomTxn IS31FL3733::IS31FL3733::_abmTxn
private

Single in-flight ABM transaction descriptor.

Definition at line 555 of file is31fl3733.hpp.

◆ _abmTxPtr

uint8_t IS31FL3733::IS31FL3733::_abmTxPtr[kHardwareCols+1]
private

Shadow buffer for current transaction.

Definition at line 556 of file is31fl3733.hpp.

◆ _addr

uint8_t IS31FL3733::IS31FL3733::_addr
private

7-bit I2C address

Definition at line 523 of file is31fl3733.hpp.

◆ _begun

bool IS31FL3733::IS31FL3733::_begun
private

True after successful begin(); used for destructor auto-end safety.

Definition at line 597 of file is31fl3733.hpp.

◆ _cmdCtx

CmdTxnContext IS31FL3733::IS31FL3733::_cmdCtx[4]
private

Context for each command transaction (for callbacks)

Definition at line 583 of file is31fl3733.hpp.

◆ _cmdError

volatile uint8_t IS31FL3733::IS31FL3733::_cmdError
private

Bitfield of command transactions with nonzero status.

Definition at line 590 of file is31fl3733.hpp.

◆ _cmdReturn

volatile uint8_t IS31FL3733::IS31FL3733::_cmdReturn
private

Bitfield of completed command transactions (bits 0..3)

Definition at line 589 of file is31fl3733.hpp.

◆ _cmdRx

uint8_t IS31FL3733::IS31FL3733::_cmdRx[24]
private

RX buffer (max: 24 bytes for LED Open/Short)

Definition at line 587 of file is31fl3733.hpp.

◆ _cmdTx

uint8_t IS31FL3733::IS31FL3733::_cmdTx[25]
private

TX buffer (max: 1 addr + 24 data for LED On/Off)

Definition at line 586 of file is31fl3733.hpp.

◆ _cmdTxn

SercomTxn IS31FL3733::IS31FL3733::_cmdTxn[4]
private

[0]=unlock, [1]=page, [2]=write, [3]=read

Definition at line 571 of file is31fl3733.hpp.

◆ _colorOrder

ColorOrder IS31FL3733::IS31FL3733::_colorOrder
private

RGB pixel color order.

Definition at line 616 of file is31fl3733.hpp.

◆ _crValue

uint8_t IS31FL3733::IS31FL3733::_crValue
private

Shadow of CR register state for runtime updates.

Definition at line 615 of file is31fl3733.hpp.

◆ _crwlTx

uint8_t IS31FL3733::IS31FL3733::_crwlTx[2]
private

Pre-staged unlock transaction {PSWL, PSWL_ENABLE}.

Definition at line 584 of file is31fl3733.hpp.

◆ _currentPage

uint8_t IS31FL3733::IS31FL3733::_currentPage
private

Tracks current page (0-3, 0xFF=unknown) to minimize page selects.

Definition at line 526 of file is31fl3733.hpp.

◆ _hw

SERCOM* IS31FL3733::IS31FL3733::_hw
private

SERCOM I2C hardware interface.

Definition at line 522 of file is31fl3733.hpp.

◆ _instance

IS31FL3733 * IS31FL3733::IS31FL3733::_instance = nullptr
staticprivate

Static instance pointer for ISR access.

Definition at line 528 of file is31fl3733.hpp.

◆ _irqPin

uint8_t IS31FL3733::IS31FL3733::_irqPin
private

IRQ pin (0xFF = not used)

Definition at line 525 of file is31fl3733.hpp.

◆ _lastISR

uint8_t IS31FL3733::IS31FL3733::_lastISR
private

Cached ISR value from last fault detection.

Definition at line 607 of file is31fl3733.hpp.

◆ _ledOn

uint8_t IS31FL3733::IS31FL3733::_ledOn[24]
private

Computed LED On/Off mask (Page 0, 0x00)

Definition at line 606 of file is31fl3733.hpp.

◆ _ledOpen

uint8_t IS31FL3733::IS31FL3733::_ledOpen[24]
private

Cached LED open status (Page 0, 0x18)

Definition at line 604 of file is31fl3733.hpp.

◆ _ledShort

uint8_t IS31FL3733::IS31FL3733::_ledShort[24]
private

Cached LED short status (Page 0, 0x30)

Definition at line 605 of file is31fl3733.hpp.

◆ _maskShortFaults

bool IS31FL3733::IS31FL3733::_maskShortFaults
private

Include LEDSHORT bits in computed LEDONOFF mask.

Definition at line 617 of file is31fl3733.hpp.

◆ _pgSelTx

uint8_t IS31FL3733::IS31FL3733::_pgSelTx[2]
private

Page select transaction buffer {PSR, page}.

Definition at line 585 of file is31fl3733.hpp.

◆ _pwm_matrix

uint8_t IS31FL3733::IS31FL3733::_pwm_matrix[kHardwareRows][kHardwareCols+1]
private

[row][0] = Page 1 row addr, [1..16] = PWM data

Definition at line 536 of file is31fl3733.hpp.

◆ _pwmBatchActive

bool IS31FL3733::IS31FL3733::_pwmBatchActive
private

True while staged PWM updates are being batched.

Definition at line 545 of file is31fl3733.hpp.

◆ _pwmEnqueued

uint16_t IS31FL3733::IS31FL3733::_pwmEnqueued
private

Bitfield tracking enqueued rows (0x0001..0x0FFF)

Definition at line 542 of file is31fl3733.hpp.

◆ _pwmLocked

bool IS31FL3733::IS31FL3733::_pwmLocked
private

True when command chain has preempted PWM.

Definition at line 544 of file is31fl3733.hpp.

◆ _pwmPendingRows

RingBufferN<kHardwareRows + 1> IS31FL3733::IS31FL3733::_pwmPendingRows
private

Effective capacity: kHardwareRows.

Definition at line 541 of file is31fl3733.hpp.

◆ _pwmTxn

SercomTxn IS31FL3733::IS31FL3733::_pwmTxn
private

Single in-flight PWM transaction descriptor.

Definition at line 538 of file is31fl3733.hpp.

◆ _pwmTxPtr

uint8_t IS31FL3733::IS31FL3733::_pwmTxPtr[kHardwareCols+1]
private

Shadow buffer for current transaction.

Definition at line 539 of file is31fl3733.hpp.

◆ _sdbPin

uint8_t IS31FL3733::IS31FL3733::_sdbPin
private

SDB (shutdown) pin (0xFF = not used)

Definition at line 524 of file is31fl3733.hpp.

◆ _syncComplete

volatile bool IS31FL3733::IS31FL3733::_syncComplete
private

Blocking command completion flag.

Definition at line 592 of file is31fl3733.hpp.

◆ _syncStatus

volatile int IS31FL3733::IS31FL3733::_syncStatus
private

Blocking command final status.

Definition at line 593 of file is31fl3733.hpp.

◆ _syncTargetCmd

volatile int8_t IS31FL3733::IS31FL3733::_syncTargetCmd
private

Index of command awaited by blocking API.

Definition at line 594 of file is31fl3733.hpp.


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