XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
Loading...
Searching...
No Matches
TLC59711Driver.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (c) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
3// https://github.com/dstroy0/XPoint
4
28#ifndef TLC59711_DRIVER_H
29#define TLC59711_DRIVER_H
30
31#include "XPointDriver.h"
32#include <stdint.h>
33
44{
45 public:
47 typedef uint16_t (*MapFn)(uint8_t r, uint8_t c);
48
55 TLC59711Driver(uint8_t nChips, MapFn map);
56
59
64 void begin() override;
65
73 void setNodeHardware(uint8_t r, uint8_t c, bool state) override;
74
82 void setNodeLevel(uint8_t r, uint8_t c, uint16_t level) override;
83
90 void commitPhysicalUpdates() override;
91
98 void setPWM(uint16_t ch, uint16_t val);
99
107 const uint8_t *lastPacket() const
108 {
109 return _pkt;
110 }
111
116 uint16_t lastPacketSize() const
117 {
118 return _pktSz;
119 }
120
121 private:
122 uint8_t _nChips;
123 MapFn _map;
124 uint16_t _nCh;
125 uint16_t _pktSz;
126 uint16_t *_pwms;
127 uint8_t *_pkt;
128};
129
130#endif // TLC59711_DRIVER_H
Abstract hardware driver interface for the XPoint crosspoint matrix.
XPointDriver implementation for the TLC59711 SPI PWM driver.
Definition TLC59711Driver.h:44
uint16_t(* MapFn)(uint8_t r, uint8_t c)
Function pointer type: (row, col) → channel index [0, nChips*12).
Definition TLC59711Driver.h:47
void setNodeHardware(uint8_t r, uint8_t c, bool state) override
Set channel to 0xFFFF (state=true) or 0x0000 (state=false).
Definition TLC59711Driver.cpp:57
~TLC59711Driver()
Destructor — frees PWM and packet buffers.
Definition TLC59711Driver.cpp:44
void commitPhysicalUpdates() override
Assemble and transmit the SPI packet for all chips.
Definition TLC59711Driver.cpp:77
void begin() override
Initialize the SPI bus by calling SPI.begin(). No-op on host builds.
Definition TLC59711Driver.cpp:50
const uint8_t * lastPacket() const
Return a pointer to the most recently assembled SPI packet.
Definition TLC59711Driver.h:107
void setPWM(uint16_t ch, uint16_t val)
Direct channel write, bypassing the XPoint state table.
Definition TLC59711Driver.cpp:71
void setNodeLevel(uint8_t r, uint8_t c, uint16_t level) override
Set channel to an exact 16-bit PWM value without clamping.
Definition TLC59711Driver.cpp:64
uint16_t lastPacketSize() const
Return the size of the SPI packet in bytes.
Definition TLC59711Driver.h:116
Abstract base class for all XPoint hardware drivers.
Definition XPointDriver.h:41