uart.tex
33 lines
| 1.5 KiB
| application/x-tex
|
TexLexer
alexis
|
r0 | \section{UART} | ||
\subsection{Generals:} | ||||
On many microcontrolers you can use \textbf{U}niversal \textbf{A}synchronous \textbf{R}eceiver \textbf{T}ransmitter, in order to provide a standart access to this device you have to | ||||
implement th folowing functions: | ||||
\begin{itemize} | ||||
\item uart\_t \textbf{uartopen}(int); | ||||
\item \textbf{uartclose}(uart\_t); | ||||
\item \textbf{uartsetup}(uart\_t,int,int); | ||||
\item \textbf{uartputc}(uart\_t, char); | ||||
\item char \textbf{uartgetc}(uart\_t); | ||||
\item \textbf{uartputstring}(uart\_t,char*); | ||||
\item \textbf{uartgetstring}(uart\_t,char*); | ||||
\end{itemize} | ||||
\subsection{Details} | ||||
\subsubsection{\textbf{Openning uart}} | ||||
uart\_t \textbf{uartopen}(int) \\ | ||||
This function has to open N\ieme \textbf{ uart} device, so it has to perform basical configuration such as powering up the device \dots This finction has also to return the pointer to the devicce handle. | ||||
\subsubsection{\textbf{Closing uart}} | ||||
\textbf{uartclose}(uart\_t) | ||||
\subsubsection{\textbf{Configure uart}} | ||||
\textbf{uartsetup}(uart\_t,int baudrate,int cpuclk) | ||||
\subsubsection{\textbf{Sending a char through uart}} | ||||
\textbf{uartputc}(uart\_t, char) | ||||
\subsubsection{\textbf{Receiving a char from uart}} | ||||
char \textbf{uartgetc}(uart\_t) | ||||
\subsubsection{\textbf{Sending a string through uart}} | ||||
\textbf{uartputstring}(uart\_t,char*) | ||||
\subsubsection{\textbf{Receiving a string from uart}} | ||||
\textbf{uartgetstring}(uart\_t,char*) | ||||