LCD Library 1.2.1
LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.
/Users/fmalpartida/development/ardWorkspace/LiquidCrystal_I2C/LiquiCrystal_I2C/LiquidCrystal.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.h
00013 // This file implements a basic liquid crystal library that comes as standard
00014 // in the Arduino SDK.
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 the parallel port of
00021 // the LCD (4 bit and 8 bit).
00022 //
00023 //
00024 //
00025 // @author F. Malpartida - fmalpartida@gmail.com
00026 // ---------------------------------------------------------------------------
00027 #ifndef LiquidCrystal_4bit_h
00028 #define LiquidCrystal_4bit_h
00029 
00030 #include <inttypes.h>
00031 
00032 #include "LCD.h"
00033 #include "FastIO.h"
00034 
00035 
00042 #define EXEC_TIME 37
00043 
00044 class LiquidCrystal : public LCD
00045 {
00046 public:
00053    LiquidCrystal(uint8_t rs, uint8_t enable,
00054                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00055                  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
00056    LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
00057                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00058                  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
00059    
00060    // Constructors with backlight control
00061    LiquidCrystal(uint8_t rs, uint8_t enable,
00062                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00063                  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
00064                  uint8_t backlightPin, t_backlighPol pol);
00065    LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
00066                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00067                  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
00068                  uint8_t backlightPin, t_backlighPol pol);   
00075    LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
00076                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
00077    LiquidCrystal(uint8_t rs, uint8_t enable,
00078                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
00079    
00080    // Constructors with backlight control
00081    LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
00082                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00083                  uint8_t backlightPin, t_backlighPol pol);
00084    LiquidCrystal(uint8_t rs, uint8_t enable,
00085                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00086                  uint8_t backlightPin, t_backlighPol pol);
00099    virtual void send(uint8_t value, uint8_t mode);
00100    
00109    void setBacklightPin ( uint8_t pin, t_backlighPol pol );
00110    
00125    void setBacklight ( uint8_t value );
00126    
00127 private:
00128    
00134    void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
00135              uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00136              uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
00137    
00144    void writeNbits(uint8_t value, uint8_t numBits);
00145    
00152    void pulseEnable();
00153    
00154    uint8_t _rs_pin;       // LOW: command.  HIGH: character.
00155    uint8_t _rw_pin;       // LOW: write to LCD.  HIGH: read from LCD.
00156    uint8_t _enable_pin;   // activated by a HIGH pulse.
00157    uint8_t _data_pins[8]; // Data pins.
00158    uint8_t _backlightPin; // Pin associated to control the LCD backlight
00159 };
00160 
00161 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines