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

Host-only virtual shift-register driver — no hardware dependency. More...

#include <ShiftRegisterDriver.h>

Inheritance diagram for ShiftRegisterDriver:
XPointDriver

Public Types

typedef uint16_t(* MapFn) (uint8_t r, uint8_t c)
 Function pointer type: (row, col) → output bit index.
 

Public Member Functions

 ShiftRegisterDriver (uint16_t nOut, MapFn map)
 Construct with an output count and a node-to-bit-index mapper.
 
 ~ShiftRegisterDriver ()
 Destructor — frees the shadow buffer.
 
void begin () override
 Zero the shadow buffer.
 
void setNodeHardware (uint8_t r, uint8_t c, bool state) override
 Set or clear one bit in the shadow buffer.
 
void commitPhysicalUpdates () override
 No-op for this virtual driver (no physical chain to clock).
 
uint8_t byteAt (uint16_t idx) const
 Read one byte from the shadow buffer.
 
uint16_t byteCount () const
 Return the number of bytes in the shadow buffer.
 
- 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

Host-only virtual shift-register driver — no hardware dependency.

Useful for verifying bit-packing logic without Arduino headers or SPI/GPIO hardware. The shadow buffer is directly readable via byteAt().

Member Typedef Documentation

◆ MapFn

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

Function pointer type: (row, col) → output bit index.

Constructor & Destructor Documentation

◆ ShiftRegisterDriver()

ShiftRegisterDriver::ShiftRegisterDriver ( uint16_t  nOut,
MapFn  map 
)

Construct with an output count and a node-to-bit-index mapper.

Parameters
[in]nOutTotal number of shift-register output bits.
[in]mapMapper; must return indices in [0, nOut).

◆ ~ShiftRegisterDriver()

ShiftRegisterDriver::~ShiftRegisterDriver ( )

Destructor — frees the shadow buffer.

Member Function Documentation

◆ begin()

void ShiftRegisterDriver::begin ( )
overridevirtual

Zero the shadow buffer.

Implements XPointDriver.

◆ byteAt()

uint8_t ShiftRegisterDriver::byteAt ( uint16_t  idx) const

Read one byte from the shadow buffer.

Parameters
[in]idxByte index in [0, byteCount).
Returns
Shadow byte value, or 0 if idx is out of range.

◆ byteCount()

uint16_t ShiftRegisterDriver::byteCount ( ) const
inline

Return the number of bytes in the shadow buffer.

Returns
ceil(nOut / 8).

◆ commitPhysicalUpdates()

void ShiftRegisterDriver::commitPhysicalUpdates ( )
overridevirtual

No-op for this virtual driver (no physical chain to clock).

Reimplemented from XPointDriver.

◆ setNodeHardware()

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

Set or clear one bit in the shadow buffer.

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: