New LiquidCrystal library  1.3.2
Generic LCD control library
/Users/fmalpartida/Documents/development/mercurial repos/SW/NewliquidCrystal/LiquidCrystal.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.h
13 // This file implements a basic liquid crystal library that comes as standard
14 // in the Arduino SDK.
15 //
16 // @brief
17 // This is a basic implementation of the LiquidCrystal library of the
18 // Arduino SDK. The original library has been reworked in such a way that
19 // this class implements the all methods to command an LCD based
20 // on the Hitachi HD44780 and compatible chipsets using the parallel port of
21 // the LCD (4 bit and 8 bit).
22 //
23 //
24 //
25 // @author F. Malpartida - fmalpartida@gmail.com
26 // ---------------------------------------------------------------------------
27 #ifndef LiquidCrystal_4bit_h
28 #define LiquidCrystal_4bit_h
29 
30 #include <inttypes.h>
31 
32 #include "LCD.h"
33 #include "FastIO.h"
34 
35 
42 #define EXEC_TIME 37
43 
44 class LiquidCrystal : public LCD
45 {
46 public:
53  LiquidCrystal(uint8_t rs, uint8_t enable,
54  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
55  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
56  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
57  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
58  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
59 
60  // Constructors with backlight control
61  LiquidCrystal(uint8_t rs, uint8_t enable,
62  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
63  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
64  uint8_t backlightPin, t_backlighPol pol);
65  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
66  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
67  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
68  uint8_t backlightPin, t_backlighPol pol);
75  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
76  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
77  LiquidCrystal(uint8_t rs, uint8_t enable,
78  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
79 
80  // Constructors with backlight control
81  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
82  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
83  uint8_t backlightPin, t_backlighPol pol);
84  LiquidCrystal(uint8_t rs, uint8_t enable,
85  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
86  uint8_t backlightPin, t_backlighPol pol);
99  virtual void send(uint8_t value, uint8_t mode);
100 
109  void setBacklightPin ( uint8_t pin, t_backlighPol pol );
110 
125  void setBacklight ( uint8_t value );
126 
127 private:
128 
134  void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
135  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
136  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
137 
144  void writeNbits(uint8_t value, uint8_t numBits);
145 
152  void pulseEnable();
153 
154  uint8_t _rs_pin; // LOW: command. HIGH: character.
155  uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
156  uint8_t _enable_pin; // activated by a HIGH pulse.
157  uint8_t _data_pins[8]; // Data pins.
158  uint8_t _backlightPin; // Pin associated to control the LCD backlight
159 };
160 
161 #endif
Definition: LCD.h:187
LiquidCrystal(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
Definition: LiquidCrystal.cpp:55
Definition: LiquidCrystal.h:44
void setBacklight(uint8_t value)
Definition: LiquidCrystal.cpp:165
void setBacklightPin(uint8_t pin, t_backlighPol pol)
Definition: LiquidCrystal.cpp:155
virtual void send(uint8_t value, uint8_t mode)
Definition: LiquidCrystal.cpp:122