\section{include/sys/lcd.h File Reference}
\label{sys_2lcd_8h}\index{include/sys/lcd.h@{include/sys/lcd.h}}
Internal Interface: LCD control and constants. 

{\tt \#include $<$config.h$>$}\par
{\tt \#include $<$rom/lcd.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf LCD\_\-SHORT\_\-CMD}\ 0
\item 
\#define {\bf LCD\_\-LONG\_\-CMD}\ 3
\item 
\#define {\bf LCD\_\-DATA\_\-OFFSET}\ 5
\item 
\#define {\bf LCD\_\-DATA\_\-SIZE}\ 9
\item 
\#define {\bf LCD\_\-MODE\_\-SET}\ 0x40
\item 
\#define {\bf LCD\_\-ENABLE}\ 0x08
\item 
\#define {\bf LCD\_\-DISABLE}\ 0x00
\item 
\#define {\bf LCD\_\-DEV\_\-ID}\ 0x7c
\item 
\#define {\bf I2C\_\-WRITE}\ 0
\item 
\#define {\bf I2C\_\-READ}\ 1
\item 
\#define {\bf SCL}\ 5
\item 
\#define {\bf SDA}\ 6
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf lcd\_\-init} (void)
\begin{CompactList}\small\item\em initialize LCD driver \item\end{CompactList}\item 
void {\bf lcd\_\-power\_\-on} (void)
\begin{CompactList}\small\item\em power on LCD display, also called from {\bf lcd\_\-init()}{\rm (p.\,\pageref{sys_2lcd_8h_a13})} \item\end{CompactList}\item 
void {\bf lcd\_\-power\_\-off} (void)
\begin{CompactList}\small\item\em power off LCD display \item\end{CompactList}\item 
void {\bf lcd\_\-refresh} (void)
\begin{CompactList}\small\item\em show LCD display contents to the world \item\end{CompactList}\item 
void {\bf lcd\_\-refresh\_\-next\_\-byte} (void)
\begin{CompactList}\small\item\em show LCD display contents to the world \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
unsigned char {\bf display\_\-memory} [$\,$]
\begin{CompactList}\small\item\em LCD display data buffer. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Internal Interface: LCD control and constants. 

\begin{Desc}
\item[Author:]Eddie C. Dost $<${\tt ecd@skynet.be}$>$\end{Desc}


Definition in file {\bf lcd.h}.

\subsection{Define Documentation}
\index{sys/lcd.h@{sys/lcd.h}!I2C_READ@{I2C\_\-READ}}
\index{I2C_READ@{I2C\_\-READ}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define I2C\_\-READ\ 1}\label{sys_2lcd_8h_a9}




Definition at line 61 of file lcd.h.\index{sys/lcd.h@{sys/lcd.h}!I2C_WRITE@{I2C\_\-WRITE}}
\index{I2C_WRITE@{I2C\_\-WRITE}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define I2C\_\-WRITE\ 0}\label{sys_2lcd_8h_a8}




Definition at line 60 of file lcd.h.\index{sys/lcd.h@{sys/lcd.h}!LCD_DATA_OFFSET@{LCD\_\-DATA\_\-OFFSET}}
\index{LCD_DATA_OFFSET@{LCD\_\-DATA\_\-OFFSET}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-DATA\_\-OFFSET\ 5}\label{sys_2lcd_8h_a2}




Definition at line 47 of file lcd.h.\index{sys/lcd.h@{sys/lcd.h}!LCD_DATA_SIZE@{LCD\_\-DATA\_\-SIZE}}
\index{LCD_DATA_SIZE@{LCD\_\-DATA\_\-SIZE}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-DATA\_\-SIZE\ 9}\label{sys_2lcd_8h_a3}




Definition at line 48 of file lcd.h.\index{sys/lcd.h@{sys/lcd.h}!LCD_DEV_ID@{LCD\_\-DEV\_\-ID}}
\index{LCD_DEV_ID@{LCD\_\-DEV\_\-ID}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-DEV\_\-ID\ 0x7c}\label{sys_2lcd_8h_a7}




Definition at line 58 of file lcd.h.

Referenced by lcd\_\-init().\index{sys/lcd.h@{sys/lcd.h}!LCD_DISABLE@{LCD\_\-DISABLE}}
\index{LCD_DISABLE@{LCD\_\-DISABLE}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-DISABLE\ 0x00}\label{sys_2lcd_8h_a6}




Definition at line 54 of file lcd.h.\index{sys/lcd.h@{sys/lcd.h}!LCD_ENABLE@{LCD\_\-ENABLE}}
\index{LCD_ENABLE@{LCD\_\-ENABLE}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-ENABLE\ 0x08}\label{sys_2lcd_8h_a5}




Definition at line 53 of file lcd.h.\index{sys/lcd.h@{sys/lcd.h}!LCD_LONG_CMD@{LCD\_\-LONG\_\-CMD}}
\index{LCD_LONG_CMD@{LCD\_\-LONG\_\-CMD}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-LONG\_\-CMD\ 3}\label{sys_2lcd_8h_a1}




Definition at line 46 of file lcd.h.

Referenced by lcd\_\-refresh().\index{sys/lcd.h@{sys/lcd.h}!LCD_MODE_SET@{LCD\_\-MODE\_\-SET}}
\index{LCD_MODE_SET@{LCD\_\-MODE\_\-SET}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-MODE\_\-SET\ 0x40}\label{sys_2lcd_8h_a4}




Definition at line 52 of file lcd.h.

Referenced by lcd\_\-power\_\-off(), and lcd\_\-power\_\-on().\index{sys/lcd.h@{sys/lcd.h}!LCD_SHORT_CMD@{LCD\_\-SHORT\_\-CMD}}
\index{LCD_SHORT_CMD@{LCD\_\-SHORT\_\-CMD}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LCD\_\-SHORT\_\-CMD\ 0}\label{sys_2lcd_8h_a0}




Definition at line 45 of file lcd.h.

Referenced by lcd\_\-power\_\-off(), and lcd\_\-power\_\-on().\index{sys/lcd.h@{sys/lcd.h}!SCL@{SCL}}
\index{SCL@{SCL}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SCL\ 5}\label{sys_2lcd_8h_a10}




Definition at line 63 of file lcd.h.

Referenced by i2c\_\-read\_\-ack(), i2c\_\-start(), i2c\_\-stop(), i2c\_\-write(), lcd\_\-init(), and lcd\_\-power\_\-off().\index{sys/lcd.h@{sys/lcd.h}!SDA@{SDA}}
\index{SDA@{SDA}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define SDA\ 6}\label{sys_2lcd_8h_a11}




Definition at line 64 of file lcd.h.

Referenced by i2c\_\-start(), i2c\_\-stop(), i2c\_\-write(), lcd\_\-init(), and lcd\_\-power\_\-off().

\subsection{Function Documentation}
\index{sys/lcd.h@{sys/lcd.h}!lcd_init@{lcd\_\-init}}
\index{lcd_init@{lcd\_\-init}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-init (void)}\label{sys_2lcd_8h_a13}


initialize LCD driver 

output drivers are configured as outputs. the lcd\_\-shadow buffer is cleared and initialized. the LCD controller is enabled. 

Definition at line 295 of file lcd.c.

References clr, LCD\_\-DEV\_\-ID, lcd\_\-power\_\-on(), lcd\_\-shadow, memset(), PORT6\_\-DDR, rom\_\-port6\_\-ddr, SCL, and SDA.

Referenced by kmain().\index{sys/lcd.h@{sys/lcd.h}!lcd_power_off@{lcd\_\-power\_\-off}}
\index{lcd_power_off@{lcd\_\-power\_\-off}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-power\_\-off (void)}\label{sys_2lcd_8h_a15}


power off LCD display 

the LCD controller is put in low power mode and output drivers to the LCD controller are disabled.

Note: without disabling the output drivers the CPU will not save power in sleep mode. 

Definition at line 279 of file lcd.c.

References clr, LCD\_\-MODE\_\-SET, lcd\_\-refresh(), lcd\_\-shadow, LCD\_\-SHORT\_\-CMD, lcd\_\-write\_\-data(), SCL, and SDA.

Referenced by kmain().\index{sys/lcd.h@{sys/lcd.h}!lcd_power_on@{lcd\_\-power\_\-on}}
\index{lcd_power_on@{lcd\_\-power\_\-on}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-power\_\-on (void)}\label{sys_2lcd_8h_a14}


power on LCD display, also called from {\bf lcd\_\-init()}{\rm (p.\,\pageref{sys_2lcd_8h_a13})} 

the LCD controller is enabled. 

Definition at line 266 of file lcd.c.

References LCD\_\-MODE\_\-SET, lcd\_\-shadow, LCD\_\-SHORT\_\-CMD, and lcd\_\-write\_\-data().

Referenced by lcd\_\-init().\index{sys/lcd.h@{sys/lcd.h}!lcd_refresh@{lcd\_\-refresh}}
\index{lcd_refresh@{lcd\_\-refresh}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-refresh (void)}\label{sys_2lcd_8h_a16}


show LCD display contents to the world 

the entire 9 bytes of display\_\-memory are written to the LCD controller unconditionally. lcd\_\-shadow is updated to the new values. 

Definition at line 254 of file lcd.c.

References display\_\-memory, LCD\_\-LONG\_\-CMD, lcd\_\-shadow, and lcd\_\-write\_\-data().

Referenced by kmain(), lcd\_\-power\_\-off(), show\_\-off(), and show\_\-on().\index{sys/lcd.h@{sys/lcd.h}!lcd_refresh_next_byte@{lcd\_\-refresh\_\-next\_\-byte}}
\index{lcd_refresh_next_byte@{lcd\_\-refresh\_\-next\_\-byte}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lcd\_\-refresh\_\-next\_\-byte (void)}\label{sys_2lcd_8h_a17}


show LCD display contents to the world 

display updates are realized on a byte basis by calling this function: the complete display will be updated after 9 calls. 

\subsection{Variable Documentation}
\index{sys/lcd.h@{sys/lcd.h}!display_memory@{display\_\-memory}}
\index{display_memory@{display\_\-memory}!sys/lcd.h@{sys/lcd.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned char {\bf display\_\-memory}[$\,$]}\label{sys_2lcd_8h_a12}


LCD display data buffer. 



Referenced by lcd\_\-refresh().