\section{aversive\_\-10-03-12/modules/comm/spi/spi.h File Reference}
\label{spi_8h}\index{aversive\_\-10-03-12/modules/comm/spi/spi.h@{aversive\_\-10-03-12/modules/comm/spi/spi.h}}
{\tt \#include $<$stdint.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf SPI\_\-MSB\_\-FIRST}~0
\item 
\#define {\bf SPI\_\-LSB\_\-FIRST}~1
\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum {\bf spi\_\-mode\_\-t} \{ {\bf SPI\_\-MODE\_\-UNINIT}, 
{\bf SPI\_\-MODE\_\-MASTER}
 \}
\item 
enum {\bf spi\_\-format\_\-t} \{ {\bf SPI\_\-FORMAT\_\-0} =  0x00, 
{\bf SPI\_\-FORMAT\_\-1} =  \_\-BV(CPHA), 
{\bf SPI\_\-FORMAT\_\-2} =  \_\-BV(CPOL), 
{\bf SPI\_\-FORMAT\_\-3} =  \_\-BV(CPHA) $|$ \_\-BV(CPOL)
 \}
\item 
enum {\bf spi\_\-clk\_\-rate\_\-t} \{ \par
{\bf SPI\_\-CLK\_\-RATE\_\-2} =  0x10, 
{\bf SPI\_\-CLK\_\-RATE\_\-4} =  0x00, 
{\bf SPI\_\-CLK\_\-RATE\_\-8} =  0x11, 
{\bf SPI\_\-CLK\_\-RATE\_\-16} =  0x01, 
\par
{\bf SPI\_\-CLK\_\-RATE\_\-32} =  0x12, 
{\bf SPI\_\-CLK\_\-RATE\_\-64} =  0x02, 
{\bf SPI\_\-CLK\_\-RATE\_\-128} =  0x03
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf spi\_\-set\_\-data\_\-order} (uint8\_\-t order)
\item 
void {\bf spi\_\-init} ({\bf spi\_\-mode\_\-t} mode, {\bf spi\_\-format\_\-t} format, {\bf spi\_\-clk\_\-rate\_\-t} clk\_\-rate)
\item 
{\bf spi\_\-mode\_\-t} {\bf spi\_\-get\_\-mode} (void)
\item 
int8\_\-t {\bf spi\_\-register\_\-ss\_\-line} (volatile uint8\_\-t $\ast$port, uint8\_\-t bitnum)
\item 
uint8\_\-t {\bf spi\_\-send\_\-and\_\-receive\_\-byte} (uint8\_\-t byte)
\item 
void {\bf spi\_\-send\_\-byte} (uint8\_\-t byte)
\item 
uint8\_\-t {\bf spi\_\-receive\_\-byte} (void)
\item 
uint8\_\-t {\bf spi\_\-slave\_\-select} (uint8\_\-t slave)
\item 
void {\bf spi\_\-slave\_\-deselect} (uint8\_\-t slave)
\item 
void {\bf spi\_\-display\_\-ss\_\-lines} (void)
\end{CompactItemize}


\subsection{Define Documentation}
\index{spi.h@{spi.h}!SPI\_\-LSB\_\-FIRST@{SPI\_\-LSB\_\-FIRST}}
\index{SPI\_\-LSB\_\-FIRST@{SPI\_\-LSB\_\-FIRST}!spi.h@{spi.h}}
\subsubsection[SPI\_\-LSB\_\-FIRST]{\setlength{\rightskip}{0pt plus 5cm}\#define SPI\_\-LSB\_\-FIRST~1}\label{spi_8h_8d194446c8ac9f3c878ead3c9382c9e4}




Definition at line 105 of file spi.h.

Referenced by spi\_\-get\_\-data\_\-order(), and spi\_\-set\_\-data\_\-order().\index{spi.h@{spi.h}!SPI\_\-MSB\_\-FIRST@{SPI\_\-MSB\_\-FIRST}}
\index{SPI\_\-MSB\_\-FIRST@{SPI\_\-MSB\_\-FIRST}!spi.h@{spi.h}}
\subsubsection[SPI\_\-MSB\_\-FIRST]{\setlength{\rightskip}{0pt plus 5cm}\#define SPI\_\-MSB\_\-FIRST~0}\label{spi_8h_701fce0a1e220262d9912911e87c9e00}




Definition at line 104 of file spi.h.

Referenced by spi\_\-get\_\-data\_\-order().

\subsection{Enumeration Type Documentation}
\index{spi.h@{spi.h}!spi\_\-clk\_\-rate\_\-t@{spi\_\-clk\_\-rate\_\-t}}
\index{spi\_\-clk\_\-rate\_\-t@{spi\_\-clk\_\-rate\_\-t}!spi.h@{spi.h}}
\subsubsection[spi\_\-clk\_\-rate\_\-t]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf spi\_\-clk\_\-rate\_\-t}}\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafab}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{SPI\_\-CLK\_\-RATE\_\-2@{SPI\_\-CLK\_\-RATE\_\-2}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-2@{SPI\_\-CLK\_\-RATE\_\-2}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-2\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafabcee5dc22fb42dcf8fe57708e7f59da16}
}]\index{SPI\_\-CLK\_\-RATE\_\-4@{SPI\_\-CLK\_\-RATE\_\-4}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-4@{SPI\_\-CLK\_\-RATE\_\-4}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-4\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafab1846203e87a67d724a7f8e198420ebef}
}]\index{SPI\_\-CLK\_\-RATE\_\-8@{SPI\_\-CLK\_\-RATE\_\-8}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-8@{SPI\_\-CLK\_\-RATE\_\-8}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-8\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafab44714f3dbef70ae0682e8e19db949774}
}]\index{SPI\_\-CLK\_\-RATE\_\-16@{SPI\_\-CLK\_\-RATE\_\-16}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-16@{SPI\_\-CLK\_\-RATE\_\-16}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-16\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafabcb3adccd4bd80db8c7fc8bd7b565be2a}
}]\index{SPI\_\-CLK\_\-RATE\_\-32@{SPI\_\-CLK\_\-RATE\_\-32}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-32@{SPI\_\-CLK\_\-RATE\_\-32}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-32\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafabf65686bdbfc6446439fcba3fb6d17599}
}]\index{SPI\_\-CLK\_\-RATE\_\-64@{SPI\_\-CLK\_\-RATE\_\-64}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-64@{SPI\_\-CLK\_\-RATE\_\-64}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-64\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafab03c49c44a8382dfac52b6a9fd2b2a2ba}
}]\index{SPI\_\-CLK\_\-RATE\_\-128@{SPI\_\-CLK\_\-RATE\_\-128}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-CLK\_\-RATE\_\-128@{SPI\_\-CLK\_\-RATE\_\-128}}\item[{\em 
SPI\_\-CLK\_\-RATE\_\-128\label{spi_8h_8d6b0bcbdebc08266d4e37a546caafabc32c58f203182afad90965bc6be5a965}
}]\end{description}
\end{Desc}



