New LiquidCrystal library  1.3.2
Generic LCD control library
/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/LiquidCrystal_SI2C.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 and software I2C.
15 // It will use digital pins 6 and 7 for SCL and SDA, but it can be changed
16 // in SI2CIO.cpp to use other pins if needed.
17 
18 // @brief
19 // This is a basic implementation of the LiquidCrystal library of the
20 // Arduino SDK. The original library has been reworked in such a way that
21 // this class implements the all methods to command an LCD based
22 // on the Hitachi HD44780 and compatible chipsets using I2C extension
23 // backpacks such as the I2CLCDextraIO with the PCF8574* I2C IO Expander ASIC.
24 //
25 // The functionality provided by this class and its base class is identical
26 // to the original functionality of the Arduino LiquidCrystal library.
27 //
28 //
29 // @author F. Malpartida - fmalpartida@gmail.com
30 // Adapted to SoftIC2 by Adrian Piccioli - adrianpiccioli@gmail.com
31 // ---------------------------------------------------------------------------
32 #ifndef LiquidCrystal_SI2C_h
33 #define LiquidCrystal_SI2C_h
34 #include <inttypes.h>
35 #include <Print.h>
36 
37 #include "SI2CIO.h"
38 #include "LCD.h"
39 
40 
41 class LiquidCrystal_SI2C : public LCD
42 {
43 public:
44 
54  LiquidCrystal_SI2C (uint8_t lcd_Addr);
55  // Constructor with backlight control
56  LiquidCrystal_SI2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
57 
70  LiquidCrystal_SI2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs);
71  // Constructor with backlight control
72  LiquidCrystal_SI2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
73  uint8_t backlighPin, t_backlighPol pol);
74 
91  LiquidCrystal_SI2C(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  // Constructor with backlight control
94  LiquidCrystal_SI2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
95  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
96  uint8_t backlighPin, t_backlighPol pol);
113  virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
114 
127  virtual void send(uint8_t value, uint8_t mode);
128 
137  void setBacklightPin ( uint8_t value, t_backlighPol pol );
138 
148  void setBacklight ( uint8_t value );
149 
150 private:
151 
157  int init();
158 
174  void config (uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
175  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7 );
176 
185  void write4bits(uint8_t value, uint8_t mode);
186 
193  void pulseEnable(uint8_t);
194 
195 
196  uint8_t _Addr; // I2C Address of the IO expander
197  uint8_t _backlightPinMask; // Backlight IO pin mask
198  uint8_t _backlightStsMask; // Backlight status mask
199  SI2CIO _i2cio; // I2CIO PCF8574* expansion module driver I2CLCDextraIO
200  uint8_t _En; // LCD expander word for enable pin
201  uint8_t _Rw; // LCD expander word for R/W pin
202  uint8_t _Rs; // LCD expander word for Register Select pin
203  uint8_t _data_pins[4]; // LCD data lines
204 
205 };
206 
207 #endif
Definition: LCD.h:187
virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize=LCD_5x8DOTS)
Definition: LiquidCrystal_SI2C.cpp:147
Definition: LiquidCrystal_SI2C.h:41
LiquidCrystal_SI2C(uint8_t lcd_Addr)
Definition: LiquidCrystal_SI2C.cpp:99
Definition: SI2CIO.h:42
void setBacklight(uint8_t value)
Definition: LiquidCrystal_SI2C.cpp:170
void setBacklightPin(uint8_t value, t_backlighPol pol)
Definition: LiquidCrystal_SI2C.cpp:161
virtual void send(uint8_t value, uint8_t mode)
Definition: LiquidCrystal_SI2C.cpp:243