Max_LCD.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009-2011 Oleg Mazurov, Circuits At Home, http://www.circuitsathome.com
00003  * MAX3421E USB host controller support
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the authors nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  */
00029 
00030 //HD44780 compatible LCD display via MAX3421E GPOUT support header
00031 //pinout: D[4-7] -> GPOUT[4-7], RS-> GPOUT[2], E ->GPOUT[3]
00032 //
00033 //this code is heavily borrowed from official Arduino source v.0017
00034 // link to original http://code.google.com/p/arduino/source/browse/trunk/hardware/libraries/LiquidCrystal/LiquidCrystal.h
00035 //
00036 #ifndef _Max_LCD_h_
00037 #define _Max_LCD_h_
00038 
00039 #include <inttypes.h>
00040 #include "Print.h"
00041 
00042 // commands
00043 #define LCD_CLEARDISPLAY 0x01
00044 #define LCD_RETURNHOME 0x02
00045 #define LCD_ENTRYMODESET 0x04
00046 #define LCD_DISPLAYCONTROL 0x08
00047 #define LCD_CURSORSHIFT 0x10
00048 #define LCD_FUNCTIONSET 0x20
00049 #define LCD_SETCGRAMADDR 0x40
00050 #define LCD_SETDDRAMADDR 0x80
00051 
00052 // flags for display entry mode
00053 #define LCD_ENTRYRIGHT 0x00
00054 #define LCD_ENTRYLEFT 0x02
00055 #define LCD_ENTRYSHIFTINCREMENT 0x01
00056 #define LCD_ENTRYSHIFTDECREMENT 0x00
00057 
00058 // flags for display on/off control
00059 #define LCD_DISPLAYON 0x04
00060 #define LCD_DISPLAYOFF 0x00
00061 #define LCD_CURSORON 0x02
00062 #define LCD_CURSOROFF 0x00
00063 #define LCD_BLINKON 0x01
00064 #define LCD_BLINKOFF 0x00
00065 
00066 // flags for display/cursor shift
00067 #define LCD_DISPLAYMOVE 0x08
00068 #define LCD_CURSORMOVE 0x00
00069 #define LCD_MOVERIGHT 0x04
00070 #define LCD_MOVELEFT 0x00
00071 
00072 // flags for function set
00073 #define LCD_8BITMODE 0x10
00074 #define LCD_4BITMODE 0x00
00075 #define LCD_2LINE 0x08
00076 #define LCD_1LINE 0x00
00077 #define LCD_5x10DOTS 0x04
00078 #define LCD_5x8DOTS 0x00
00079 
00080 class Max_LCD : public Print {
00081 public:
00082   Max_LCD();
00083   void init();
00084   void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
00085   void clear();
00086   void home();
00087   void noDisplay();
00088   void display();
00089   void noBlink();
00090   void blink();
00091   void noCursor();
00092   void cursor();
00093   void scrollDisplayLeft();
00094   void scrollDisplayRight();
00095   void leftToRight();
00096   void rightToLeft();
00097   void autoscroll();
00098   void noAutoscroll();
00099   void createChar(uint8_t, uint8_t[]);
00100   void setCursor(uint8_t, uint8_t); 
00101   virtual void write(uint8_t);
00102   void command(uint8_t);
00103 private:
00104   void sendbyte( uint8_t val );
00105   uint8_t _displayfunction; //tokill
00106   uint8_t _displaycontrol;
00107   uint8_t _displaymode;
00108   uint8_t _initialized;
00109   uint8_t _numlines,_currline;
00110 };
00111 
00112 
00113 
00114 
00115 #endif


rosserial_adk_demo
Author(s): Adam Stambler
autogenerated on Mon Dec 2 2013 12:02:02