Port of the Arduino library with the same library. Includes a instance of the Print library from arduino

Dependencies:   mbed Print

Summary

A Conversion of the Arduino LiquidCrystal_I2C by Frank de Brabander to MBED
Version of original Library: 1.1.2
Information from the original library: The library allows to control I2C displays with functions extremely similar to LiquidCrystal library.
Original Github: https://github.com/johnrickman/LiquidCrystal_I2C


Code Example

This is a working example using the basic library features

example.cpp

#include "LiquidCrystal_I2C.h"

LiquidCrystal_I2C lcd(0x27, 20, 4, I2C_SDA, I2C_SCL);
void setup();
void loop();

//Arduino style setup function
void setup() {
	lcd.init();
	for (int i = 0; i < 3; i++) {
		lcd.backlight();
		wait_ms(250);
		lcd.noBacklight();
		wait_ms(250);
	}
	lcd.backlight();
	lcd.setCursor(3, 0); // Start at character 4 on line 0
	lcd.print("Hello, world!");
	wait_ms(500);
	lcd.setCursor(2, 1);
	lcd.print("From YourDuino");
	wait_ms(500);
	lcd.setCursor(0, 2);
	lcd.print("20 by 4 Line Display");
	lcd.setCursor(1, 3);
	wait_ms(1000);
	lcd.print("DVSProductions.de");
	wait_ms(8000);
}

//print some random characters
void loop() {
	//lcd.setCursor(rand() % 20, rand() % 4);
	//lcd.print(rand() % 10);      
	for (int x = 0; x != 20; x++)
		for (int y = 0; y != 20; y++)
			lcd.print(rand() % 10);
}

//Behave like an Arduino
int main() {
	setup();
	while (true)loop();
}

Misc

It is important to note that the library requires the init function to be called before sending any data. Instead of the arduino typical:

arduino.ino

LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup(){
	lcd.begin(20, 4);
}

We pass the pins and size to the constructor and then just call the init function:

mbed.cpp

LiquidCrystal_I2C lcd(0x27, 20, 4, I2C_SDA, I2C_SCL);
void setup(){
	lcd.init();
}

Also important is that the begin function still has value. It is now able to change the size of the LCD after the constructor. This might have few applications, but it is more powerful than the Arduino version, where the parameters had barely any use.

