lcd.H

Go to the documentation of this file.
00001 /*!@file Devices/lcd.H Interface to an LCD screen via serial port */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // University of Southern California (USC) and the iLab at USC.         //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Devices/lcd.H $
00035 // $Id: lcd.H 6522 2006-04-25 16:41:24Z rjpeters $
00036 //
00037 
00038 #ifndef LCD_H_DEFINED
00039 #define LCD_H_DEFINED
00040 
00041 #include "Component/ModelComponent.H"
00042 #include "Devices/Serial.H"
00043 #include "Util/Types.H"
00044 
00045 #include <stdarg.h>
00046 
00047 //! lcd.H Interface to an LCD screen via serial port
00048 /*! LCD Class. Contains interfaces to display to a LCD connected via a
00049  serial port. If you need more than a serial port to connect to an
00050  LCD, that LCD must be very special.  Note that the code is made for
00051  Backpack LCDs by SEETRON. */
00052 
00053 class lcd : public ModelComponent
00054 {
00055 public:
00056   //! Default constructor. See ModelComponent.H
00057   lcd(OptionManager& mgr,
00058       const std::string& descrName = "Alphanumeric LCD Display",
00059       const std::string& tagName = "lcd");
00060 
00061   //! Destructor
00062   ~lcd();
00063 
00064   //! print some text starting at given cursor position
00065   /*! syntax is the same as printf(), plus the x,y
00066     coordinates. Returns true on success. */
00067   bool printf(const int x, const int y, const char *fmt, ...)
00068     // NOTE: this __attribute__ tells gcc that it should issue
00069     // printf-style warnings when compiling calls to lcd::printf(),
00070     // treating the 3rd argument (fmt) as the format string, and the
00071     // 4th and subsequent arguments as the printf-style parameters
00072     // (SUBNOTE: because this is a member function, there is a hidden
00073     // 'this' parameter that counts as arg 1, so the listed arguments
00074     // are counted starting from 2)
00075     __attribute__((format(__printf__, 4, 5)));
00076     ;
00077 
00078   //! Takes a string and outputs to LCD
00079   bool writeString(const char *s);
00080 
00081   //! Clears LCD screen
00082   bool clear();
00083 
00084   //! Scrolls display left by i positions
00085   bool scrollLeft(const int i);
00086 
00087   //! Scrolls display right by i positions
00088   bool scrollRight(const int i);
00089 
00090   //! Moves cursor to start of screen
00091   bool home();
00092 
00093   //! Moves cursor left by i positions
00094   bool moveCursorLeft(const int i);
00095 
00096   //! Moves cursor right by i positions
00097   bool moveCursorRight(const int i);
00098 
00099   //! Makes cursor a blinking block
00100   bool blinkBlock();
00101 
00102   //! Makes cursor a blinking underline
00103   bool blinkUnderline();
00104 
00105   //! Makes cursor invisible (not recommended)
00106   bool invisibleCursor();
00107 
00108   //! Sets cursor position to i
00109   bool setCursorPosition(const int i);
00110 
00111 protected:
00112   nub::soft_ref<Serial> itsPort; //!< our serial port
00113   NModelParam<int> itsRows;   //!< number of rows (lines of text)
00114   NModelParam<int> itsCols;   //!< number of columns
00115 
00116 private:
00117   //! send a command
00118   bool writeCommand(const byte cmd);
00119 };
00120 
00121 #endif
00122 
00123 // ######################################################################
00124 /* So things look consistent in everyone's emacs... */
00125 /* Local Variables: */
00126 /* indent-tabs-mode: nil */
00127 /* End: */
Generated on Sun May 8 08:40:37 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3