/****************************************************************************
Title: HD44780U LCD library
Author: Peter Fleury <pfleury@gmx.ch> http://tinyurl.com/peterfleury
License: GNU General Public License Version 3
File: $Id: lcd.c,v 1.15.2.2 2015/01/17 12:16:05 peter Exp $
Software: AVR-GCC 3.3
Target: any AVR device, memory mapped mode only for AT90S4414/8515/Mega
DESCRIPTION
Basic routines for interfacing a HD44780U-based text lcd display
Originally based on Volker Oth's lcd library,
changed lcd_init(), added additional constants for lcd_command(),
added 4-bit I/O mode, improved and optimized code.
Library can be operated in memory mapped mode (LCD_IO_MODE=0) or in
4-bit IO port mode (LCD_IO_MODE=1). 8-bit IO port mode not supported.
Memory mapped mode compatible with Kanda STK200, but supports also
generation of R/W signal through A8 address line.
USAGE
See the C include lcd.h file for a description of each function
*****************************************************************************/
/*
** constants/macros
*/
/* on ATmega64/128 PINF is on port 0x00 and not 0x60 */
/*
** function prototypes
*/
static void ;
/*
** local functions
*/
/*************************************************************************
delay for a minimum of <us> microseconds
the number of loops is calculated at compile-time from MCU clock frequency
*************************************************************************/
/* toggle Enable Pin to initiate write */
static void
/*************************************************************************
Low-level function to write byte to LCD controller
Input: data byte to write to LCD
rs 1: write data
0: write instruction
Returns: none
*************************************************************************/
static void
/* rs==0 -> write instruction to LCD_IO_FUNCTION */
/* rs==1 -> write data to LCD_IO_DATA */
/*************************************************************************
Low-level function to read byte from LCD controller
Input: rs 1: read data
0: read busy flag / address counter
Returns: byte read from LCD controller
*************************************************************************/
static uint8_t
/* rs==0 -> read instruction from LCD_IO_FUNCTION */
/* rs==1 -> read data from LCD_IO_DATA */
/*************************************************************************
loops while lcd is busy, returns address counter
*************************************************************************/
static uint8_t /* lcd_waitbusy */
/*************************************************************************
Move cursor to the start of next line or to the first line if the cursor
is already on the last line.
*************************************************************************/
static inline void /* lcd_newline */
/*
** PUBLIC FUNCTIONS
*/
/*************************************************************************
Send LCD controller instruction command
Input: instruction to send to LCD controller, see HD44780 data sheet
Returns: none
*************************************************************************/
void
/*************************************************************************
Send data byte to LCD controller
Input: data to send to LCD controller, see HD44780 data sheet
Returns: none
*************************************************************************/
void
/*************************************************************************
Set cursor to specified position
Input: x horizontal position (0: left most position)
y vertical position (0: first line)
Returns: none
*************************************************************************/
void /* lcd_gotoxy */
/*************************************************************************
*************************************************************************/
int
/*************************************************************************
Clear display and set cursor to home position
*************************************************************************/
void
/*************************************************************************
Set cursor to home position
*************************************************************************/
void
/*************************************************************************
Display character at current cursor position
Input: character to be displayed
Returns: none
*************************************************************************/
void /* lcd_putc */
/*************************************************************************
Display string without auto linefeed
Input: string to be displayed
Returns: none
*************************************************************************/
void /* lcd_puts */
/*************************************************************************
Display string from program memory without auto linefeed
Input: string from program memory be be displayed
Returns: none
*************************************************************************/
void /* lcd_puts_p */
/*************************************************************************
Initialize display and select type of cursor
Input: dispAttr LCD_DISP_OFF display off
LCD_DISP_ON display on, cursor off
LCD_DISP_ON_CURSOR display on, cursor on
LCD_DISP_CURSOR_BLINK display on, cursor on flashing
Returns: none
*************************************************************************/
void /* lcd_init */