\section{Digital Output} The digital output unit provides a write access to one or more pins of a GPIO port. This unit additionally supports pulse generation on any of its pins. This is implemented in software with the timing derived from the system timebase, as the hardware timer outputs, otherwise used for PWM or pulse generation, are available only on several dedicated pins. The timing code is optimized to reduce jitter. \todo{Measure jitter and add it here} \subsection{Digital Output Configuration} \begin{inicode} [DO:out@1] # Port name port=A # Pins (comma separated, supports ranges) pins=0 # Initially high pins initial= # Open-drain pins open-drain= \end{inicode} \subsection{Digital Output Events} This unit generates no events. \subsection{Digital Output Commands} \begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}} \toprule \textbf{Code} & \textbf{Function} & \textbf{Payload} \\ \midrule 0 & \flname{WRITE} Write to all pins & \makecell[tl]{ \fldreq \fld{u16} new value } \\ 1 & \flname{SET} Set selected pins to 1 & \makecell[tl]{ \fldreq \fld{u16} pins to set } \\ 2 & \flname{CLEAR} Set selected pins to 0 & \makecell[tl]{ \fldreq \fld{u16} pins to clear } \\ 3 & \flname{TOGGLE} Toggle selected pins & \makecell[tl]{ \fldreq \fld{u16} pins to toggle } \\ 4 & \flname{PULSE} Generate a pulse on the selected pins. The $\mu$s scale may be used only for 0--999\,$\mu$s. & \makecell[tl]{ \fldreq \fld{u16} pins to pulse \\ \fld{u8} active level (0, 1) \\ \fld{u8} scale: 0-ms, 1-$\mu$s \\ \fld{u16} duration } \\ \bottomrule \end{tabularx}