XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
Loading...
Searching...
No Matches
ArduinoShiftRegisterDriver Class Reference

XPointDriver implementation for daisy-chained 74HC595 shift registers. More...

#include <ArduinoShiftRegisterDriver.h>

Inheritance diagram for ArduinoShiftRegisterDriver:
XPointDriver

Public Types

typedef uint16_t(* MapFn) (uint8_t r, uint8_t c)
 Function pointer type: (row, col) → bit index within the shift register chain.
 

Public Member Functions

 ArduinoShiftRegisterDriver (uint16_t nOut, MapFn map, int dPin, int ckPin, int ltPin)
 Construct the driver.
 
 ~ArduinoShiftRegisterDriver ()
 Destructor — frees the shadow byte buffer.
 
void begin () override
 Configure DATA, CLOCK, and LATCH pins as OUTPUT then clear all outputs.
 
void setNodeHardware (uint8_t r, uint8_t c, bool state) override
 Update the shadow buffer for the bit mapped from (r, c).
 
void commitPhysicalUpdates () override
 Clock the full shadow buffer out to the shift register chain.
 
- Public Member Functions inherited from XPointDriver
virtual ~XPointDriver ()
 
virtual void setNodeLevel (uint8_t r, uint8_t c, uint16_t level)
 Set an analog drive level for node (r, c).
 
virtual void releaseNode (uint8_t, uint8_t)
 De-energize the coil that was pulsed on node (r, c).
 

Detailed Description

XPointDriver implementation for daisy-chained 74HC595 shift registers.

Uses software bit-bang via Arduino digitalWrite() — no SPI hardware required. Suitable when hardware SPI pins are already in use or unavailable.

Member Typedef Documentation

◆ MapFn

typedef uint16_t(* ArduinoShiftRegisterDriver::MapFn) (uint8_t r, uint8_t c)

Function pointer type: (row, col) → bit index within the shift register chain.

Constructor & Destructor Documentation

◆ ArduinoShiftRegisterDriver()

ArduinoShiftRegisterDriver::ArduinoShiftRegisterDriver ( uint16_t  nOut,
MapFn  map,
int  dPin,
int  ckPin,
int  ltPin 
)

Construct the driver.

Parameters
[in]nOutTotal number of shift register output bits.
[in]mapMapper; must return indices in [0, nOut).
[in]dPinDATA (DS) pin number.
[in]ckPinCLOCK (SH_CP) pin number.
[in]ltPinLATCH (ST_CP) pin number.

◆ ~ArduinoShiftRegisterDriver()

ArduinoShiftRegisterDriver::~ArduinoShiftRegisterDriver ( )

Destructor — frees the shadow byte buffer.

Member Function Documentation

◆ begin()

void ArduinoShiftRegisterDriver::begin ( )
overridevirtual

Configure DATA, CLOCK, and LATCH pins as OUTPUT then clear all outputs.

Calls commitPhysicalUpdates() to clock zeros to all shift register outputs.

Implements XPointDriver.

◆ commitPhysicalUpdates()

void ArduinoShiftRegisterDriver::commitPhysicalUpdates ( )
overridevirtual

Clock the full shadow buffer out to the shift register chain.

Sends bytes MSB-first, last byte first (standard 74HC595 daisy-chain order) then pulses the latch pin to transfer data to outputs.

Reimplemented from XPointDriver.

◆ setNodeHardware()

void ArduinoShiftRegisterDriver::setNodeHardware ( uint8_t  r,
uint8_t  c,
bool  state 
)
overridevirtual

Update the shadow buffer for the bit mapped from (r, c).

Does not immediately clock to hardware; call commitPhysicalUpdates() to flush (XPoint does this automatically after every operation).

Parameters
[in]rRow index.
[in]cColumn index.
[in]statetrue = set bit, false = clear bit.

Implements XPointDriver.


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