\hypertarget{utilities_8c}{\section{src/utilities.c File Reference}
\label{utilities_8c}\index{src/utilities.\-c@{src/utilities.\-c}}
}
{\ttfamily \#include \char`\"{}xparameters.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}stdio.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}utilities.\-h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}M\-A\-X\-R\-E\-F\-D\-E\-S14.\-h\char`\"{}}\\*
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{utilities_8c_a304768dcd826d7d65123ff4bafc11050}{U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R}~X\-P\-A\-R\-\_\-\-X\-U\-A\-R\-T\-P\-S\-\_\-0\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R
\item 
\#define \hyperlink{utilities_8c_a1d473cae987cadb3d4d39486a07bd64f}{O\-L\-E\-D\-\_\-\-V\-B\-A\-T}~0x20
\item 
\#define \hyperlink{utilities_8c_a81093bedbe16909282a8c90156ad357b}{O\-L\-E\-D\-\_\-\-V\-D\-D}~0x10;
\item 
\#define \hyperlink{utilities_8c_af7adc8691cba1b7d49406370c064fc5e}{O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B}~0x08
\item 
\#define \hyperlink{utilities_8c_aa7fd1f5201707e89d0ad2ee31c18efaf}{O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B}~0x04
\item 
\#define \hyperlink{utilities_8c_a46bc999d017ea97b3e0dbeaf894213d4}{O\-L\-E\-D\-\_\-\-S\-D\-I\-N}~0x02
\item 
\#define \hyperlink{utilities_8c_adc1ebf9c337104a27a26cd808318d53b}{O\-L\-E\-D\-\_\-\-S\-C\-L\-K}~0x01
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{utilities_8c_a577eeffeb82895bf8ee72a7995ae144f}{delay} (int n\-Stop\-Value)
\begin{DoxyCompactList}\small\item\em Loop for n\-Stop\-Value iterations to provide a delay. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a71b3584d12efc81b2806f9fd385e5068}{led\-\_\-knight\-\_\-rider} (X\-Gpio $\ast$p\-L\-E\-D\-\_\-\-G\-P\-I\-O, int n\-Number\-Of\-Times)
\begin{DoxyCompactList}\small\item\em Blink a row of L\-E\-Ds n\-Number\-Of\-Times times. \end{DoxyCompactList}\item 
int \hyperlink{utilities_8c_a9ec4604d2e5d321f202b28d8e454f48b}{number\-\_\-raised\-\_\-to\-\_\-power} (int n\-Base, int n\-Exponent)
\begin{DoxyCompactList}\small\item\em Raise n\-Base to the n\-Exponent power (operates with integers only). \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a3635c0eee0c1ea6ccbd6f882e6ed233e}{print\-\_\-asterisks} (int n\-Quantity)
\begin{DoxyCompactList}\small\item\em Print n\-Quantity of asterisks to the default Hyperterminal U\-A\-R\-T. \end{DoxyCompactList}\item 
u8 \hyperlink{utilities_8c_afeb63a121e157a02df31ddb150e11ea3}{get\-Uart\-Byte} (u32 n\-Uart\-Address)
\begin{DoxyCompactList}\small\item\em Get a byte from either the full U\-A\-R\-T in the Zynq P\-S, or a Xilinx Uart\-Lite. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a3c79fcaf646489919c582685f3209aa2}{such\-End\-Uart\-Byte} (u32 un\-Uart\-Address, u8 uch\-Byte)
\begin{DoxyCompactList}\small\item\em Such\-End a byte to the U\-A\-R\-T. Either directs to the full U\-A\-R\-T in the Zynq P\-S, or a Xilinx Uart\-Lite. \end{DoxyCompactList}\item 
u8 \hyperlink{utilities_8c_af10d1e7367772ac35cdd19391f7b2366}{check\-Uart\-Empty} (u32 un\-Uart\-Address)
\begin{DoxyCompactList}\small\item\em Check if either Uart is empty. Either directs to the full U\-A\-R\-T in the Zynq P\-S, or a Xilinx Uart\-Lite. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_acfc3d9976c5ab8f9e866f32228f17dae}{initialize\-O\-L\-E\-D} (u8 $\ast$p\-Font)
\begin{DoxyCompactList}\small\item\em Initializes the O\-L\-E\-D display. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_ab0cc4f96a17e298c8b0304678ca38b98}{such\-End\-O\-L\-E\-D\-S\-P\-I} (u8 uch\-Data\-To\-Write)
\begin{DoxyCompactList}\small\item\em Bit bang routine for Zedboard S\-P\-I O\-L\-E\-D interface. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a982c5321fed6a158f7e58de4a956b107}{clear\-O\-L\-E\-D\-Buffer} (u8 $\ast$pauch\-Buffer)
\begin{DoxyCompactList}\small\item\em Clears the O\-L\-E\-D display buffer. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a9328b27a4c117e69a553c25c21658a51}{display\-O\-L\-E\-D\-Buffer} (u8 $\ast$pauch\-Buffer)
\begin{DoxyCompactList}\small\item\em Copies the display buffer into the O\-L\-E\-D display. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_abdff74d9571603bb0669eae8b40a4770}{put\-Char\-O\-L\-E\-D} (int x, int y, char ch\-Character)
\begin{DoxyCompactList}\small\item\em Places a single A\-S\-C\-I\-I character into the O\-L\-E\-D display buffer. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a35a65e9c30d76fd1986f5ffbcbd69592}{printf\-To\-Buffer\-O\-L\-E\-D} (int x, int y, char $\ast$ch\-String)
\begin{DoxyCompactList}\small\item\em Printf-\/like function to copy an A\-S\-C\-I\-I string into the O\-L\-E\-D display buffer. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a321ec3c01b31a8e8a7d07295176485bc}{printf\-To\-O\-L\-E\-D} (int x, int y, char $\ast$ch\-String)
\begin{DoxyCompactList}\small\item\em Printf-\/like function to copy an A\-S\-C\-I\-I string into the O\-L\-E\-D display buffer. \end{DoxyCompactList}\item 
void \hyperlink{utilities_8c_a5a019b8437ba4f8d9261aacd24fe59b9}{flip\-And\-Copy\-Display\-Buffer} (u8 $\ast$pauch\-Source\-Buffer, u8 $\ast$pauch\-Destination\-Buffer)
\begin{DoxyCompactList}\small\item\em Copies the pixels from the source display buffer, into the destination buffer, flipping their location 180 degrees. \end{DoxyCompactList}\item 
int \hyperlink{utilities_8c_a56e95cdac6ef7cc8e6c3c84d62b0c774}{htoi} (char $\ast$s\-Str)
\end{DoxyCompactItemize}


