\hypertarget{spi2_8c}{
\section{spi2.c File Reference}
\label{spi2_8c}\index{spi2.c@{spi2.c}}
}
{\ttfamily \#include $<$avr/io.h$>$}\par
{\ttfamily \#include \char`\"{}spi2.h\char`\"{}}\par
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{spi2_8c_aa46b0a8c5da4fabba49e9f0f66ffb618}{init\_\-spi} (uint8\_\-t rate)
\begin{DoxyCompactList}\small\item\em Initialise the rate for the SPI bus. \item\end{DoxyCompactList}\item 
void \hyperlink{spi2_8c_ac66858a9b2aa4d292b69b4fd11f59105}{xmit\_\-spi} (uint8\_\-t dat)
\begin{DoxyCompactList}\small\item\em Transmit an 8 bit value to the SPI bus. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{spi2_8c_ab8f6518f4a25d855751513457a4e39b9}{recv\_\-spi} (void)
\begin{DoxyCompactList}\small\item\em Receive an 8 bit value from the SPI bus. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{spi2_8c_aa46b0a8c5da4fabba49e9f0f66ffb618}{
\index{spi2.c@{spi2.c}!init\_\-spi@{init\_\-spi}}
\index{init\_\-spi@{init\_\-spi}!spi2.c@{spi2.c}}
\subsubsection[{init\_\-spi}]{\setlength{\rightskip}{0pt plus 5cm}void init\_\-spi (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{ rate}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{spi2_8c_aa46b0a8c5da4fabba49e9f0f66ffb618}


Initialise the rate for the SPI bus. 


\begin{DoxyParams}{Parameters}
\item[{\em rate}]Value whose bottom 2 bits are used to set the SPI bus rate.\end{DoxyParams}
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_8c_ab8f6518f4a25d855751513457a4e39b9}{
\index{spi2.c@{spi2.c}!recv\_\-spi@{recv\_\-spi}}
\index{recv\_\-spi@{recv\_\-spi}!spi2.c@{spi2.c}}
\subsubsection[{recv\_\-spi}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t recv\_\-spi (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{spi2_8c_ab8f6518f4a25d855751513457a4e39b9}


Receive an 8 bit value from the SPI bus. 

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


Transmit an 8 bit value to the SPI bus. 


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