
#ifndef LCD_H_INCLUDED
#define LCD_H_INCLUDED

#include <avr/io.h>
#include <util/delay.h>

#ifndef SETBIT
#define SETBIT(ADRESS,BIT) (ADRESS |= (1<<BIT))
#endif
#ifndef CLRBIT
#define CLRBIT(ADRESS,BIT) (ADRESS &= ~(1<<BIT))
#endif

#define LCD_PORT		PORTC
#define LCD_DDR			DDRC

#define LCD_DATA0_PIN	3
#define LCD_DATA1_PIN	2
#define LCD_DATA2_PIN	1
#define LCD_DATA3_PIN	0
#define LCD_RS_PIN		5
#define LCD_E_PIN		4
#define LCD_BCK_PIN		0
#define LCD_SET_ENABLE		LCD_PORT |= (1<<LCD_E_PIN);
#define LCD_CLR_ENABLE		LCD_PORT &= ~(1<<LCD_E_PIN);
#define LCD_RS_DATA			LCD_PORT |= (1<<LCD_RS_PIN);
#define LCD_RS_COMMAND		LCD_PORT &= ~(1<<LCD_RS_PIN);

/************************************************
    inicializacna funkcia
************************************************/

extern void lcd_init(void);

/************************************************
    funkcia na zapis datoveho byte-u do LCD
************************************************/

extern void lcd_data(unsigned char data);

/************************************************
    funkcia na zapis prikazu pre LCD
************************************************/

extern void lcd_command(unsigned char command);

/************************************************
    funkcia na nastavenie pozicie na LCD
************************************************/

extern void lcd_position(unsigned char row, unsigned char column);

/************************************************
    funkcia na vypis znaku na LCD
************************************************/

extern void lcd_putc(char c);

/************************************************
    funkcia na vypis retazca na LCD
************************************************/

extern void lcd_puts(char *s);

/************************************************
    dalsie uzitocne funkcie
************************************************/

//zmaze displej
extern void lcd_clear(void);

//nastavi na zaciatok displeja
extern void lcd_home(void);

//nastavi inkrementaciu - pohyb vpred na displeji
extern void lcd_inc(void);

//nastavi dekrementaciu
extern void lcd_dec(void);

//zapne displej
extern void lcd_displayOn(void);

//vypne displej
extern void lcd_displayOff(void);

//zobrazi kurzor
extern void lcd_cursorOn(void);

//schova kurzor
extern void lcd_cursorOff(void);

//rozblika kurzor
extern void lcd_cursorBlink(void);

#endif // LCD_H_INCLUDED
