GEX thesis source code, full text, references
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
gex-thesis/ch.unit.do.tex

52 行
1.4 KiB

\section{Digital Output}
The digital output unit provides a write access to one or more pins of a \gls{GPIO} port. This unit additionally supports pulse generation on any of its pins; this is implemented in software, with timing derived from the system timebase, in order to support pulses on all pins regardless of hardware \gls{PWM} support. Pins in commands are expressed in the packed format (\cref{sec:packedpins}).
\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 Commands}
\begin{cmdlist}
0 & \cname{WRITE} Write to all pins
& \begin{cmdreq}
\cfield{u16} new value
\end{cmdreq} \\
1 & \cname{SET} Set selected pins to 1
& \begin{cmdreq}
\cfield{u16} pins to set
\end{cmdreq} \\
2 & \cname{CLEAR} Set selected pins to 0
& \begin{cmdreq}
\cfield{u16} pins to clear
\end{cmdreq} \\
3 & \cname{TOGGLE} Toggle selected pins
& \begin{cmdreq}
\cfield{u16} pins to toggle
\end{cmdreq} \\
4 & \cname{PULSE}
Generate a pulse on the selected pins. The microsecond scale may be used only for 0--999\,$\mu$s.
& \begin{cmdreq}
\cfield{u16} pins to pulse
\cfield{bool} active level
\cfield{u8} scale: 0--ms, 1--$\mu$s
\cfield{u16} duration
\end{cmdreq}
\end{cmdlist}