|
XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
|
XPointDriver implementation for the TLC59711 SPI PWM driver. More...
#include <TLC59711Driver.h>
Public Types | |
| typedef uint16_t(* | MapFn) (uint8_t r, uint8_t c) |
Function pointer type: (row, col) → channel index [0, nChips*12). | |
Public Member Functions | |
| TLC59711Driver (uint8_t nChips, MapFn map) | |
| Construct the driver. | |
| ~TLC59711Driver () | |
| Destructor — frees PWM and packet buffers. | |
| void | begin () override |
Initialize the SPI bus by calling SPI.begin(). No-op on host builds. | |
| void | setNodeHardware (uint8_t r, uint8_t c, bool state) override |
Set channel to 0xFFFF (state=true) or 0x0000 (state=false). | |
| void | setNodeLevel (uint8_t r, uint8_t c, uint16_t level) override |
| Set channel to an exact 16-bit PWM value without clamping. | |
| void | commitPhysicalUpdates () override |
| Assemble and transmit the SPI packet for all chips. | |
| void | setPWM (uint16_t ch, uint16_t val) |
| Direct channel write, bypassing the XPoint state table. | |
| const uint8_t * | lastPacket () const |
| Return a pointer to the most recently assembled SPI packet. | |
| uint16_t | lastPacketSize () const |
| Return the size of the SPI packet in bytes. | |
Public Member Functions inherited from XPointDriver | |
| virtual | ~XPointDriver () |
| virtual void | releaseNode (uint8_t, uint8_t) |
| De-energize the coil that was pulsed on node (r, c). | |
XPointDriver implementation for the TLC59711 SPI PWM driver.
Supports daisy-chaining multiple chips. Each chip provides 12 channels, giving nChips * 12 total addressable outputs.
All PWM values are held in a heap buffer and transmitted as a single SPI burst by commitPhysicalUpdates().
| typedef uint16_t(* TLC59711Driver::MapFn) (uint8_t r, uint8_t c) |
Function pointer type: (row, col) → channel index [0, nChips*12).
| TLC59711Driver::TLC59711Driver | ( | uint8_t | nChips, |
| MapFn | map | ||
| ) |
Construct the driver.
| [in] | nChips | Number of daisy-chained TLC59711 chips (1 chip = 12 channels). |
| [in] | map | Mapper; must return channel indices in [0, nChips*12). |
| TLC59711Driver::~TLC59711Driver | ( | ) |
Destructor — frees PWM and packet buffers.
|
overridevirtual |
Initialize the SPI bus by calling SPI.begin(). No-op on host builds.
Implements XPointDriver.
|
overridevirtual |
Assemble and transmit the SPI packet for all chips.
Sends chip N−1 data first so the chain's physical ordering matches the mapper's channel numbering. No-op on host builds.
Reimplemented from XPointDriver.
|
inline |
Return a pointer to the most recently assembled SPI packet.
Valid until the next commitPhysicalUpdates() call.
|
inline |
Return the size of the SPI packet in bytes.
nChips * 28.
|
overridevirtual |
Set channel to 0xFFFF (state=true) or 0x0000 (state=false).
| [in] | r | Row index. |
| [in] | c | Column index. |
| [in] | state | true = full on, false = off. |
Implements XPointDriver.
|
overridevirtual |
Set channel to an exact 16-bit PWM value without clamping.
| [in] | r | Row index. |
| [in] | c | Column index. |
| [in] | level | PWM value 0x0000–0xFFFF. |
Reimplemented from XPointDriver.
| void TLC59711Driver::setPWM | ( | uint16_t | ch, |
| uint16_t | val | ||
| ) |
Direct channel write, bypassing the XPoint state table.
| [in] | ch | Channel index [0, nChips*12). |
| [in] | val | 16-bit PWM value. |