// File Name	: lcd.h

#ifndef _LCD_H_
#define _LCD_H_

#include "global.h"

// HD44780 LCD controller command set (do not modify these)
// writing:
#define LCD_CLR             0      // DB0: clear display
#define LCD_HOME            1      // DB1: return to home position
#define LCD_ENTRY_MODE      2      // DB2: set entry mode
#define LCD_ENTRY_INC       1      // DB1: increment
#define LCD_ENTRY_SHIFT     0      // DB2: shift
#define LCD_ON_CTRL         3      // DB3: turn lcd/cursor on
#define LCD_ON_DISPLAY      2      // DB2: turn display on
#define LCD_ON_CURSOR       1      // DB1: turn cursor on
#define LCD_ON_BLINK        0      // DB0: blinking cursor
#define LCD_MOVE            4      // DB4: move cursor/display
#define LCD_MOVE_DISP       3      // DB3: move display (0-> move cursor)
#define LCD_MOVE_RIGHT      2      // DB2: move right (0-> left)
#define LCD_FUNCTION        5      // DB5: function set
#define LCD_FUNCTION_8BIT   4      // DB4: set 8BIT mode (0->4BIT mode)
#define LCD_FUNCTION_2LINES 3      // DB3: two lines (0->one line)
#define LCD_FUNCTION_10DOTS 2      // DB2: 5x10 font (0->5x7 font)
#define LCD_CGRAM           6      // DB6: set CG RAM address
#define LCD_DDRAM           7      // DB7: set DD RAM address

// reading:
#define LCD_BUSY            7      // DB7: LCD is busy

// Default LCD setup
// this default setup is loaded on LCD initialization
#define LCD_FDEF_1				(1< is a pointer to a ROM array containing custom characters
//  is the index of the character to load from lcdCustomCharArray
//  is the RAM location in the LCD (legal value: 0-7)
void lcdLoadCustomChar(u08* lcdCustomCharArray, u08 romCharNum, u08 lcdCharNum);
// displays a horizontal progress bar at the current cursor location
//  is the value the bargraph should indicate
//  is the value at the end of the bargraph
//  is the number of LCD characters that the bargraph should cover
void lcdProgressBar(u16 progress, u16 maxprogress, u08 length);

void lcdDispTwoDgtls(u08 x, u08 y, u08 val);
void lcdDispFourDgtls(u08 x, u08 y, u16 val);
void lcdDispChar(u08 x, u08 y, u08 data);
void lcdDispStr(u08 x, u08 y, char str[]);
void lcdInitDisp(void);
void lcdUpdateDisp(void);
void lcdDispDay(u08 x, u08 y, u08 sunsat);
void lcdDispPumpInfo(void);
void lcdDispAlarm(u08 all);
void lcdDispPumpActive(u08 all);
void lcdDispPumpDuration(u08 all);
void lcdDispPumpFrequency(u08 all);
void lcdDispPumpNext(u08 all);



#endif