Synergia AVR 0.1
|
00001 /* 00002 Copyright (c) 2010 Tymon Tobolski 00003 00004 Permission is hereby granted, free of charge, to any person obtaining 00005 a copy of this software and associated documentation files (the 00006 "Software"), to deal in the Software without restriction, including 00007 without limitation the rights to use, copy, modify, merge, publish, 00008 distribute, sublicense, and/or sell copies of the Software, and to 00009 permit persons to whom the Software is furnished to do so, subject to 00010 the following conditions: 00011 00012 The above copyright notice and this permission notice shall be 00013 included in all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00016 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00018 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00019 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00020 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00021 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00022 */ 00023 00024 //define connctions for LCD 00025 #define LCD_RS 0 //define MCU pin connected to LCD RS 00026 #define LCD_E 1 //define MCU pin connected to LCD E 00027 00028 #define LCD_D4 2 //define MCU pin connected to LCD D3 00029 #define LCD_D5 3 //define MCU pin connected to LCD D4 00030 #define LCD_D6 4 //define MCU pin connected to LCD D5 00031 #define LCD_D7 5 //define MCU pin connected to LCD D6 00032 00033 #define LCD_DP PORTB //define MCU port connected to LCD data pins 00034 #define LCD_CP PORTB //define MCU port connected to LCD control pins 00035 #define LCD_DDR DDRB //define MCU direction register for port connected to LCD data pins 00036 #define LCD_CDR DDRB //define MCU direction register for port connected to LCD control pins 00037 00038 00039 #ifndef _LCD_H_ 00040 #define _LCD_H_ 00041 00064 class LCD { 00065 public: 00070 LCD(); 00071 00077 void cmd(unsigned char c); 00078 00082 void clear(); 00083 00090 void gotoxy(unsigned char x, unsigned char y); 00091 00098 void define(const unsigned char * dfn, unsigned char code); 00099 00108 void shift(char n); 00109 00113 void cursorOn(); 00114 00118 void cursorOff(); 00119 00123 void cursorBlink(); 00124 00128 void blank(); 00129 00133 void visible(); 00134 00141 LCD & operator<<(const unsigned char c); 00142 00149 LCD & operator<<(const char c); 00150 00157 LCD & operator<<(const char * string); 00158 00165 LCD & operator<<(char* string); 00166 00173 LCD & operator<<(const int number); 00174 00181 LCD & operator<<(const long number); 00182 00183 LCD & operator<<(const unsigned int number); 00184 }; 00185 00186 #endif