XPoint 0.1.0
Hardware-agnostic crosspoint matrix routing library
Loading...
Searching...
No Matches
HC595Helper Namespace Reference

Utilities for 74HC595 daisy-chain index computation. More...

Functions

uint16_t rowMajorIndex (uint8_t row, uint8_t col, uint8_t cols)
 Compute the row-major bit index for node (row, col).
 

Detailed Description

Utilities for 74HC595 daisy-chain index computation.

Function Documentation

◆ rowMajorIndex()

uint16_t HC595Helper::rowMajorIndex ( uint8_t  row,
uint8_t  col,
uint8_t  cols 
)
inline

Compute the row-major bit index for node (row, col).

Maps a 2-D matrix position to a flat bit index for a 74HC595 chain wired in row-major order (row 0 bits first, then row 1, etc.).

Parameters
[in]rowRow index (zero-based).
[in]colColumn index (zero-based).
[in]colsTotal number of columns in the matrix.
Returns
Flat bit index: row * cols + col.