\section{aversive\_\-10-03-12/modules/devices/ihm/lcd/lcd.c File Reference}
\label{lcd_8c}\index{aversive\_\-10-03-12/modules/devices/ihm/lcd/lcd.c@{aversive\_\-10-03-12/modules/devices/ihm/lcd/lcd.c}}
Implementation for the LCD module. 

{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$aversive/pgmspace.h$>$}\par
{\tt \#include $<$aversive.h$>$}\par
{\tt \#include $<$aversive/wait.h$>$}\par
{\tt \#include $<$lcd.h$>$}\par
{\tt \#include $<$lcd\_\-protocol.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf e\_\-delay}()~\_\-delay\_\-loop\_\-1(1)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf initial\_\-8\_\-bit\_\-write} (uint8\_\-t value)
\item 
void {\bf lcd\_\-command} (uint8\_\-t cmd)
\item 
void {\bf lcd\_\-gotoxy} (uint8\_\-t x, uint8\_\-t y)
\item 
void {\bf lcd\_\-clrscr} (void)
\item 
void {\bf lcd\_\-home} (void)
\item 
void {\bf lcd\_\-putc} (char c)
\item 
int {\bf lcd\_\-dev\_\-putc} (char c, FILE $\ast$f)
\item 
void {\bf lcd\_\-init} (uint8\_\-t dispAttr)
\end{CompactItemize}


\subsection{Detailed Description}
Implementation for the LCD module. 

Interface for the LCD module.

\begin{Desc}
\item[{\bf Todo}]Test the module with other wirings, verify the delay macro, stqtic inlines for the public functions ??\end{Desc}
\begin{Desc}
\item[{\bf Test}]works on mega32 with all on the same port and old normal wiring, how about more speific connections ?\end{Desc}
This module provides functions for using a lcd device

\begin{Desc}
\item[{\bf Todo}]implement ANSI commands for cursor positionning ?\end{Desc}
\begin{Desc}
\item[{\bf Test}]works on mega32 with all on the same port and old normal wiring, how about more speific connections ?\end{Desc}
This module provides functions for using a standard lcd device the lcd s intended to be used in 4 bit mode, so don't wire the low nibble, only D4-D7 to 4 CONSECUTIVE port lines we need the RW, RS and E lines too. since the last version, you can scramble the wiring, except for D4-D7 who must remain consecutive (see lcd\_\-config.h)

in this new version you can use lcd\_\-putc(''); to clear the screen. This maintains an easy compatibility when you want to use an uart instad (form feed). 

Definition in file {\bf lcd.c}.

\subsection{Define Documentation}
\index{lcd.c@{lcd.c}!e\_\-delay@{e\_\-delay}}
\index{e\_\-delay@{e\_\-delay}!lcd.c@{lcd.c}}
\subsubsection[e\_\-delay]{\setlength{\rightskip}{0pt plus 5cm}\#define e\_\-delay()~\_\-delay\_\-loop\_\-1(1)}\label{lcd_8c_bed9e95818805c901cd8239fa4b5ca2f}




Definition at line 49 of file lcd.c.

\subsection{Function Documentation}
\index{lcd.c@{lcd.c}!initial\_\-8\_\-bit\_\-write@{initial\_\-8\_\-bit\_\-write}}
\index{initial\_\-8\_\-bit\_\-write@{initial\_\-8\_\-bit\_\-write}!lcd.c@{lcd.c}}
\subsubsection[initial\_\-8\_\-bit\_\-write]{\setlength{\rightskip}{0pt plus 5cm}void initial\_\-8\_\-bit\_\-write (uint8\_\-t {\em value})}\label{lcd_8c_e873e4f8f154bde8917133ae483ce60f}




Definition at line 164 of file lcd.c.

References cbi, IRQ\_\-LOCK, IRQ\_\-UNLOCK, and LCD\_\-DATA\_\-MASK.

Referenced by lcd\_\-init().\index{lcd.c@{lcd.c}!lcd\_\-clrscr@{lcd\_\-clrscr}}
\index{lcd\_\-clrscr@{lcd\_\-clrscr}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-clrscr]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-clrscr (void)}\label{lcd_8c_f8da853dba4b9d5f2aea4e294444e14d}


clear all the screen avoid using this function, escpecially if you use printf 

Definition at line 288 of file lcd.c.

References LCD\_\-CLR, and lcd\_\-command().

Referenced by lcd\_\-init(), and lcd\_\-putc().\index{lcd.c@{lcd.c}!lcd\_\-command@{lcd\_\-command}}
\index{lcd\_\-command@{lcd\_\-command}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-command]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-command (uint8\_\-t {\em cmd})}\label{lcd_8c_ea9d14f02df06f948cb5a56776980826}




Definition at line 207 of file lcd.c.

Referenced by lcd\_\-clrscr(), lcd\_\-gotoxy(), lcd\_\-home(), and lcd\_\-init().\index{lcd.c@{lcd.c}!lcd\_\-dev\_\-putc@{lcd\_\-dev\_\-putc}}
\index{lcd\_\-dev\_\-putc@{lcd\_\-dev\_\-putc}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-dev\_\-putc]{\setlength{\rightskip}{0pt plus 5cm}int lcd\_\-dev\_\-putc (char {\em c}, \/  FILE $\ast$ {\em f})}\label{lcd_8c_ef77b9dc8c9cc88a173e2fb8e3c95132}


same than lcd\_\-putc but with a prototype that is compliant with avrlibc $>$ 1.4.0 fdevopen prototype 

Definition at line 328 of file lcd.c.

References lcd\_\-putc().\index{lcd.c@{lcd.c}!lcd\_\-gotoxy@{lcd\_\-gotoxy}}
\index{lcd\_\-gotoxy@{lcd\_\-gotoxy}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-gotoxy]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-gotoxy (uint8\_\-t {\em x}, \/  uint8\_\-t {\em y})}\label{lcd_8c_dbf47a5efdf02367ded1ebf8f9edb5fe}


move the cursor in the screen, x= line, y = char 

Definition at line 260 of file lcd.c.

References lcd\_\-command(), and LCD\_\-DDRAM.

Referenced by lcd\_\-putc().\index{lcd.c@{lcd.c}!lcd\_\-home@{lcd\_\-home}}
\index{lcd\_\-home@{lcd\_\-home}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-home]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-home (void)}\label{lcd_8c_3aabf730aa4e0393bb5c959583c00a8e}




Definition at line 296 of file lcd.c.

References lcd\_\-command(), and LCD\_\-HOME.\index{lcd.c@{lcd.c}!lcd\_\-init@{lcd\_\-init}}
\index{lcd\_\-init@{lcd\_\-init}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-init (uint8\_\-t {\em dispAttr})}\label{lcd_8c_9af28b2779326b63ff4356e2b1828984}


Init the LCD module 

Definition at line 334 of file lcd.c.

References DDR, initial\_\-8\_\-bit\_\-write(), lcd\_\-clrscr(), lcd\_\-command(), LCD\_\-DISP\_\-OFF, LCD\_\-FUNCTION\_\-4BIT\_\-1LINE, LCD\_\-FUNCTION\_\-8BIT\_\-1LINE, LCD\_\-FUNCTION\_\-DEFAULT, LCD\_\-MODE\_\-DEFAULT, and sbi.\index{lcd.c@{lcd.c}!lcd\_\-putc@{lcd\_\-putc}}
\index{lcd\_\-putc@{lcd\_\-putc}!lcd.c@{lcd.c}}
\subsubsection[lcd\_\-putc]{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-putc (char {\em c})}\label{lcd_8c_fa7e36b95c43d603f510273ad077cbbe}


Put a char on screen if c = \par
 cursor is positioned on the next line if c =  the screen will be cleared 

Definition at line 304 of file lcd.c.

References lcd\_\-clrscr(), and lcd\_\-gotoxy().

Referenced by lcd\_\-dev\_\-putc().