- Main Page
- Files

# include/lc7981.h

Go to the documentation of this file.

    00001 /*
    00002  * lc7981.h
    00003  *
    00004  *  Created on: 01.05.2009
    00005  *      Author: sebastian
    00006  *
    00007  *    This file is part of Sebastians AVR Library for lc7981.
    00008  *
    00009  *   Sebastians AVR Library for lc789 is free software: you can redistribute it and/or modify
    00010  *   it under the terms of the GNU General Public License as published by
    00011  *   the Free Software Foundation, either version 3 of the License, or
    00012  *   (at your option) any later version.
    00013  *
    00014  *   Sebastians AVR Library is distributed in the hope that it will be useful,
    00015  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00016  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00017  *   GNU General Public License for more details.
    00018  *
    00019  *   You should have received a copy of the GNU General Public License
    00020  *   along with Sebastians AVR Library.  If not, see <http://www.gnu.org/licenses/>.
    00021  *
    00022  *
    00023  *                      'Do the thing you want to do and let your spirits guide you through.
    00024  *                      Live a life, worth being remembered.'
    00025  *                      -- Remembered - Firewind --
    00026  */
    00027
    00028
    00029
    00030
    00031 #ifndef LC7981_H_
    00032 #define LC7981_H_ LC7981_H_
    00033
    00034 #include <avr/io.h>
    00035 #include <util/delay.h>
    00036 #include <avr/pgmspace.h>
    00037
    00038 #define LCD_CTRL        PORTA
    00039 #define LCD_CRTL_DDR    DDRA
    00040 #define LCD_RS                  PA4
    00041 #define LCD_RW                  PA2
    00042 #define LCD_EN                  PA0
    00043
    00044
    00045
    00046 #define LCD_DATA                PORTD
    00047 #define LCD_DATA_DDR    DDRD
    00048
    00049 // Macros for (un)setting the control pins
    00050 #define lcd_rs_high() (LCD_CTRL |= (1 << LCD_RS))
    00051 #define lcd_rs_low() (LCD_CTRL &= ~(1 << LCD_RS))
    00052
    00053 #define lcd_rw_high() (LCD_CTRL |= (1 << LCD_RW))
    00054 #define lcd_rw_low() (LCD_CTRL &= ~(1 << LCD_RW))
    00055
    00056 #define lcd_en_high() (LCD_CTRL |= (1 << LCD_EN))
    00057 #define lcd_en_low() (LCD_CTRL &= ~(1 << LCD_EN))
    00058
    00059
    00060 #define LCD_TEXT 0
    00061 #define LCD_TEXT_LINES 10
    00062 #define LCD_TEXT_COLUMNS 26
    00063
    00064 #define LCD_GRAPHIC 1
    00065 #define LCD_GRAPHIC_WIDTH 160
    00066 #define LCD_GRAPHIC_HEIGHT 80
    00067 #define PIXEL_ON 1
    00068 #define PIXEL_OFF 0
    00069
    00070 void lcd_init(uint8_t mode);
    00071 inline void lcd_clear();
    00072
    00073 void lcd_write_text(char *txt);
    00074 inline void lcd_gotoxy(uint8_t x, uint8_t y);
    00075
    00076 void lcd_plot_pixel(uint8_t x, uint8_t y, uint8_t set);
    00077 void lcd_plot_bitmap(uint8_t x, uint8_t y, const uint8_t *bitmap, uint8_t w, uint8_t h);
    00078
    00079 inline void lcd_plot_char(uint8_t x_off, uint8_t y_off, uint8_t c, uint8_t fw, uint8_t fh, const uint8_t* font);
    00080 void lcd_plot_text(uint8_t x_off, uint8_t y_off, const char *text, uint8_t fw, uint8_t fh, const uint8_t *font);
    00081
    00082
    00083 inline void lcd_strobe();
    00084 inline void lcd_write_command(uint8_t cmd, uint8_t data);
    00085 inline uint8_t lcd_read_byte();
    00086
    00087 #endif /* LC7981_H_ */