\hypertarget{spi2_8h}{
\section{spi2.h File Reference}
\label{spi2_8h}\index{spi2.h@{spi2.h}}
}
{\tt \#include $<$avr/io.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{spi2_8h_a46b0a8c5da4fabba49e9f0f66ffb618}{init\_\-spi} (uint8\_\-t rate)
\begin{CompactList}\small\item\em Initialise the rate for the SPI bus. \item\end{CompactList}\item 
void \hyperlink{spi2_8h_261854fbb65c5449db9e2dcfb7e0b323}{xmit\_\-spi} (uint8\_\-t data)
\begin{CompactList}\small\item\em Transmit an 8 bit value to the SPI bus. \item\end{CompactList}\item 
uint8\_\-t \hyperlink{spi2_8h_b8f6518f4a25d855751513457a4e39b9}{recv\_\-spi} (void)
\begin{CompactList}\small\item\em Receive an 8 bit value from the SPI bus. \item\end{CompactList}\end{CompactItemize}


\subsection{Function Documentation}
\hypertarget{spi2_8h_a46b0a8c5da4fabba49e9f0f66ffb618}{
\index{spi2.h@{spi2.h}!init\_\-spi@{init\_\-spi}}
\index{init\_\-spi@{init\_\-spi}!spi2.h@{spi2.h}}
\subsubsection[{init\_\-spi}]{\setlength{\rightskip}{0pt plus 5cm}void init\_\-spi (uint8\_\-t {\em rate})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{spi2_8h_a46b0a8c5da4fabba49e9f0f66ffb618}


Initialise the rate for the SPI bus. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em rate}]Value whose bottom 2 bits are used to set the SPI bus rate.\end{description}
\end{Desc}
Requires I/O to have been set correctly independently See Atmel datasheet for the correct value to use in this function to get the SPI rate required. rate is masked so only the bottom 2 bits are valid. rate 0 0 fosc/4 0 1 fosc/16 1 0 fosc/64 1 1 fosc/128 \hypertarget{spi2_8h_b8f6518f4a25d855751513457a4e39b9}{
\index{spi2.h@{spi2.h}!recv\_\-spi@{recv\_\-spi}}
\index{recv\_\-spi@{recv\_\-spi}!spi2.h@{spi2.h}}
\subsubsection[{recv\_\-spi}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t recv\_\-spi (void)\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{spi2_8h_b8f6518f4a25d855751513457a4e39b9}


Receive an 8 bit value from the SPI bus. 

\begin{Desc}
\item[Returns:]Value from SPI bus.\end{Desc}
Requires spi\_\-init() to have been run, and I/O set correctly \hypertarget{spi2_8h_261854fbb65c5449db9e2dcfb7e0b323}{
\index{spi2.h@{spi2.h}!xmit\_\-spi@{xmit\_\-spi}}
\index{xmit\_\-spi@{xmit\_\-spi}!spi2.h@{spi2.h}}
\subsubsection[{xmit\_\-spi}]{\setlength{\rightskip}{0pt plus 5cm}void xmit\_\-spi (uint8\_\-t {\em data})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{spi2_8h_261854fbb65c5449db9e2dcfb7e0b323}


Transmit an 8 bit value to the SPI bus. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Value to send via SPI bus.\end{description}
\end{Desc}
Requires spi\_\-init() to have been run, and I/O set correctly 