![]() |
LCD Library 1.2.0
LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.
|
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 // 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_4bit_h 00030 #define LiquidCrystal_4bit_h 00031 00032 #include <inttypes.h> 00033 00034 #include "LCD.h" 00035 #include "FastIO.h" 00036 00037 00044 #define EXEC_TIME 37 00045 00046 class LiquidCrystal : public LCD 00047 { 00048 public: 00055 LiquidCrystal(uint8_t rs, uint8_t enable, 00056 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 00057 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 00058 LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 00059 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 00060 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 00061 00068 LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 00069 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 00070 LiquidCrystal(uint8_t rs, uint8_t enable, 00071 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 00072 00085 virtual void send(uint8_t value, uint8_t mode); 00086 00096 void setBacklight ( uint8_t mode ); 00097 00105 void setBacklightPin ( uint8_t pin ); 00106 00107 00108 private: 00109 00115 void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, 00116 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 00117 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 00118 00125 void writeNbits(uint8_t value, uint8_t numBits); 00126 00133 void pulseEnable(); 00134 00135 uint8_t _rs_pin; // LOW: command. HIGH: character. 00136 uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD. 00137 uint8_t _enable_pin; // activated by a HIGH pulse. 00138 uint8_t _data_pins[8]; // Data pins. 00139 uint8_t _backlightPin; // Pin associated to control the LCD backlight 00140 }; 00141 00142 #endif