\section{SIPO (Shift Register) Unit}

The shift registers driver unit is designed for the loading of data into \textit{serial-in, parallel-out} (SIPO) shift registers, such as 74HC4094 or 74HC595. Those are commonly used to control segmented LED displays, LED matrices etc.

This unit handles both the \textit{Shift} and \textit{Store} signals and is capable of loading multiple shift registers simultaneously, reducing visible glitches in the display. It's also possible to set the data lines to arbitrary level(s) before sending the Store pulse, which can be latched and used for some additional feature of the LED display, such as brightness control.


\subsection{SIPO Configuration}

\begin{inicode}
[SIPO:display@9]
# Shift pin & its active edge (1-rising,0-falling)
shift-pin=A1
shift-pol=1
# Store pin & its active edge
store-pin=A0
store-pol=1
# Clear pin & its active level
clear-pin=A2
clear-pol=0
# Data port and pins
data-port=A
data-pins=3
\end{inicode}

\subsection{SIPO Commands}

\begin{cmdlist}
	0 & \cname{WRITE}
	Load the shift registers and leave the data outputs in the "trailing data" state before sending the Store pulse.
	& 
	\begin{cmdreq}
		\cfield{u16} trailing data
		\item For each output (same size)
		\begin{pldlist}
			\cfield{u8[]} data to load
		\end{pldlist}
	\end{cmdreq} 
	\\

	1 & \cname{DIRECT\_DATA}
	Directly write to the data pins (same like the DO unit's WRITE command)
	&
    \begin{cmdreq}
		\cfield{u16} values to write
	\end{cmdreq} \\

	2 & 
	\cname{DIRECT\_CLEAR} 
	Pulse the Clear pin, erasing the registers' data & \\
	
	3 & 
	\cname{DIRECT\_SHIFT}
	Pulse the Shift pin & \\
	
	4 & 
	\cname{DIRECT\_STORE} 
	Pulse the Store pin & \\
\end{cmdlist}