Definition at line 88 of file spi.h.\index{spi.h@{spi.h}!spi\_\-format\_\-t@{spi\_\-format\_\-t}}
\index{spi\_\-format\_\-t@{spi\_\-format\_\-t}!spi.h@{spi.h}}
\subsubsection[spi\_\-format\_\-t]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf spi\_\-format\_\-t}}\label{spi_8h_0046e17ce8785fad37ba932c767f680e}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{SPI\_\-FORMAT\_\-0@{SPI\_\-FORMAT\_\-0}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-FORMAT\_\-0@{SPI\_\-FORMAT\_\-0}}\item[{\em 
SPI\_\-FORMAT\_\-0\label{spi_8h_0046e17ce8785fad37ba932c767f680eb3a6bc098f3f0b11e3384cd56163352a}
}]\index{SPI\_\-FORMAT\_\-1@{SPI\_\-FORMAT\_\-1}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-FORMAT\_\-1@{SPI\_\-FORMAT\_\-1}}\item[{\em 
SPI\_\-FORMAT\_\-1\label{spi_8h_0046e17ce8785fad37ba932c767f680eff8ac20f51be11c61060d755d2f385d6}
}]\index{SPI\_\-FORMAT\_\-2@{SPI\_\-FORMAT\_\-2}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-FORMAT\_\-2@{SPI\_\-FORMAT\_\-2}}\item[{\em 
SPI\_\-FORMAT\_\-2\label{spi_8h_0046e17ce8785fad37ba932c767f680e1fc5e80750063c303d8ee4b35daf0c93}
}]\index{SPI\_\-FORMAT\_\-3@{SPI\_\-FORMAT\_\-3}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-FORMAT\_\-3@{SPI\_\-FORMAT\_\-3}}\item[{\em 
SPI\_\-FORMAT\_\-3\label{spi_8h_0046e17ce8785fad37ba932c767f680eeefbf8a231895c94cf3ce548c55f2c9b}
}]\end{description}
\end{Desc}



