New LiquidCrystal library  1.3.2
Generic LCD control library
/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/LiquidCrystal_I2C.h
1 // ---------------------------------------------------------------------------
2 // Created by Francisco Malpartida on 20/08/11.
3 // Copyright 2011 - Under creative commons license 3.0:
4 // Attribution-ShareAlike CC BY-SA
5 //
6 // This software is furnished "as is", without technical support, and with no
7 // warranty, express or implied, as to its usefulness for any purpose.
8 //
9 // Thread Safe: No
10 // Extendable: Yes
11 //
12 // @file LiquidCrystal_I2C.h
13 // This file implements a basic liquid crystal library that comes as standard
14 // in the Arduino SDK but using an I2C IO extension board.
15 //
16 // @brief
17 // This is a basic implementation of the LiquidCrystal library of the
18 // Arduino SDK. The original library has been reworked in such a way that
19 // this class implements the all methods to command an LCD based
20 // on the Hitachi HD44780 and compatible chipsets using I2C extension
21 // backpacks such as the I2CLCDextraIO with the PCF8574* I2C IO Expander ASIC.
22 //
23 // The functionality provided by this class and its base class is identical
24 // to the original functionality of the Arduino LiquidCrystal library.
25 //
26 //
27 // @author F. Malpartida - fmalpartida@gmail.com
28 // ---------------------------------------------------------------------------
29 #ifndef LiquidCrystal_I2C_h
30 #define LiquidCrystal_I2C_h
31 #include <inttypes.h>
32 #include <Print.h>
33 
34 #include "I2CIO.h"
35 #include "LCD.h"
36 
37 
38 class LiquidCrystal_I2C : public LCD
39 {
40 public:
41 
51  LiquidCrystal_I2C (uint8_t lcd_Addr);
52  // Constructor with backlight control
53  LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
54 
67  LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs);
68  // Constructor with backlight control
69  LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
70  uint8_t backlighPin, t_backlighPol pol);
71 
88  LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
89  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7 );
90  // Constructor with backlight control
91  LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
92  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
93  uint8_t backlighPin, t_backlighPol pol);
110  virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
111 
124  virtual void send(uint8_t value, uint8_t mode);
125 
134  void setBacklightPin ( uint8_t value, t_backlighPol pol );
135 
145  void setBacklight ( uint8_t value );
146 
147 private:
148 
154  int init();
155 
171  void config (uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
172  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7 );
173 
182  void write4bits(uint8_t value, uint8_t mode);
183 
190  void pulseEnable(uint8_t);
191 
192 
193  uint8_t _Addr; // I2C Address of the IO expander
194  uint8_t _backlightPinMask; // Backlight IO pin mask
195  uint8_t _backlightStsMask; // Backlight status mask
196  I2CIO _i2cio; // I2CIO PCF8574* expansion module driver I2CLCDextraIO
197  uint8_t _En; // LCD expander word for enable pin
198  uint8_t _Rw; // LCD expander word for R/W pin
199  uint8_t _Rs; // LCD expander word for Register Select pin
200  uint8_t _data_pins[4]; // LCD data lines
201 
202 };
203 
204 #endif
Definition: I2CIO.h:41
Definition: LCD.h:187
LiquidCrystal_I2C(uint8_t lcd_Addr)
Definition: LiquidCrystal_I2C.cpp:96
void setBacklightPin(uint8_t value, t_backlighPol pol)
Definition: LiquidCrystal_I2C.cpp:158
virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize=LCD_5x8DOTS)
Definition: LiquidCrystal_I2C.cpp:144
virtual void send(uint8_t value, uint8_t mode)
Definition: LiquidCrystal_I2C.cpp:240
Definition: LiquidCrystal_I2C.h:38
void setBacklight(uint8_t value)
Definition: LiquidCrystal_I2C.cpp:167