\subsection{Detailed Description}


 \begin{DoxyVerb}      Project: Maxim Plug-in Peripheral Modules
     Filename: utilities.c
  Description: This module contains a collection of general utility
               functions which are not specific to any particular
               module.
\end{DoxyVerb}


Revision History\-: \par
 4-\/13-\/12 Rev 1.\-0 Seth Messimer Initial Release \par
 7-\/20-\/12 Rev 1.\-4 Nathan Young Additional functions 



This code follows the following naming conventions.

char ch\-Pmod\-Value char (array) s\-Pmod\-String\mbox{[}16\mbox{]} float f\-Pmod\-Value int n\-Pmod\-Value int (array) an\-Pmod\-Value\mbox{[}16\mbox{]} u16 u\-Pmod\-Value u8 uch\-Pmod\-Value u8 (array) auch\-Pmod\-Buffer\mbox{[}16\mbox{]} unsigned int un\-Pmod\-Value int $\ast$ pun\-Pmod\-Value 



Definition in file \hyperlink{utilities_8c_source}{utilities.\-c}.



\subsection{Macro Definition Documentation}
\hypertarget{utilities_8c_aa7fd1f5201707e89d0ad2ee31c18efaf}{\index{utilities.\-c@{utilities.\-c}!O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B@{O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B}}
\index{O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B@{O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B}!utilities.c@{utilities.\-c}}
\subsubsection[{O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\-L\-E\-D\-\_\-\-D\-A\-T\-A\-\_\-\-C\-O\-M\-M\-A\-N\-D\-\_\-\-B~0x04}}\label{utilities_8c_aa7fd1f5201707e89d0ad2ee31c18efaf}


Definition at line 71 of file utilities.\-c.

\hypertarget{utilities_8c_af7adc8691cba1b7d49406370c064fc5e}{\index{utilities.\-c@{utilities.\-c}!O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B@{O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B}}
\index{O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B@{O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B}!utilities.c@{utilities.\-c}}
\subsubsection[{O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\-L\-E\-D\-\_\-\-R\-E\-S\-E\-T\-\_\-\-B~0x08}}\label{utilities_8c_af7adc8691cba1b7d49406370c064fc5e}


Definition at line 70 of file utilities.\-c.

\hypertarget{utilities_8c_adc1ebf9c337104a27a26cd808318d53b}{\index{utilities.\-c@{utilities.\-c}!O\-L\-E\-D\-\_\-\-S\-C\-L\-K@{O\-L\-E\-D\-\_\-\-S\-C\-L\-K}}
\index{O\-L\-E\-D\-\_\-\-S\-C\-L\-K@{O\-L\-E\-D\-\_\-\-S\-C\-L\-K}!utilities.c@{utilities.\-c}}
\subsubsection[{O\-L\-E\-D\-\_\-\-S\-C\-L\-K}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\-L\-E\-D\-\_\-\-S\-C\-L\-K~0x01}}\label{utilities_8c_adc1ebf9c337104a27a26cd808318d53b}


Definition at line 73 of file utilities.\-c.

\hypertarget{utilities_8c_a46bc999d017ea97b3e0dbeaf894213d4}{\index{utilities.\-c@{utilities.\-c}!O\-L\-E\-D\-\_\-\-S\-D\-I\-N@{O\-L\-E\-D\-\_\-\-S\-D\-I\-N}}
\index{O\-L\-E\-D\-\_\-\-S\-D\-I\-N@{O\-L\-E\-D\-\_\-\-S\-D\-I\-N}!utilities.c@{utilities.\-c}}
\subsubsection[{O\-L\-E\-D\-\_\-\-S\-D\-I\-N}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\-L\-E\-D\-\_\-\-S\-D\-I\-N~0x02}}\label{utilities_8c_a46bc999d017ea97b3e0dbeaf894213d4}


Definition at line 72 of file utilities.\-c.

\hypertarget{utilities_8c_a1d473cae987cadb3d4d39486a07bd64f}{\index{utilities.\-c@{utilities.\-c}!O\-L\-E\-D\-\_\-\-V\-B\-A\-T@{O\-L\-E\-D\-\_\-\-V\-B\-A\-T}}
\index{O\-L\-E\-D\-\_\-\-V\-B\-A\-T@{O\-L\-E\-D\-\_\-\-V\-B\-A\-T}!utilities.c@{utilities.\-c}}
\subsubsection[{O\-L\-E\-D\-\_\-\-V\-B\-A\-T}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\-L\-E\-D\-\_\-\-V\-B\-A\-T~0x20}}\label{utilities_8c_a1d473cae987cadb3d4d39486a07bd64f}


Definition at line 68 of file utilities.\-c.

\hypertarget{utilities_8c_a81093bedbe16909282a8c90156ad357b}{\index{utilities.\-c@{utilities.\-c}!O\-L\-E\-D\-\_\-\-V\-D\-D@{O\-L\-E\-D\-\_\-\-V\-D\-D}}
\index{O\-L\-E\-D\-\_\-\-V\-D\-D@{O\-L\-E\-D\-\_\-\-V\-D\-D}!utilities.c@{utilities.\-c}}
\subsubsection[{O\-L\-E\-D\-\_\-\-V\-D\-D}]{\setlength{\rightskip}{0pt plus 5cm}\#define O\-L\-E\-D\-\_\-\-V\-D\-D~0x10;}}\label{utilities_8c_a81093bedbe16909282a8c90156ad357b}


Definition at line 69 of file utilities.\-c.

\hypertarget{utilities_8c_a304768dcd826d7d65123ff4bafc11050}{\index{utilities.\-c@{utilities.\-c}!U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R@{U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R}}
\index{U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R@{U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R}!utilities.c@{utilities.\-c}}
\subsubsection[{U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R}]{\setlength{\rightskip}{0pt plus 5cm}\#define U\-A\-R\-T\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R~X\-P\-A\-R\-\_\-\-X\-U\-A\-R\-T\-P\-S\-\_\-0\-\_\-\-B\-A\-S\-E\-A\-D\-D\-R}}\label{utilities_8c_a304768dcd826d7d65123ff4bafc11050}


Definition at line 66 of file utilities.\-c.



\subsection{Function Documentation}
\hypertarget{utilities_8c_af10d1e7367772ac35cdd19391f7b2366}{\index{utilities.\-c@{utilities.\-c}!check\-Uart\-Empty@{check\-Uart\-Empty}}
\index{check\-Uart\-Empty@{check\-Uart\-Empty}!utilities.c@{utilities.\-c}}
\subsubsection[{check\-Uart\-Empty}]{\setlength{\rightskip}{0pt plus 5cm}u8 check\-Uart\-Empty (
\begin{DoxyParamCaption}
\item[{u32}]{un\-Uart\-Address}
\end{DoxyParamCaption}
)}}\label{utilities_8c_af10d1e7367772ac35cdd19391f7b2366}


Check if either Uart is empty. Either directs to the full U\-A\-R\-T in the Zynq P\-S, or a Xilinx Uart\-Lite. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em un\-Uart\-Address.} & 32 bit U\-A\-R\-T address\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em True} & if empty (false if not) \\
\hline
\end{DoxyRetVals}


Definition at line 215 of file utilities.\-c.

\hypertarget{utilities_8c_a982c5321fed6a158f7e58de4a956b107}{\index{utilities.\-c@{utilities.\-c}!clear\-O\-L\-E\-D\-Buffer@{clear\-O\-L\-E\-D\-Buffer}}
\index{clear\-O\-L\-E\-D\-Buffer@{clear\-O\-L\-E\-D\-Buffer}!utilities.c@{utilities.\-c}}
\subsubsection[{clear\-O\-L\-E\-D\-Buffer}]{\setlength{\rightskip}{0pt plus 5cm}void clear\-O\-L\-E\-D\-Buffer (
\begin{DoxyParamCaption}
\item[{u8 $\ast$}]{pauch\-Buffer}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a982c5321fed6a158f7e58de4a956b107}


Clears the O\-L\-E\-D display buffer. 

\begin{DoxyParagraph}{Details}
This function clears the display buffer by setting all pixels to zero.
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$pauch\-Buffer} & -\/ pointer to an u8 array used for the O\-L\-E\-D pixel buffer \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 415 of file utilities.\-c.

\hypertarget{utilities_8c_a577eeffeb82895bf8ee72a7995ae144f}{\index{utilities.\-c@{utilities.\-c}!delay@{delay}}
\index{delay@{delay}!utilities.c@{utilities.\-c}}
\subsubsection[{delay}]{\setlength{\rightskip}{0pt plus 5cm}void delay (
\begin{DoxyParamCaption}
\item[{int}]{n\-Stop\-Value}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a577eeffeb82895bf8ee72a7995ae144f}


Loop for n\-Stop\-Value iterations to provide a delay. 

\begin{DoxyParagraph}{Details}
It is commonly used with the constant 'A\-B\-O\-U\-T\-\_\-\-O\-N\-E\-\_\-\-S\-E\-C\-O\-N\-D' defined in maxim\-P\-M\-O\-D.\-h for setting approximate delays
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n\-Stop\-Value} & -\/ number of iterations to loop\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 75 of file utilities.\-c.

\hypertarget{utilities_8c_a9328b27a4c117e69a553c25c21658a51}{\index{utilities.\-c@{utilities.\-c}!display\-O\-L\-E\-D\-Buffer@{display\-O\-L\-E\-D\-Buffer}}
\index{display\-O\-L\-E\-D\-Buffer@{display\-O\-L\-E\-D\-Buffer}!utilities.c@{utilities.\-c}}
\subsubsection[{display\-O\-L\-E\-D\-Buffer}]{\setlength{\rightskip}{0pt plus 5cm}void display\-O\-L\-E\-D\-Buffer (
\begin{DoxyParamCaption}
\item[{u8 $\ast$}]{pauch\-Buffer}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a9328b27a4c117e69a553c25c21658a51}


Copies the display buffer into the O\-L\-E\-D display. 

\begin{DoxyParagraph}{Details}
This function writes the the display buffer into the O\-L\-E\-D display using the page mode setting. \par
 Note\-: The Zedboard O\-L\-E\-D display contains a Solomon S\-S\-D1306 display controller.
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$pauch\-Buffer} & -\/ pointer to an u8 array used for the O\-L\-E\-D pixel buffer \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 432 of file utilities.\-c.

\hypertarget{utilities_8c_a5a019b8437ba4f8d9261aacd24fe59b9}{\index{utilities.\-c@{utilities.\-c}!flip\-And\-Copy\-Display\-Buffer@{flip\-And\-Copy\-Display\-Buffer}}
\index{flip\-And\-Copy\-Display\-Buffer@{flip\-And\-Copy\-Display\-Buffer}!utilities.c@{utilities.\-c}}
\subsubsection[{flip\-And\-Copy\-Display\-Buffer}]{\setlength{\rightskip}{0pt plus 5cm}void flip\-And\-Copy\-Display\-Buffer (
\begin{DoxyParamCaption}
\item[{u8 $\ast$}]{pauch\-Source\-Buffer, }
\item[{u8 $\ast$}]{pauch\-Destination\-Buffer}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a5a019b8437ba4f8d9261aacd24fe59b9}


Copies the pixels from the source display buffer, into the destination buffer, flipping their location 180 degrees. 

\begin{DoxyParagraph}{Details}
The (0,0) pixel location on the O\-L\-E\-D display is in the bottom right corner. This function flips the display so that the (0,0) is in the top left corner and (131,31) is in the bottom right.
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$pauch\-Source\-Buffer} & -\/ pointer to an u8 buffer used as the source display buffer \\
\hline
\mbox{\tt in}  & {\em $\ast$pauch\-Destination\-Buffer} & -\/ pointer to an u8 buffer used as the destination display buffer \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 586 of file utilities.\-c.

\hypertarget{utilities_8c_afeb63a121e157a02df31ddb150e11ea3}{\index{utilities.\-c@{utilities.\-c}!get\-Uart\-Byte@{get\-Uart\-Byte}}
\index{get\-Uart\-Byte@{get\-Uart\-Byte}!utilities.c@{utilities.\-c}}
\subsubsection[{get\-Uart\-Byte}]{\setlength{\rightskip}{0pt plus 5cm}u8 get\-Uart\-Byte (
\begin{DoxyParamCaption}
\item[{u32}]{n\-Uart\-Address}
\end{DoxyParamCaption}
)}}\label{utilities_8c_afeb63a121e157a02df31ddb150e11ea3}


Get a byte from either the full U\-A\-R\-T in the Zynq P\-S, or a Xilinx Uart\-Lite. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em un\-Uart\-Address.} & 32 bit U\-A\-R\-T address\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Returns} & the next byte from the Uart Rx F\-I\-F\-O \\
\hline
\end{DoxyRetVals}


Definition at line 174 of file utilities.\-c.

\hypertarget{utilities_8c_a56e95cdac6ef7cc8e6c3c84d62b0c774}{\index{utilities.\-c@{utilities.\-c}!htoi@{htoi}}
\index{htoi@{htoi}!utilities.c@{utilities.\-c}}
\subsubsection[{htoi}]{\setlength{\rightskip}{0pt plus 5cm}int htoi (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{s\-Str}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a56e95cdac6ef7cc8e6c3c84d62b0c774}


Definition at line 620 of file utilities.\-c.

\hypertarget{utilities_8c_acfc3d9976c5ab8f9e866f32228f17dae}{\index{utilities.\-c@{utilities.\-c}!initialize\-O\-L\-E\-D@{initialize\-O\-L\-E\-D}}
\index{initialize\-O\-L\-E\-D@{initialize\-O\-L\-E\-D}!utilities.c@{utilities.\-c}}
\subsubsection[{initialize\-O\-L\-E\-D}]{\setlength{\rightskip}{0pt plus 5cm}void initialize\-O\-L\-E\-D (
\begin{DoxyParamCaption}
\item[{u8 $\ast$}]{p\-Font}
\end{DoxyParamCaption}
)}}\label{utilities_8c_acfc3d9976c5ab8f9e866f32228f17dae}


Initializes the O\-L\-E\-D display. 

\begin{DoxyParagraph}{Details}
This function initializes the O\-L\-E\-D display and the global data structure that holds the O\-L\-E\-D display buffer and font.
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$p\-Font} & -\/ pointer to an u8 array containing the A\-S\-C\-I\-I display font \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 252 of file utilities.\-c.

\hypertarget{utilities_8c_a71b3584d12efc81b2806f9fd385e5068}{\index{utilities.\-c@{utilities.\-c}!led\-\_\-knight\-\_\-rider@{led\-\_\-knight\-\_\-rider}}
\index{led\-\_\-knight\-\_\-rider@{led\-\_\-knight\-\_\-rider}!utilities.c@{utilities.\-c}}
\subsubsection[{led\-\_\-knight\-\_\-rider}]{\setlength{\rightskip}{0pt plus 5cm}void led\-\_\-knight\-\_\-rider (
\begin{DoxyParamCaption}
\item[{X\-Gpio $\ast$}]{p\-L\-E\-D\-\_\-\-G\-P\-I\-O, }
\item[{int}]{n\-Number\-Of\-Times}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a71b3584d12efc81b2806f9fd385e5068}


Blink a row of L\-E\-Ds n\-Number\-Of\-Times times. 

\begin{DoxyParagraph}{Details}
The Digilent N\-E\-X\-Y\-S-\/3 and Zedboard have 8 green L\-E\-Ds located above the toggle switches. This function blinks them back/forth (a bit like the K\-I\-T\-T car from Knight Rider)
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$p\-L\-E\-D\-\_\-\-G\-P\-I\-O} & -\/ address of the G\-P\-I\-O peripheral driving the L\-E\-Ds in Micro\-Blaze memory map\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 96 of file utilities.\-c.

\hypertarget{utilities_8c_a9ec4604d2e5d321f202b28d8e454f48b}{\index{utilities.\-c@{utilities.\-c}!number\-\_\-raised\-\_\-to\-\_\-power@{number\-\_\-raised\-\_\-to\-\_\-power}}
\index{number\-\_\-raised\-\_\-to\-\_\-power@{number\-\_\-raised\-\_\-to\-\_\-power}!utilities.c@{utilities.\-c}}
\subsubsection[{number\-\_\-raised\-\_\-to\-\_\-power}]{\setlength{\rightskip}{0pt plus 5cm}int number\-\_\-raised\-\_\-to\-\_\-power (
\begin{DoxyParamCaption}
\item[{int}]{n\-Base, }
\item[{int}]{n\-Exponent}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a9ec4604d2e5d321f202b28d8e454f48b}


Raise n\-Base to the n\-Exponent power (operates with integers only). 

\begin{DoxyParagraph}{Details}
Many Microblaze applications will not have math.\-h included due to limited memory space. This is a simple functions to implement (n\-Base $^\wedge$ n\-Exponent) Some Maxim devices (such as M\-A\-X44009) return values in mantissa + (power of 2) exponent format.
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n\-Base} & -\/ base \\
\hline
\mbox{\tt in}  & {\em n\-Exponent} & -\/ exponent\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em Base$^\wedge$\-Exponent} & \\
\hline
\end{DoxyRetVals}


Definition at line 131 of file utilities.\-c.

\hypertarget{utilities_8c_a3635c0eee0c1ea6ccbd6f882e6ed233e}{\index{utilities.\-c@{utilities.\-c}!print\-\_\-asterisks@{print\-\_\-asterisks}}
\index{print\-\_\-asterisks@{print\-\_\-asterisks}!utilities.c@{utilities.\-c}}
\subsubsection[{print\-\_\-asterisks}]{\setlength{\rightskip}{0pt plus 5cm}void print\-\_\-asterisks (
\begin{DoxyParamCaption}
\item[{int}]{n\-Quantity}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a3635c0eee0c1ea6ccbd6f882e6ed233e}


Print n\-Quantity of asterisks to the default Hyperterminal U\-A\-R\-T. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em n\-Quantity} & -\/ number of asterisks to print\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 160 of file utilities.\-c.

\hypertarget{utilities_8c_a35a65e9c30d76fd1986f5ffbcbd69592}{\index{utilities.\-c@{utilities.\-c}!printf\-To\-Buffer\-O\-L\-E\-D@{printf\-To\-Buffer\-O\-L\-E\-D}}
\index{printf\-To\-Buffer\-O\-L\-E\-D@{printf\-To\-Buffer\-O\-L\-E\-D}!utilities.c@{utilities.\-c}}
\subsubsection[{printf\-To\-Buffer\-O\-L\-E\-D}]{\setlength{\rightskip}{0pt plus 5cm}void printf\-To\-Buffer\-O\-L\-E\-D (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y, }
\item[{char $\ast$}]{ch\-String}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a35a65e9c30d76fd1986f5ffbcbd69592}


Printf-\/like function to copy an A\-S\-C\-I\-I string into the O\-L\-E\-D display buffer. 

\begin{DoxyParagraph}{Details}
This function copies a pre-\/formatted A\-S\-C\-I\-I string into the O\-L\-E\-D display buffer, but does not take any action to display the buffer
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em x} & -\/ The starting position of string within the 16x4 character display \\
\hline
\mbox{\tt in}  & {\em y} & -\/ The starting position of string within the 16x4 character display \\
\hline
\mbox{\tt in}  & {\em $\ast$ch\-String} & -\/ pointer to an null terminated character string. Should be generated with sprintf (or similar). \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 527 of file utilities.\-c.

\hypertarget{utilities_8c_a321ec3c01b31a8e8a7d07295176485bc}{\index{utilities.\-c@{utilities.\-c}!printf\-To\-O\-L\-E\-D@{printf\-To\-O\-L\-E\-D}}
\index{printf\-To\-O\-L\-E\-D@{printf\-To\-O\-L\-E\-D}!utilities.c@{utilities.\-c}}
\subsubsection[{printf\-To\-O\-L\-E\-D}]{\setlength{\rightskip}{0pt plus 5cm}void printf\-To\-O\-L\-E\-D (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y, }
\item[{char $\ast$}]{ch\-String}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a321ec3c01b31a8e8a7d07295176485bc}


Printf-\/like function to copy an A\-S\-C\-I\-I string into the O\-L\-E\-D display buffer. 

\begin{DoxyParagraph}{Details}
This function copies a pre-\/formatted A\-S\-C\-I\-I string into the O\-L\-E\-D display buffer, flips/rotates the display pixels, and then such\-Ends the buffer to the O\-L\-E\-D display
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em x} & -\/ The starting position of string within the 16x4 character display \\
\hline
\mbox{\tt in}  & {\em y} & -\/ The starting position of string within the 16x4 character display \\
\hline
\mbox{\tt in}  & {\em $\ast$ch\-String} & -\/ pointer to an null terminated character string. Should be generated with sprintf (or similar). \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 567 of file utilities.\-c.

\hypertarget{utilities_8c_abdff74d9571603bb0669eae8b40a4770}{\index{utilities.\-c@{utilities.\-c}!put\-Char\-O\-L\-E\-D@{put\-Char\-O\-L\-E\-D}}
\index{put\-Char\-O\-L\-E\-D@{put\-Char\-O\-L\-E\-D}!utilities.c@{utilities.\-c}}
\subsubsection[{put\-Char\-O\-L\-E\-D}]{\setlength{\rightskip}{0pt plus 5cm}void put\-Char\-O\-L\-E\-D (
\begin{DoxyParamCaption}
\item[{int}]{x, }
\item[{int}]{y, }
\item[{char}]{ch\-Character}
\end{DoxyParamCaption}
)}}\label{utilities_8c_abdff74d9571603bb0669eae8b40a4770}


Places a single A\-S\-C\-I\-I character into the O\-L\-E\-D display buffer. 

\begin{DoxyParagraph}{Details}
This function copies an A\-S\-C\-I\-I character from the font table into the O\-L\-E\-D display buffer (configured as a 16x4 character display).
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em x} & -\/ The x position of the character location \\
\hline
\mbox{\tt in}  & {\em y} & -\/ The y position of the character location \\
\hline
\mbox{\tt in}  & {\em ch\-Character} & -\/ A\-S\-C\-I\-I character to be printed (ex\-: 0x41 = 'A') \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 495 of file utilities.\-c.

\hypertarget{utilities_8c_ab0cc4f96a17e298c8b0304678ca38b98}{\index{utilities.\-c@{utilities.\-c}!such\-End\-O\-L\-E\-D\-S\-P\-I@{such\-End\-O\-L\-E\-D\-S\-P\-I}}
\index{such\-End\-O\-L\-E\-D\-S\-P\-I@{such\-End\-O\-L\-E\-D\-S\-P\-I}!utilities.c@{utilities.\-c}}
\subsubsection[{such\-End\-O\-L\-E\-D\-S\-P\-I}]{\setlength{\rightskip}{0pt plus 5cm}void such\-End\-O\-L\-E\-D\-S\-P\-I (
\begin{DoxyParamCaption}
\item[{u8}]{uch\-Data\-To\-Write}
\end{DoxyParamCaption}
)}}\label{utilities_8c_ab0cc4f96a17e298c8b0304678ca38b98}


Bit bang routine for Zedboard S\-P\-I O\-L\-E\-D interface. 

\begin{DoxyParagraph}{Details}
This function such\-Ends an (unsigned) byte (msb first) to the O\-L\-E\-D S\-P\-I port
\end{DoxyParagraph}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em uch\-Data\-To\-Write} & -\/ u8 value to be written to O\-L\-E\-D S\-P\-I \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 382 of file utilities.\-c.

\hypertarget{utilities_8c_a3c79fcaf646489919c582685f3209aa2}{\index{utilities.\-c@{utilities.\-c}!such\-End\-Uart\-Byte@{such\-End\-Uart\-Byte}}
\index{such\-End\-Uart\-Byte@{such\-End\-Uart\-Byte}!utilities.c@{utilities.\-c}}
\subsubsection[{such\-End\-Uart\-Byte}]{\setlength{\rightskip}{0pt plus 5cm}void such\-End\-Uart\-Byte (
\begin{DoxyParamCaption}
\item[{u32}]{un\-Uart\-Address, }
\item[{u8}]{uch\-Byte}
\end{DoxyParamCaption}
)}}\label{utilities_8c_a3c79fcaf646489919c582685f3209aa2}


Such\-End a byte to the U\-A\-R\-T. Either directs to the full U\-A\-R\-T in the Zynq P\-S, or a Xilinx Uart\-Lite. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em un\-Uart\-Address.} & 32 bit U\-A\-R\-T address \\
\hline
\mbox{\tt in}  & {\em uch\-Byte.} & The byte to be sent to the U\-A\-R\-T\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em None} & \\
\hline
\end{DoxyRetVals}


Definition at line 195 of file utilities.\-c.