Definition at line 76 of file spi.h.\index{spi.h@{spi.h}!spi\_\-mode\_\-t@{spi\_\-mode\_\-t}}
\index{spi\_\-mode\_\-t@{spi\_\-mode\_\-t}!spi.h@{spi.h}}
\subsubsection[spi\_\-mode\_\-t]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf spi\_\-mode\_\-t}}\label{spi_8h_c4b206a51636d91c5cffcbcee458c3cb}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{SPI\_\-MODE\_\-UNINIT@{SPI\_\-MODE\_\-UNINIT}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-MODE\_\-UNINIT@{SPI\_\-MODE\_\-UNINIT}}\item[{\em 
SPI\_\-MODE\_\-UNINIT\label{spi_8h_c4b206a51636d91c5cffcbcee458c3cb827882dd2e5d981976c61ffb92a4a496}
}]\index{SPI\_\-MODE\_\-MASTER@{SPI\_\-MODE\_\-MASTER}!spi.h@{spi.h}}\index{spi.h@{spi.h}!SPI\_\-MODE\_\-MASTER@{SPI\_\-MODE\_\-MASTER}}\item[{\em 
SPI\_\-MODE\_\-MASTER\label{spi_8h_c4b206a51636d91c5cffcbcee458c3cbe68a8adf6e5b67a7bdbe9526b15dae99}
}]\end{description}
\end{Desc}



Definition at line 62 of file spi.h.

\subsection{Function Documentation}
\index{spi.h@{spi.h}!spi\_\-display\_\-ss\_\-lines@{spi\_\-display\_\-ss\_\-lines}}
\index{spi\_\-display\_\-ss\_\-lines@{spi\_\-display\_\-ss\_\-lines}!spi.h@{spi.h}}
\subsubsection[spi\_\-display\_\-ss\_\-lines]{\setlength{\rightskip}{0pt plus 5cm}void spi\_\-display\_\-ss\_\-lines (void)}\label{spi_8h_73caf97443a632aea62e315cf812cbe5}




Definition at line 213 of file spi.c.

References DEBUG, E\_\-SPI, and i.

Referenced by main().\index{spi.h@{spi.h}!spi\_\-get\_\-mode@{spi\_\-get\_\-mode}}
\index{spi\_\-get\_\-mode@{spi\_\-get\_\-mode}!spi.h@{spi.h}}
\subsubsection[spi\_\-get\_\-mode]{\setlength{\rightskip}{0pt plus 5cm}{\bf spi\_\-mode\_\-t} spi\_\-get\_\-mode (void)\hspace{0.3cm}{\tt  [inline]}}\label{spi_8h_3a0f3ab141bdeba143a82de22fd6c6f2}




Definition at line 147 of file spi.c.

Referenced by cc2420\_\-init().\index{spi.h@{spi.h}!spi\_\-init@{spi\_\-init}}
\index{spi\_\-init@{spi\_\-init}!spi.h@{spi.h}}
\subsubsection[spi\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void spi\_\-init ({\bf spi\_\-mode\_\-t} {\em mode}, \/  {\bf spi\_\-format\_\-t} {\em format}, \/  {\bf spi\_\-clk\_\-rate\_\-t} {\em clk\_\-rate})}\label{spi_8h_bdd061fa2024789d89478a39a4858a52}




Definition at line 99 of file spi.c.

References DDR, E\_\-SPI, FALSE, MISO\_\-BIT, MISO\_\-PORT, MOSI\_\-BIT, MOSI\_\-PORT, NOTICE, SCK\_\-BIT, SCK\_\-PORT, SPI2X\_\-REG, SPI\_\-MODE\_\-MASTER, SPR0\_\-REG, and SPR1\_\-REG.

Referenced by cc2420\_\-init(), and encoders\_\-spi\_\-init().\index{spi.h@{spi.h}!spi\_\-receive\_\-byte@{spi\_\-receive\_\-byte}}
\index{spi\_\-receive\_\-byte@{spi\_\-receive\_\-byte}!spi.h@{spi.h}}
\subsubsection[spi\_\-receive\_\-byte]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t spi\_\-receive\_\-byte (void)}\label{spi_8h_a17ae9268ad3cbc7d1cd243c1655380a}




Definition at line 181 of file spi.c.

References spi\_\-send\_\-and\_\-receive\_\-byte().

