LCD Library 1.2.0
LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.
/Users/fmalpartida/development/ardWorkspace/LiquidCrystal_I2C/LiquiCrystal_I2C/LiquidCrystal_I2C.h
Go to the documentation of this file.
00001 // ---------------------------------------------------------------------------
00002 // Created by Francisco Malpartida on 20/08/11.
00003 // Copyright 2011 - Under creative commons license 3.0:
00004 //        Attribution-ShareAlike CC BY-SA
00005 //
00006 // This software is furnished "as is", without technical support, and with no 
00007 // warranty, express or implied, as to its usefulness for any purpose.
00008 //
00009 // Thread Safe: No
00010 // Extendable: Yes
00011 //
00012 // @file LiquidCrystal_I2C.h
00013 // This file implements a basic liquid crystal library that comes as standard
00014 // in the Arduino SDK but using an I2C IO extension board.
00015 // 
00016 // @brief 
00017 // This is a basic implementation of the LiquidCrystal library of the
00018 // Arduino SDK. The original library has been reworked in such a way that 
00019 // this class implements the all methods to command an LCD based
00020 // on the Hitachi HD44780 and compatible chipsets using I2C extension
00021 // backpacks such as the I2CLCDextraIO with the PCF8574* I2C IO Expander ASIC.
00022 //
00023 // The functionality provided by this class and its base class is identical
00024 // to the original functionality of the Arduino LiquidCrystal library.
00025 //
00026 //
00027 // @author F. Malpartida - fmalpartida@gmail.com
00028 // ---------------------------------------------------------------------------
00029 #ifndef LiquidCrystal_I2C_h
00030 #define LiquidCrystal_I2C_h
00031 #include <inttypes.h>
00032 #include <Print.h>
00033 
00034 #include "I2CIO.h"
00035 #include "LCD.h"
00036 
00037 // Default library configuration parameters used by class constructor with
00038 // only the I2C address field.
00039 // ---------------------------------------------------------------------------
00045 #define EN B01000000  // Enable bit
00046 
00052 #define RW B00100000  // Read/Write bit
00053 
00059 #define RS B00010000  // Register select bit
00060 
00061 
00062 class LiquidCrystal_I2C : public LCD 
00063 {
00064 public:
00065    
00075    LiquidCrystal_I2C (uint8_t lcd_Addr);
00076    
00089    LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs);
00090    
00091    
00108    LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, 
00109                      uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3 );
00110    
00127    virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);   
00128    
00141    virtual void send(uint8_t value, uint8_t mode);
00142    
00152    void setBacklight ( uint8_t mode );
00153    
00161    void setBacklightPin ( uint8_t pin );
00162    
00163    
00164 private:
00165    
00171    int  init();
00172    
00181    void write4bits(uint8_t value, uint8_t mode);
00182    
00189    void pulseEnable(uint8_t);
00190    
00191    
00192    uint8_t _Addr;             // I2C Address of the IO expander
00193    uint8_t _backlightPin;     // Backlight IO pin
00194    uint8_t _backlightMask;    // Backlight status mask
00195    I2CIO   _i2cio;            // I2CIO PCF8574* expansion module driver I2CLCDextraIO
00196    uint8_t _En;               // LCD expander word for enable pin
00197    uint8_t _Rw;               // LCD expander word for R/W pin
00198    uint8_t _Rs;               // LCD expander word for Register Select pin
00199    uint8_t _data_pins[4];     // LCD data lines
00200    
00201 };
00202 
00203 #endif
 All Classes Files Functions Variables Typedefs Defines