New LiquidCrystal library  1.5.0
Generic LCD control library
/Users/fmalpartida/Documents/development/mercurial repos/SW/NewLiquidCrystal_lib/LiquidCrystal.h
1 // ---------------------------------------------------------------------------
2 // Created by Francisco Malpartida on 20/08/11.
3 // Copyright (C) - 2018
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License v3.0
16 // along with this program.
17 // If not, see <https://www.gnu.org/licenses/gpl-3.0.en.html>.
18 //
19 // ---------------------------------------------------------------------------
20 //
21 // Thread Safe: No
22 // Extendable: Yes
23 //
24 // @file LiquidCrystal.h
25 // This file implements a basic liquid crystal library that comes as standard
26 // in the Arduino SDK.
27 //
28 // @brief
29 // This is a basic implementation of the LiquidCrystal library of the
30 // Arduino SDK. The original library has been reworked in such a way that
31 // this class implements the all methods to command an LCD based
32 // on the Hitachi HD44780 and compatible chipsets using the parallel port of
33 // the LCD (4 bit and 8 bit).
34 //
35 //
36 //
37 // @author F. Malpartida - fmalpartida@gmail.com
38 // ---------------------------------------------------------------------------
39 #ifndef LiquidCrystal_4bit_h
40 #define LiquidCrystal_4bit_h
41 
42 #include <inttypes.h>
43 
44 #include "LCD.h"
45 #include "FastIO.h"
46 
47 
54 #define EXEC_TIME 37
55 
56 class LiquidCrystal : public LCD
57 {
58 public:
65  LiquidCrystal(uint8_t rs, 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  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
69  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
70  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
71 
72  // Constructors with backlight control
73  LiquidCrystal(uint8_t rs, uint8_t enable,
74  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
75  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
76  uint8_t backlightPin, t_backlightPol pol);
77  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
78  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
79  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
80  uint8_t backlightPin, t_backlightPol pol);
87  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
88  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
89  LiquidCrystal(uint8_t rs, uint8_t enable,
90  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
91 
92  // Constructors with backlight control
93  LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
94  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
95  uint8_t backlightPin, t_backlightPol pol);
96  LiquidCrystal(uint8_t rs, uint8_t enable,
97  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
98  uint8_t backlightPin, t_backlightPol pol);
111  virtual void send(uint8_t value, uint8_t mode);
112 
121  void setBacklightPin ( uint8_t pin, t_backlightPol pol );
122 
123 #if defined(ARDUINO_ARCH_ESP32)
124 
135  void analogWrite( uint8_t channel, uint32_t value, uint32_t valueMax );
136 #endif
137 
152  void setBacklight ( uint8_t value );
153 
154 private:
155 
161  void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
162  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
163  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
164 
171  void writeNbits(uint8_t value, uint8_t numBits);
172 
179  void pulseEnable();
180 
181  uint8_t _rs_pin; // LOW: command. HIGH: character.
182  uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
183  uint8_t _enable_pin; // activated by a HIGH pulse.
184  uint8_t _data_pins[8]; // Data pins.
185  uint8_t _backlightPin; // Pin associated to control the LCD backlight
186 };
187 
188 #endif
void setBacklightPin(uint8_t pin, t_backlightPol pol)
Definition: LiquidCrystal.cpp:167
Definition: LCD.h:199
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:67
Definition: LiquidCrystal.h:56
void setBacklight(uint8_t value)
Definition: LiquidCrystal.cpp:189
virtual void send(uint8_t value, uint8_t mode)
Definition: LiquidCrystal.cpp:134