Merge branch 'ide-1.5.x'

This commit is contained in:
Federico Fissore
2015-01-22 17:15:05 +01:00
15 changed files with 196 additions and 148 deletions

24
README.adoc Normal file
View File

@@ -0,0 +1,24 @@
= Liquid Crystal Library for Arduino =
This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs.
For more information about this library please visit us at
http://arduino.cc/en/Reference/LiquidCrystal
== License ==
Copyright (c) Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

View File

@@ -119,7 +119,7 @@ void setup() {
lcd.print("I ");
lcd.write(byte(0)); // when calling lcd.write() '0' must be cast as a byte
lcd.print(" Arduino! ");
lcd.write(1);
lcd.write((byte) 1);
}

1
keywords.txt Executable file → Normal file
View File

@@ -30,6 +30,7 @@ rightToLeft KEYWORD2
scrollDisplayLeft KEYWORD2
scrollDisplayRight KEYWORD2
createChar KEYWORD2
setRowOffsets KEYWORD2
#######################################
# Constants (LITERAL1)

9
library.properties Normal file
View File

@@ -0,0 +1,9 @@
name=LiquidCrystal
version=1.0
author=
maintainer=Arduino <info@arduino.cc>
sentence=Allows communication with alphanumerical liquid crystal displays (LCDs). For all Arduino boards.
paragraph=This library allows an Arduino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4 or 8 bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines).
category=Display
url=http://arduino.cc/en/Reference/LiquidCrystal
architectures=*

View File

@@ -87,10 +87,11 @@ void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
_displayfunction |= LCD_2LINE;
}
_numlines = lines;
_currline = 0;
setRowOffsets(0x00, 0x40, 0x00 + cols, 0x40 + cols);
// for some 1 line displays you can select a 10 pixel high font
if ((dotsize != 0) && (lines == 1)) {
if ((dotsize != LCD_5x8DOTS) && (lines == 1)) {
_displayfunction |= LCD_5x10DOTS;
}
@@ -157,6 +158,14 @@ void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
}
void LiquidCrystal::setRowOffsets(int row0, int row1, int row2, int row3)
{
_row_offsets[0] = row0;
_row_offsets[1] = row1;
_row_offsets[2] = row2;
_row_offsets[3] = row3;
}
/********** high level commands, for the user! */
void LiquidCrystal::clear()
{
@@ -172,12 +181,15 @@ void LiquidCrystal::home()
void LiquidCrystal::setCursor(uint8_t col, uint8_t row)
{
int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
const size_t max_lines = sizeof(_row_offsets) / sizeof(*_row_offsets);
if ( row >= max_lines ) {
row = max_lines - 1; // we count rows starting w/0
}
if ( row >= _numlines ) {
row = _numlines - 1; // we count rows starting w/0
}
command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
command(LCD_SETDDRAMADDR | (col + _row_offsets[row]));
}
// Turn the display on/off (quickly)

4
LiquidCrystal.h → src/LiquidCrystal.h Executable file → Normal file
View File

@@ -77,6 +77,7 @@ public:
void autoscroll();
void noAutoscroll();
void setRowOffsets(int row1, int row2, int row3, int row4);
void createChar(uint8_t, uint8_t[]);
void setCursor(uint8_t, uint8_t);
virtual size_t write(uint8_t);
@@ -100,7 +101,8 @@ private:
uint8_t _initialized;
uint8_t _numlines,_currline;
uint8_t _numlines;
uint8_t _row_offsets[4];
};
#endif