Committer:
DVSProductions
Date:
Thu Aug 15 13:55:21 2019 +0000
Revision:
4:402a5c6b2457
Parent:
3:9c8694d5744a
INSANE PERFORMANCE BOOST

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DVSProductions 0:5f9ddd9b7a33 1 // Based on the work by DFRobot upgraded by DVSProductions
DVSProductions 0:5f9ddd9b7a33 2 #include "LiquidCrystal_I2C.h"
DVSProductions 0:5f9ddd9b7a33 3 #include <inttypes.h>
DVSProductions 4:402a5c6b2457 4 /*********** mid level commands, for sending data/cmds */
DVSProductions 4:402a5c6b2457 5 #define COMMAND(value) send(value, 0)
DVSProductions 0:5f9ddd9b7a33 6 #define printIIC(args) i2c->write(_Addr, args, 1)
DVSProductions 4:402a5c6b2457 7 size_t LiquidCrystal_I2C::write(uint8_t value) {
DVSProductions 0:5f9ddd9b7a33 8 send(value, Rs);
DVSProductions 0:5f9ddd9b7a33 9 return 1;
DVSProductions 0:5f9ddd9b7a33 10 }
DVSProductions 0:5f9ddd9b7a33 11
DVSProductions 4:402a5c6b2457 12 inline void LiquidCrystal_I2C::command(uint8_t value) {
DVSProductions 4:402a5c6b2457 13 send(value, 0);
DVSProductions 4:402a5c6b2457 14 }
DVSProductions 4:402a5c6b2457 15
DVSProductions 0:5f9ddd9b7a33 16 // When the display powers up, it is configured as follows:
DVSProductions 0:5f9ddd9b7a33 17 //
DVSProductions 0:5f9ddd9b7a33 18 // 1. Display clear
DVSProductions 0:5f9ddd9b7a33 19 // 2. Function set:
DVSProductions 0:5f9ddd9b7a33 20 // DL = 1; 8-bit interface data
DVSProductions 0:5f9ddd9b7a33 21 // N = 0; 1-line display
DVSProductions 0:5f9ddd9b7a33 22 // F = 0; 5x8 dot character font
DVSProductions 0:5f9ddd9b7a33 23 // 3. Display on/off control:
DVSProductions 0:5f9ddd9b7a33 24 // D = 0; Display off
DVSProductions 0:5f9ddd9b7a33 25 // C = 0; Cursor off
DVSProductions 0:5f9ddd9b7a33 26 // B = 0; Blinking off
DVSProductions 0:5f9ddd9b7a33 27 // 4. Entry mode set:
DVSProductions 0:5f9ddd9b7a33 28 // I/D = 1; Increment by 1
DVSProductions 0:5f9ddd9b7a33 29 // S = 0; No shift
DVSProductions 0:5f9ddd9b7a33 30 //
DVSProductions 0:5f9ddd9b7a33 31 // Note, however, that resetting the Arduino doesn't reset the LCD, so we
DVSProductions 0:5f9ddd9b7a33 32 // can't assume that its in that state when a sketch starts (and the
DVSProductions 0:5f9ddd9b7a33 33 // LiquidCrystal constructor is called).
DVSProductions 0:5f9ddd9b7a33 34
DVSProductions 2:3f791f8019a8 35 /*!
DVSProductions 2:3f791f8019a8 36 Creates a new LCD instance
DVSProductions 2:3f791f8019a8 37 !*/
DVSProductions 4:402a5c6b2457 38 LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t lcd_cols, uint8_t lcd_rows, PinName sda, PinName scl) {
DVSProductions 0:5f9ddd9b7a33 39 _Addr = lcd_Addr << 1;
DVSProductions 0:5f9ddd9b7a33 40 _cols = lcd_cols;
DVSProductions 0:5f9ddd9b7a33 41 _rows = lcd_rows;
DVSProductions 0:5f9ddd9b7a33 42 _backlightval = LCD_NOBACKLIGHT;
DVSProductions 0:5f9ddd9b7a33 43 i2c = new I2C(sda, scl);
DVSProductions 4:402a5c6b2457 44 i2c->frequency(1000000);
DVSProductions 0:5f9ddd9b7a33 45 }
DVSProductions 0:5f9ddd9b7a33 46
DVSProductions 4:402a5c6b2457 47 void LiquidCrystal_I2C::init() {
DVSProductions 0:5f9ddd9b7a33 48 init_priv();
DVSProductions 0:5f9ddd9b7a33 49 }
DVSProductions 0:5f9ddd9b7a33 50
DVSProductions 4:402a5c6b2457 51 void LiquidCrystal_I2C::init_priv() {
DVSProductions 0:5f9ddd9b7a33 52 _displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
DVSProductions 2:3f791f8019a8 53 begin_priv();
DVSProductions 0:5f9ddd9b7a33 54 }
DVSProductions 4:402a5c6b2457 55 void LiquidCrystal_I2C::begin_priv(uint8_t dotsize) {
DVSProductions 2:3f791f8019a8 56 if (_rows > 1) {
DVSProductions 0:5f9ddd9b7a33 57 _displayfunction |= LCD_2LINE;
DVSProductions 0:5f9ddd9b7a33 58 }
DVSProductions 2:3f791f8019a8 59 _numlines = _rows;
DVSProductions 0:5f9ddd9b7a33 60 // for some 1 line displays you can select a 10 pixel high font
DVSProductions 2:3f791f8019a8 61 if ((dotsize != 0) && (_rows == 1)) {
DVSProductions 0:5f9ddd9b7a33 62 _displayfunction |= LCD_5x10DOTS;
DVSProductions 0:5f9ddd9b7a33 63 }
DVSProductions 0:5f9ddd9b7a33 64 // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
DVSProductions 0:5f9ddd9b7a33 65 // according to datasheet, we need at least 40ms after power rises above 2.7V
DVSProductions 4:402a5c6b2457 66 // before sending commands. Nucleo can turn on way befer 4.5V so we'll wait
DVSProductions 2:3f791f8019a8 67 // 50
DVSProductions 0:5f9ddd9b7a33 68 wait_ms(50);
DVSProductions 0:5f9ddd9b7a33 69 // Now we pull both RS and R/W low to begin commands
DVSProductions 0:5f9ddd9b7a33 70 expanderWrite(_backlightval); // reset expanderand turn backlight off (Bit 8 =1)
DVSProductions 0:5f9ddd9b7a33 71 wait_ms(1000);
DVSProductions 0:5f9ddd9b7a33 72 // put the LCD into 4 bit mode
DVSProductions 0:5f9ddd9b7a33 73 // this is according to the hitachi HD44780 datasheet
DVSProductions 0:5f9ddd9b7a33 74 // figure 24, pg 46
DVSProductions 2:3f791f8019a8 75
DVSProductions 0:5f9ddd9b7a33 76 // we start in 8bit mode, try to set 4 bit mode
DVSProductions 0:5f9ddd9b7a33 77 write4bits(0x03 << 4);
DVSProductions 0:5f9ddd9b7a33 78 wait_us(4100); // wait min 4.1ms
DVSProductions 0:5f9ddd9b7a33 79 // second try
DVSProductions 0:5f9ddd9b7a33 80 write4bits(0x03 << 4);
DVSProductions 0:5f9ddd9b7a33 81 wait_us(4100); // wait min 4.1ms
DVSProductions 0:5f9ddd9b7a33 82 // third go!
DVSProductions 0:5f9ddd9b7a33 83 write4bits(0x03 << 4);
DVSProductions 0:5f9ddd9b7a33 84 wait_us(150);
DVSProductions 0:5f9ddd9b7a33 85 // finally, set to 4-bit interface
DVSProductions 0:5f9ddd9b7a33 86 write4bits(0x02 << 4);
DVSProductions 0:5f9ddd9b7a33 87 // set # lines, font size, etc.
DVSProductions 4:402a5c6b2457 88 COMMAND(LCD_FUNCTIONSET | _displayfunction);
DVSProductions 0:5f9ddd9b7a33 89 // turn the display on with no cursor or blinking default
DVSProductions 0:5f9ddd9b7a33 90 _displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
DVSProductions 0:5f9ddd9b7a33 91 display();
DVSProductions 0:5f9ddd9b7a33 92 // clear it off
DVSProductions 0:5f9ddd9b7a33 93 clear();
DVSProductions 0:5f9ddd9b7a33 94 // Initialize to default text direction (for roman languages)
DVSProductions 0:5f9ddd9b7a33 95 _displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
DVSProductions 0:5f9ddd9b7a33 96 // set the entry mode
DVSProductions 4:402a5c6b2457 97 COMMAND(LCD_ENTRYMODESET | LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT);
DVSProductions 0:5f9ddd9b7a33 98 home();
DVSProductions 0:5f9ddd9b7a33 99 }
DVSProductions 4:402a5c6b2457 100 void LiquidCrystal_I2C::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
DVSProductions 4:402a5c6b2457 101 _cols = cols;
DVSProductions 4:402a5c6b2457 102 _rows = lines;
DVSProductions 2:3f791f8019a8 103 begin_priv();
DVSProductions 2:3f791f8019a8 104 }
DVSProductions 0:5f9ddd9b7a33 105
DVSProductions 0:5f9ddd9b7a33 106 /********** high level commands, for the user! */
DVSProductions 4:402a5c6b2457 107 void LiquidCrystal_I2C::clear() {
DVSProductions 4:402a5c6b2457 108 COMMAND(LCD_CLEARDISPLAY); // clear display, set cursor position to zero
DVSProductions 0:5f9ddd9b7a33 109 wait_us(2000); // this command takes a long time!
DVSProductions 0:5f9ddd9b7a33 110 }
DVSProductions 0:5f9ddd9b7a33 111
DVSProductions 4:402a5c6b2457 112 void LiquidCrystal_I2C::home() {
DVSProductions 4:402a5c6b2457 113 COMMAND(LCD_RETURNHOME); // set cursor position to zero
DVSProductions 0:5f9ddd9b7a33 114 wait_us(2000); // this command takes a long time!
DVSProductions 0:5f9ddd9b7a33 115 }
DVSProductions 0:5f9ddd9b7a33 116
DVSProductions 4:402a5c6b2457 117 void LiquidCrystal_I2C::setCursor(uint8_t col, uint8_t row) {
DVSProductions 4:402a5c6b2457 118 int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
DVSProductions 4:402a5c6b2457 119 if (row > _numlines)
DVSProductions 0:5f9ddd9b7a33 120 row = _numlines - 1; // we count rows starting w/0
DVSProductions 4:402a5c6b2457 121 COMMAND(LCD_SETDDRAMADDR | (col + row_offsets[row]));
DVSProductions 0:5f9ddd9b7a33 122 }
DVSProductions 0:5f9ddd9b7a33 123
DVSProductions 0:5f9ddd9b7a33 124 // Turn the display on/off (quickly)
DVSProductions 4:402a5c6b2457 125 void LiquidCrystal_I2C::noDisplay() {
DVSProductions 0:5f9ddd9b7a33 126 _displaycontrol &= ~LCD_DISPLAYON;
DVSProductions 4:402a5c6b2457 127 COMMAND(LCD_DISPLAYCONTROL | _displaycontrol);
DVSProductions 0:5f9ddd9b7a33 128 }
DVSProductions 4:402a5c6b2457 129 void LiquidCrystal_I2C::display() {
DVSProductions 0:5f9ddd9b7a33 130 _displaycontrol |= LCD_DISPLAYON;
DVSProductions 4:402a5c6b2457 131 COMMAND(LCD_DISPLAYCONTROL | _displaycontrol);
DVSProductions 0:5f9ddd9b7a33 132 }
DVSProductions 0:5f9ddd9b7a33 133
DVSProductions 0:5f9ddd9b7a33 134 // Turns the underline cursor on/off
DVSProductions 4:402a5c6b2457 135 void LiquidCrystal_I2C::noCursor() {
DVSProductions 0:5f9ddd9b7a33 136 _displaycontrol &= ~LCD_CURSORON;
DVSProductions 4:402a5c6b2457 137 COMMAND(LCD_DISPLAYCONTROL | _displaycontrol);
DVSProductions 0:5f9ddd9b7a33 138 }
DVSProductions 4:402a5c6b2457 139 void LiquidCrystal_I2C::cursor() {
DVSProductions 0:5f9ddd9b7a33 140 _displaycontrol |= LCD_CURSORON;
DVSProductions 4:402a5c6b2457 141 COMMAND(LCD_DISPLAYCONTROL | _displaycontrol);
DVSProductions 0:5f9ddd9b7a33 142 }
DVSProductions 0:5f9ddd9b7a33 143
DVSProductions 0:5f9ddd9b7a33 144 // Turn on and off the blinking cursor
DVSProductions 4:402a5c6b2457 145 void LiquidCrystal_I2C::noBlink() {
DVSProductions 0:5f9ddd9b7a33 146 _displaycontrol &= ~LCD_BLINKON;
DVSProductions 4:402a5c6b2457 147 COMMAND(LCD_DISPLAYCONTROL | _displaycontrol);
DVSProductions 0:5f9ddd9b7a33 148 }
DVSProductions 4:402a5c6b2457 149 void LiquidCrystal_I2C::blink() {
DVSProductions 0:5f9ddd9b7a33 150 _displaycontrol |= LCD_BLINKON;
DVSProductions 4:402a5c6b2457 151 COMMAND(LCD_DISPLAYCONTROL | _displaycontrol);
DVSProductions 0:5f9ddd9b7a33 152 }
DVSProductions 0:5f9ddd9b7a33 153
DVSProductions 0:5f9ddd9b7a33 154 // These commands scroll the display without changing the RAM
DVSProductions 4:402a5c6b2457 155 void LiquidCrystal_I2C::scrollDisplayLeft(void) {
DVSProductions 4:402a5c6b2457 156 COMMAND(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
DVSProductions 0:5f9ddd9b7a33 157 }
DVSProductions 4:402a5c6b2457 158 void LiquidCrystal_I2C::scrollDisplayRight(void) {
DVSProductions 4:402a5c6b2457 159 COMMAND(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
DVSProductions 0:5f9ddd9b7a33 160 }
DVSProductions 0:5f9ddd9b7a33 161
DVSProductions 0:5f9ddd9b7a33 162 // This is for text that flows Left to Right
DVSProductions 4:402a5c6b2457 163 void LiquidCrystal_I2C::leftToRight(void) {
DVSProductions 0:5f9ddd9b7a33 164 _displaymode |= LCD_ENTRYLEFT;
DVSProductions 4:402a5c6b2457 165 COMMAND(LCD_ENTRYMODESET | _displaymode);
DVSProductions 0:5f9ddd9b7a33 166 }
DVSProductions 0:5f9ddd9b7a33 167
DVSProductions 0:5f9ddd9b7a33 168 // This is for text that flows Right to Left
DVSProductions 4:402a5c6b2457 169 void LiquidCrystal_I2C::rightToLeft(void) {
DVSProductions 0:5f9ddd9b7a33 170 _displaymode &= ~LCD_ENTRYLEFT;
DVSProductions 4:402a5c6b2457 171 COMMAND(LCD_ENTRYMODESET | _displaymode);
DVSProductions 0:5f9ddd9b7a33 172 }
DVSProductions 0:5f9ddd9b7a33 173
DVSProductions 0:5f9ddd9b7a33 174 // This will 'right justify' text from the cursor
DVSProductions 4:402a5c6b2457 175 void LiquidCrystal_I2C::autoscroll(void) {
DVSProductions 0:5f9ddd9b7a33 176 _displaymode |= LCD_ENTRYSHIFTINCREMENT;
DVSProductions 4:402a5c6b2457 177 COMMAND(LCD_ENTRYMODESET | _displaymode);
DVSProductions 0:5f9ddd9b7a33 178 }
DVSProductions 0:5f9ddd9b7a33 179
DVSProductions 0:5f9ddd9b7a33 180 // This will 'left justify' text from the cursor
DVSProductions 4:402a5c6b2457 181 void LiquidCrystal_I2C::noAutoscroll(void) {
DVSProductions 0:5f9ddd9b7a33 182 _displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
DVSProductions 4:402a5c6b2457 183 COMMAND(LCD_ENTRYMODESET | _displaymode);
DVSProductions 0:5f9ddd9b7a33 184 }
DVSProductions 0:5f9ddd9b7a33 185
DVSProductions 0:5f9ddd9b7a33 186 // Allows us to fill the first 8 CGRAM locations
DVSProductions 0:5f9ddd9b7a33 187 // with custom characters
DVSProductions 4:402a5c6b2457 188 void LiquidCrystal_I2C::createChar(uint8_t location, uint8_t charmap[]) {
DVSProductions 0:5f9ddd9b7a33 189 location &= 0x7; // we only have 8 locations 0-7
DVSProductions 4:402a5c6b2457 190 COMMAND(LCD_SETCGRAMADDR | (location << 3));
DVSProductions 4:402a5c6b2457 191 for (uint8_t i = 0; i != 8; i++)
DVSProductions 0:5f9ddd9b7a33 192 write(charmap[i]);
DVSProductions 0:5f9ddd9b7a33 193 }
DVSProductions 0:5f9ddd9b7a33 194
DVSProductions 0:5f9ddd9b7a33 195 // Turn the (optional) backlight off/on
DVSProductions 4:402a5c6b2457 196 void LiquidCrystal_I2C::noBacklight(void) {
DVSProductions 0:5f9ddd9b7a33 197 _backlightval = LCD_NOBACKLIGHT;
DVSProductions 0:5f9ddd9b7a33 198 expanderWrite(0);
DVSProductions 0:5f9ddd9b7a33 199 }
DVSProductions 0:5f9ddd9b7a33 200
DVSProductions 4:402a5c6b2457 201 void LiquidCrystal_I2C::backlight(void) {
DVSProductions 0:5f9ddd9b7a33 202 _backlightval = LCD_BACKLIGHT;
DVSProductions 0:5f9ddd9b7a33 203 expanderWrite(0);
DVSProductions 0:5f9ddd9b7a33 204 }
DVSProductions 0:5f9ddd9b7a33 205
DVSProductions 0:5f9ddd9b7a33 206 /************ low level data pushing commands **********/
DVSProductions 0:5f9ddd9b7a33 207
DVSProductions 0:5f9ddd9b7a33 208 // write either command or data
DVSProductions 4:402a5c6b2457 209 void LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) {
DVSProductions 0:5f9ddd9b7a33 210 uint8_t highnib = value & 0xf0;
DVSProductions 0:5f9ddd9b7a33 211 uint8_t lownib = (value << 4) & 0xf0;
DVSProductions 0:5f9ddd9b7a33 212 write4bits((highnib) | mode);
DVSProductions 0:5f9ddd9b7a33 213 write4bits((lownib) | mode);
DVSProductions 0:5f9ddd9b7a33 214 }
DVSProductions 0:5f9ddd9b7a33 215
DVSProductions 4:402a5c6b2457 216 void LiquidCrystal_I2C::write4bits(uint8_t value) {
DVSProductions 0:5f9ddd9b7a33 217 expanderWrite(value);
DVSProductions 0:5f9ddd9b7a33 218 pulseEnable(value);
DVSProductions 0:5f9ddd9b7a33 219 }
DVSProductions 0:5f9ddd9b7a33 220 char buff;
DVSProductions 4:402a5c6b2457 221 inline void LiquidCrystal_I2C::expanderWrite(uint8_t _data) {
DVSProductions 0:5f9ddd9b7a33 222 buff = (_data) | _backlightval;
DVSProductions 0:5f9ddd9b7a33 223 printIIC(&buff);
DVSProductions 0:5f9ddd9b7a33 224 }
DVSProductions 0:5f9ddd9b7a33 225
DVSProductions 4:402a5c6b2457 226 void LiquidCrystal_I2C::pulseEnable(uint8_t _data) {
DVSProductions 0:5f9ddd9b7a33 227 expanderWrite(_data | En); // En high
DVSProductions 0:5f9ddd9b7a33 228 wait_us(1); // enable pulse must be >450ns
DVSProductions 0:5f9ddd9b7a33 229
DVSProductions 0:5f9ddd9b7a33 230 expanderWrite(_data & ~En); // En low
DVSProductions 4:402a5c6b2457 231 wait_us(10); // commands need > 37us to settle
DVSProductions 0:5f9ddd9b7a33 232 }
DVSProductions 0:5f9ddd9b7a33 233
DVSProductions 0:5f9ddd9b7a33 234 // Alias functions
DVSProductions 0:5f9ddd9b7a33 235
DVSProductions 4:402a5c6b2457 236 inline void LiquidCrystal_I2C::cursor_on() {
DVSProductions 0:5f9ddd9b7a33 237 cursor();
DVSProductions 0:5f9ddd9b7a33 238 }
DVSProductions 0:5f9ddd9b7a33 239
DVSProductions 4:402a5c6b2457 240 inline void LiquidCrystal_I2C::cursor_off() {
DVSProductions 0:5f9ddd9b7a33 241 noCursor();
DVSProductions 0:5f9ddd9b7a33 242 }
DVSProductions 0:5f9ddd9b7a33 243
DVSProductions 4:402a5c6b2457 244 inline void LiquidCrystal_I2C::blink_on() {
DVSProductions 0:5f9ddd9b7a33 245 blink();
DVSProductions 0:5f9ddd9b7a33 246 }
DVSProductions 0:5f9ddd9b7a33 247
DVSProductions 4:402a5c6b2457 248 inline void LiquidCrystal_I2C::blink_off() {
DVSProductions 0:5f9ddd9b7a33 249 noBlink();
DVSProductions 0:5f9ddd9b7a33 250 }
DVSProductions 0:5f9ddd9b7a33 251
DVSProductions 4:402a5c6b2457 252 inline void LiquidCrystal_I2C::load_custom_character(uint8_t char_num, uint8_t *rows) {
DVSProductions 0:5f9ddd9b7a33 253 createChar(char_num, rows);
DVSProductions 0:5f9ddd9b7a33 254 }
DVSProductions 0:5f9ddd9b7a33 255
DVSProductions 4:402a5c6b2457 256 void LiquidCrystal_I2C::setBacklight(uint8_t new_val) {
DVSProductions 0:5f9ddd9b7a33 257 if (new_val)
DVSProductions 0:5f9ddd9b7a33 258 backlight(); // turn backlight on
DVSProductions 0:5f9ddd9b7a33 259 else
DVSProductions 0:5f9ddd9b7a33 260 noBacklight(); // turn backlight off
DVSProductions 0:5f9ddd9b7a33 261 }
DVSProductions 0:5f9ddd9b7a33 262
DVSProductions 4:402a5c6b2457 263 void LiquidCrystal_I2C::printstr(const char c[]) {
DVSProductions 0:5f9ddd9b7a33 264 // This function is not identical to the function used for "real" I2C displays
DVSProductions 4:402a5c6b2457 265 // it's here so the use sketch doesn't have to be changed
DVSProductions 0:5f9ddd9b7a33 266 print(c);
DVSProductions 0:5f9ddd9b7a33 267 }
DVSProductions 0:5f9ddd9b7a33 268
DVSProductions 0:5f9ddd9b7a33 269 // unsupported API functions
DVSProductions 4:402a5c6b2457 270 void LiquidCrystal_I2C::off() {
DVSProductions 4:402a5c6b2457 271 noBacklight();
DVSProductions 4:402a5c6b2457 272 }
DVSProductions 4:402a5c6b2457 273 void LiquidCrystal_I2C::on() {
DVSProductions 4:402a5c6b2457 274 begin_priv();
DVSProductions 4:402a5c6b2457 275 backlight();
DVSProductions 4:402a5c6b2457 276 }
DVSProductions 0:5f9ddd9b7a33 277 void LiquidCrystal_I2C::setDelay(int cmdDelay, int charDelay) {}
DVSProductions 4:402a5c6b2457 278 uint8_t LiquidCrystal_I2C::status() {
DVSProductions 0:5f9ddd9b7a33 279 return 0;
DVSProductions 0:5f9ddd9b7a33 280 }
DVSProductions 4:402a5c6b2457 281 uint8_t LiquidCrystal_I2C::keypad() {
DVSProductions 0:5f9ddd9b7a33 282 return 0;
DVSProductions 0:5f9ddd9b7a33 283 }
DVSProductions 4:402a5c6b2457 284 uint8_t LiquidCrystal_I2C::init_bargraph(uint8_t graphtype) {
DVSProductions 0:5f9ddd9b7a33 285 return 0;
DVSProductions 0:5f9ddd9b7a33 286 }
DVSProductions 0:5f9ddd9b7a33 287 void LiquidCrystal_I2C::draw_horizontal_graph(uint8_t row, uint8_t column,
DVSProductions 4:402a5c6b2457 288 uint8_t len,
DVSProductions 4:402a5c6b2457 289 uint8_t pixel_col_end) {
DVSProductions 4:402a5c6b2457 290 }
DVSProductions 0:5f9ddd9b7a33 291 void LiquidCrystal_I2C::draw_vertical_graph(uint8_t row, uint8_t column,
DVSProductions 4:402a5c6b2457 292 uint8_t len,
DVSProductions 4:402a5c6b2457 293 uint8_t pixel_row_end) {
DVSProductions 4:402a5c6b2457 294 }
DVSProductions 0:5f9ddd9b7a33 295 void LiquidCrystal_I2C::setContrast(uint8_t new_val) {}