\hypertarget{lcd_8c}{
\section{lcd.c File Reference}
\label{lcd_8c}\index{lcd.c@{lcd.c}}
}


Dotmatrix LCD Library.  


{\ttfamily \#include $<$avr/io.h$>$}\par
{\ttfamily \#include $<$stdlib.h$>$}\par
{\ttfamily \#include $<$stdio.h$>$}\par
{\ttfamily \#include $<$string.h$>$}\par
{\ttfamily \#include $<$util/delay.h$>$}\par
{\ttfamily \#include \char`\"{}lcd.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}buzzer.h\char`\"{}}\par
Include dependency graph for lcd.c:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{lcd_8c__incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{lcd_8c_a2eba65976bbf9985f6151b55415c1f2f}{
\#define {\bfseries DISPLAY\_\-bp}~4}
\label{lcd_8c_a2eba65976bbf9985f6151b55415c1f2f}

\item 
\hypertarget{lcd_8c_aab7decf6dcc29ef065a209ddac080980}{
\#define {\bfseries BACKLIGHT\_\-bp}~5}
\label{lcd_8c_aab7decf6dcc29ef065a209ddac080980}

\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{lcd_8c_aabcb027659950ed9d437cf50670fac8e}{print\_\-buffer} (void)
\begin{DoxyCompactList}\small\item\em send the buffer contents to the display \item\end{DoxyCompactList}\item 
void \hyperlink{lcd_8c_aa858077ddf4743f9c52a21036fc088a1}{lcd\_\-scroll} (void)
\begin{DoxyCompactList}\small\item\em scroll individual lines \item\end{DoxyCompactList}\item 
void \hyperlink{lcd_8c_a779c4f800aa6ae16d9f64e6782473192}{push\_\-char} (uint8\_\-t data)
\begin{DoxyCompactList}\small\item\em push a character into the buffer. \item\end{DoxyCompactList}\item 
int \hyperlink{lcd_8c_ac7f75750c13aebc84e021ab79786fa5a}{lcd\_\-putchar} (char data, FILE $\ast$stream)
\begin{DoxyCompactList}\small\item\em Write one Character on the Display. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{lcd_8c_af67807ddb4ac695b2779b5a5cfbf3139}{
char \hyperlink{lcd_8c_af67807ddb4ac695b2779b5a5cfbf3139}{display\_\-buffer} \mbox{[}LCD\_\-ROWS\mbox{]}\mbox{[}LCD\_\-COLS+1\mbox{]}}
\label{lcd_8c_af67807ddb4ac695b2779b5a5cfbf3139}

\begin{DoxyCompactList}\small\item\em buffer used when scrolling is enabled \item\end{DoxyCompactList}\item 
char \hyperlink{lcd_8c_ad0003beffde0bcf0198066f67da9cf22}{input\_\-buffer} \mbox{[}LCD\_\-ROWS\mbox{]}\mbox{[}INPUT\_\-BUFFER\_\-SIZE+1\mbox{]}
\begin{DoxyCompactList}\small\item\em buffer used to store the received characters and rotate the lines \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_a2359bfa4a10109d5dcc2e002cb8ece47}{
uint8\_\-t \hyperlink{lcd_8c_a2359bfa4a10109d5dcc2e002cb8ece47}{buffer\_\-index} = 0}
\label{lcd_8c_a2359bfa4a10109d5dcc2e002cb8ece47}

\begin{DoxyCompactList}\small\item\em always pints to the first line \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_aacaa9b5ac9a5660ea4274bfd30ab4b3d}{
uint8\_\-t \hyperlink{lcd_8c_aacaa9b5ac9a5660ea4274bfd30ab4b3d}{char\_\-index} = 0}
\label{lcd_8c_aacaa9b5ac9a5660ea4274bfd30ab4b3d}

\begin{DoxyCompactList}\small\item\em points to the next char to write \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_ab0495a0c730fefbf4e2f2f1d227de0d3}{
uint8\_\-t \hyperlink{lcd_8c_ab0495a0c730fefbf4e2f2f1d227de0d3}{formfeed} = 0}
\label{lcd_8c_ab0495a0c730fefbf4e2f2f1d227de0d3}

\begin{DoxyCompactList}\small\item\em is set is an formfeed () is received to parse a sequence of special characters \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_ad8059bd4750b17d46a7c35757363c3c5}{
uint8\_\-t \hyperlink{lcd_8c_ad8059bd4750b17d46a7c35757363c3c5}{escape} = 0}
\label{lcd_8c_ad8059bd4750b17d46a7c35757363c3c5}

\begin{DoxyCompactList}\small\item\em is set if an escape is received, to parse control secquences \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_abd8a2a427d7b39d1456a249c500b1ffc}{
uint8\_\-t \hyperlink{lcd_8c_abd8a2a427d7b39d1456a249c500b1ffc}{bell} = 0}
\label{lcd_8c_abd8a2a427d7b39d1456a249c500b1ffc}

\begin{DoxyCompactList}\small\item\em is set if an bell is received, to parse control secquences \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_a2c37df0a4a7156f43525b0c880ba6087}{
uint8\_\-t \hyperlink{lcd_8c_a2c37df0a4a7156f43525b0c880ba6087}{firstchar} = 0}
\label{lcd_8c_a2c37df0a4a7156f43525b0c880ba6087}

\begin{DoxyCompactList}\small\item\em contains the first char of a sequence of 2 chars that schould be parsed \item\end{DoxyCompactList}\item 
\hypertarget{lcd_8c_a7ee1e2f8634d89027273fbef88ef679c}{
uint8\_\-t \hyperlink{lcd_8c_a7ee1e2f8634d89027273fbef88ef679c}{scroll} = 0}
\label{lcd_8c_a7ee1e2f8634d89027273fbef88ef679c}

\begin{DoxyCompactList}\small\item\em scroll enable flag \item\end{DoxyCompactList}\item 
char \hyperlink{lcd_8c_a942e3aee8df60d40e069660e8c1bacb4}{remap} \mbox{[}256\mbox{]}
\begin{DoxyCompactList}\small\item\em lookup table to translate display charset to ASCII charset \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Dotmatrix LCD Library. \begin{DoxyAuthor}{Authors}
Dominic Rathje (\href{mailto:dominic.rathje@uni-ulm.de}{\tt dominic.rathje@uni-\/ulm.de})\par
 Christian Degenhart (\href{mailto:christian.degenhart@uni-ulm.de}{\tt christian.degenhart@uni-\/ulm.de}) 
\end{DoxyAuthor}
\begin{DoxyVersion}{Version}
1.1 
\end{DoxyVersion}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item Compiler : WinAVR 20100110
\item Supported devices : ATMega8 
\end{DoxyItemize}
\end{DoxyNote}


Definition in file \hyperlink{lcd_8c_source}{lcd.c}.



\subsection{Function Documentation}
\hypertarget{lcd_8c_ac7f75750c13aebc84e021ab79786fa5a}{
\index{lcd.c@{lcd.c}!lcd\_\-putchar@{lcd\_\-putchar}}
\index{lcd\_\-putchar@{lcd\_\-putchar}!lcd.c@{lcd.c}}
\subsubsection[{lcd\_\-putchar}]{\setlength{\rightskip}{0pt plus 5cm}int lcd\_\-putchar (
\begin{DoxyParamCaption}
\item[{char}]{ data, }
\item[{FILE $\ast$}]{ sream}
\end{DoxyParamCaption}
)}}
\label{lcd_8c_ac7f75750c13aebc84e021ab79786fa5a}


Write one Character on the Display. 

Characters received are transformer by a lookup-\/table because the charset of the Display is not equal to ASCII. As input to this function any ASCII character that can be typed ba a German or American Keyboard is valid and displayed correctly on the screen.

As the Display has some amazing special characters, like fancy arrows, there are some sequences that are parsed and replaced by the corresponding symbol. See \href{https://wiki.fs-et.de/student-lab/UartDisplay}{\tt https://wiki.fs-\/et.de/student-\/lab/UartDisplay} for details on the parser.


\begin{DoxyParams}{Parameters}
{\em data} & ASCII Character to print. \\
\hline
{\em stream} & (is necessary to be compatible with printf) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success. 
\end{DoxyReturn}


Definition at line 187 of file lcd.c.



Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=354pt]{lcd_8c_ac7f75750c13aebc84e021ab79786fa5a_cgraph}
\end{center}
\end{figure}


\hypertarget{lcd_8c_aa858077ddf4743f9c52a21036fc088a1}{
\index{lcd.c@{lcd.c}!lcd\_\-scroll@{lcd\_\-scroll}}
\index{lcd\_\-scroll@{lcd\_\-scroll}!lcd.c@{lcd.c}}
\subsubsection[{lcd\_\-scroll}]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-scroll (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{lcd_8c_aa858077ddf4743f9c52a21036fc088a1}


scroll individual lines 

This function should be called by the main loop regularly if scroll mode is activated. Each time this function is executed the content of a line longer than the physical display lentgh is rotated by one position. 

Definition at line 134 of file lcd.c.



Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=336pt]{lcd_8c_aa858077ddf4743f9c52a21036fc088a1_cgraph}
\end{center}
\end{figure}


\hypertarget{lcd_8c_aabcb027659950ed9d437cf50670fac8e}{
\index{lcd.c@{lcd.c}!print\_\-buffer@{print\_\-buffer}}
\index{print\_\-buffer@{print\_\-buffer}!lcd.c@{lcd.c}}
\subsubsection[{print\_\-buffer}]{\setlength{\rightskip}{0pt plus 5cm}void print\_\-buffer (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{lcd_8c_aabcb027659950ed9d437cf50670fac8e}


send the buffer contents to the display 

prints the contents of the buffer on the screen. This function is called automatically by lcd\_\-putchar when a  is received. 

Definition at line 78 of file lcd.c.



Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=242pt]{lcd_8c_aabcb027659950ed9d437cf50670fac8e_cgraph}
\end{center}
\end{figure}




Here is the caller graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=248pt]{lcd_8c_aabcb027659950ed9d437cf50670fac8e_icgraph}
\end{center}
\end{figure}


\hypertarget{lcd_8c_a779c4f800aa6ae16d9f64e6782473192}{
\index{lcd.c@{lcd.c}!push\_\-char@{push\_\-char}}
\index{push\_\-char@{push\_\-char}!lcd.c@{lcd.c}}
\subsubsection[{push\_\-char}]{\setlength{\rightskip}{0pt plus 5cm}void push\_\-char (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{ data}
\end{DoxyParamCaption}
)}}
\label{lcd_8c_a779c4f800aa6ae16d9f64e6782473192}


push a character into the buffer. 

This is a internal function, that should not be called from other files. To print the buffer to the display call \hyperlink{lcd_8c_aabcb027659950ed9d437cf50670fac8e}{print\_\-buffer()}


\begin{DoxyParams}{Parameters}
{\em data} & Character to print. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
void 
\end{DoxyReturn}


Definition at line 169 of file lcd.c.



Here is the caller graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=246pt]{lcd_8c_a779c4f800aa6ae16d9f64e6782473192_icgraph}
\end{center}
\end{figure}




\subsection{Variable Documentation}
\hypertarget{lcd_8c_ad0003beffde0bcf0198066f67da9cf22}{
\index{lcd.c@{lcd.c}!input\_\-buffer@{input\_\-buffer}}
\index{input\_\-buffer@{input\_\-buffer}!lcd.c@{lcd.c}}
\subsubsection[{input\_\-buffer}]{\setlength{\rightskip}{0pt plus 5cm}char {\bf input\_\-buffer}\mbox{[}LCD\_\-ROWS\mbox{]}\mbox{[}INPUT\_\-BUFFER\_\-SIZE+1\mbox{]}}}
\label{lcd_8c_ad0003beffde0bcf0198066f67da9cf22}
{\bfseries Initial value:}
\begin{DoxyCode}
 { 
        "********************\0",
        "**  UART-Display  **\0",
        "**by Ernst Abrazzo**\0",
        "********************\0"
        }
\end{DoxyCode}


buffer used to store the received characters and rotate the lines 



Definition at line 30 of file lcd.c.

\hypertarget{lcd_8c_a942e3aee8df60d40e069660e8c1bacb4}{
\index{lcd.c@{lcd.c}!remap@{remap}}
\index{remap@{remap}!lcd.c@{lcd.c}}
\subsubsection[{remap}]{\setlength{\rightskip}{0pt plus 5cm}char {\bf remap}\mbox{[}256\mbox{]}}}
\label{lcd_8c_a942e3aee8df60d40e069660e8c1bacb4}
{\bfseries Initial value:}
\begin{DoxyCode}
 {
          0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14
      ,  15,
         16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30
      ,  31,
         32,  33,  34,  35, 162,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46
      ,  47,
         48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62
      ,  63,
        160,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78
      ,  79,
         80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90, 250, 251, 252,  29
      , 196,
         96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110
      , 111,
        112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 253, 254, 255, 206
      , 127,
        128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142
      , 143,
        144, 145, 146, 147, 148, 149,  45,  45, 152, 153, 154, 155, 156, 157, 158
      , 159,
        160,  40, 162,  64, 164, 163, 254,  95, 168, 169, 170, 171, 172, 173, 174
      , 175,
        128, 140, 130, 131, 180, 143, 182, 183, 184, 185, 186, 187, 139, 138, 190
      ,  96,
        192, 193, 194, 195,  91, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206
      , 207,
        208, 209, 210, 211, 212, 213,  92, 215, 216, 217, 218, 219,  94, 221, 222
      , 190,
        127, 225, 226, 227, 123, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238
      , 239,
        240, 125, 242, 243, 244, 245, 124, 247, 248, 249, 250, 251, 126, 253, 254
      , 255
}
\end{DoxyCode}


lookup table to translate display charset to ASCII charset 



Definition at line 59 of file lcd.c.

