New LiquidCrystal Library 1.0.0
New LiquidCrystal Library - LCD control class hierarchy
/Users/fmalpartida/development/ardWorkspace/LiquidCrystal_I2C/LiquiCrystal_I2C/LiquidCrystal_4bit.h
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_4bit.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 // 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 // This library is only compatible with Arduino's SDK version 1.0
00028 //
00029 //
00030 // @author F. Malpartida - fmalpartida@gmail.com
00031 // ---------------------------------------------------------------------------
00032 #ifndef LiquidCrystal_4bit_h
00033 #define LiquidCrystal_4bit_h
00034 
00035 #include <inttypes.h>
00036 #include <LiquidCrystal.h>
00037 
00038 
00039 class LiquidCrystal_4bit : public LiquidCrystal
00040 {
00041 public:
00048    LiquidCrystal_4bit(uint8_t rs, uint8_t enable,
00049                       uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00050                       uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
00051    LiquidCrystal_4bit(uint8_t rs, uint8_t rw, uint8_t enable,
00052                       uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00053                       uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
00054 
00061    LiquidCrystal_4bit(uint8_t rs, uint8_t rw, uint8_t enable,
00062                       uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
00063    LiquidCrystal_4bit(uint8_t rs, uint8_t enable,
00064                       uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
00065       
00066 
00079    virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);   
00080    
00093    virtual void send(uint8_t value, uint8_t mode);
00094 
00095    
00096 private:
00097 
00103    void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
00104              uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
00105              uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
00106    
00112    void write8bits(uint8_t value);
00113    
00119    void write4bits(uint8_t value);
00120    
00127    void pulseEnable();
00128    
00129    uint8_t _rs_pin;       // LOW: command.  HIGH: character.
00130    uint8_t _rw_pin;       // LOW: write to LCD.  HIGH: read from LCD.
00131    uint8_t _enable_pin;   // activated by a HIGH pulse.
00132    uint8_t _data_pins[8]; // Data pins.
00133 };
00134 
00135 #endif
 All Classes Functions