![]() |
LCD Library 1.1.1
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 // 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 <LCD.h> 00037 00038 00045 #define EXEC_TIME 37 00046 00047 class LiquidCrystal : public LCD 00048 { 00049 public: 00056 LiquidCrystal(uint8_t rs, 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 LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 00060 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 00061 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 00062 00069 LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable, 00070 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 00071 LiquidCrystal(uint8_t rs, uint8_t enable, 00072 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 00073 00086 virtual void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); 00087 00100 virtual void send(uint8_t value, uint8_t mode); 00101 00102 00103 private: 00104 00110 void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable, 00111 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, 00112 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7); 00113 00119 void write8bits(uint8_t value); 00120 00126 void write4bits(uint8_t value); 00127 00134 void pulseEnable(); 00135 00136 uint8_t _rs_pin; // LOW: command. HIGH: character. 00137 uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD. 00138 uint8_t _enable_pin; // activated by a HIGH pulse. 00139 uint8_t _data_pins[8]; // Data pins. 00140 }; 00141 00142 #endif