Referenced by cc2420\_\-read\_\-ram(), cc2420\_\-read\_\-register(), cc2420\_\-read\_\-rxfifo(), and encoders\_\-spi\_\-manage().\index{spi.h@{spi.h}!spi\_\-register\_\-ss\_\-line@{spi\_\-register\_\-ss\_\-line}}
\index{spi\_\-register\_\-ss\_\-line@{spi\_\-register\_\-ss\_\-line}!spi.h@{spi.h}}
\subsubsection[spi\_\-register\_\-ss\_\-line]{\setlength{\rightskip}{0pt plus 5cm}int8\_\-t spi\_\-register\_\-ss\_\-line (volatile uint8\_\-t $\ast$ {\em port}, \/  uint8\_\-t {\em bitnum})}\label{spi_8h_5e1519a4adf14f11293e0c7e2208480f}




Definition at line 55 of file spi.c.

References DEBUG, E\_\-SPI, and NOTICE.

Referenced by cc2420\_\-init(), and encoders\_\-spi\_\-init().\index{spi.h@{spi.h}!spi\_\-send\_\-and\_\-receive\_\-byte@{spi\_\-send\_\-and\_\-receive\_\-byte}}
\index{spi\_\-send\_\-and\_\-receive\_\-byte@{spi\_\-send\_\-and\_\-receive\_\-byte}!spi.h@{spi.h}}
\subsubsection[spi\_\-send\_\-and\_\-receive\_\-byte]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t spi\_\-send\_\-and\_\-receive\_\-byte (uint8\_\-t {\em byte})}\label{spi_8h_c1ec11a9dfdfd1567cf3f57e87cfeb1e}




Definition at line 156 of file spi.c.

Referenced by cc2420\_\-get\_\-status(), cc2420\_\-strobe\_\-register(), cc2420\_\-write\_\-rxfifo(), cc2420\_\-write\_\-txfifo(), spi\_\-receive\_\-byte(), and spi\_\-send\_\-byte().\index{spi.h@{spi.h}!spi\_\-send\_\-byte@{spi\_\-send\_\-byte}}
\index{spi\_\-send\_\-byte@{spi\_\-send\_\-byte}!spi.h@{spi.h}}
\subsubsection[spi\_\-send\_\-byte]{\setlength{\rightskip}{0pt plus 5cm}void spi\_\-send\_\-byte (uint8\_\-t {\em byte})\hspace{0.3cm}{\tt  [inline]}}\label{spi_8h_19fa0dda561fdb432494fbe12917f05f}




Definition at line 173 of file spi.c.

References spi\_\-send\_\-and\_\-receive\_\-byte().

Referenced by cc2420\_\-init(), cc2420\_\-read\_\-ram(), cc2420\_\-read\_\-register(), cc2420\_\-read\_\-rxfifo(), cc2420\_\-write\_\-ram(), cc2420\_\-write\_\-register(), cc2420\_\-write\_\-rxfifo(), and cc2420\_\-write\_\-txfifo().\index{spi.h@{spi.h}!spi\_\-set\_\-data\_\-order@{spi\_\-set\_\-data\_\-order}}
\index{spi\_\-set\_\-data\_\-order@{spi\_\-set\_\-data\_\-order}!spi.h@{spi.h}}
\subsubsection[spi\_\-set\_\-data\_\-order]{\setlength{\rightskip}{0pt plus 5cm}void spi\_\-set\_\-data\_\-order (uint8\_\-t {\em order})\hspace{0.3cm}{\tt  [inline]}}\label{spi_8h_f07d8dee9f403be2a32d674f2e9b3c9d}




Definition at line 77 of file spi.c.

References SPI\_\-LSB\_\-FIRST.

Referenced by encoders\_\-spi\_\-init().\index{spi.h@{spi.h}!spi\_\-slave\_\-deselect@{spi\_\-slave\_\-deselect}}
\index{spi\_\-slave\_\-deselect@{spi\_\-slave\_\-deselect}!spi.h@{spi.h}}
\subsubsection[spi\_\-slave\_\-deselect]{\setlength{\rightskip}{0pt plus 5cm}void spi\_\-slave\_\-deselect (uint8\_\-t {\em slave})}\label{spi_8h_b4724ed091315803d0e894f95960a423}




Definition at line 204 of file spi.c.

References FALSE.

Referenced by encoders\_\-spi\_\-manage().\index{spi.h@{spi.h}!spi\_\-slave\_\-select@{spi\_\-slave\_\-select}}
\index{spi\_\-slave\_\-select@{spi\_\-slave\_\-select}!spi.h@{spi.h}}
\subsubsection[spi\_\-slave\_\-select]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t spi\_\-slave\_\-select (uint8\_\-t {\em slave})}\label{spi_8h_171e51c040e2197f5eb069f402e849e4}




Definition at line 189 of file spi.c.

References E\_\-SPI, EBUSY, ERROR, ESUCCESS, and TRUE.

Referenced by encoders\_\-spi\_\-manage().