Hi,
I've found I often need to know how many columns and rows a lcd object has.
The LiquidCrystal class doesn't provide methods to obtain those informations, although adding them is very simple.
So I post here my 4 lines of code hoping this feature (not necessarily my code) gets included in a future library version.
diff -Bub original modified
--- LiquidCrystal.h 2010-05-26 11:28:04.000000000 +0200
+++ LiquidCrystal_mod.h 2010-05-26 10:25:03.000000000 +0200
@@ -77,6 +77,9 @@
void autoscroll();
void noAutoscroll();
- int getNumCols() { return _numcols; }
- int getNumRows() { return _numlines; }
void createChar(uint8_t, uint8_t[]);
void setCursor(uint8_t, uint8_t);
virtual void write(uint8_t);
@@ -98,7 +101,7 @@
uint8_t _initialized;
- uint8_t _numlines,_currline;
- uint8_t _numcols,_numlines,_currline;
};
#endif
--- LiquidCrystal.cpp 2010-05-26 11:28:15.000000000 +0200
+++ LiquidCrystal_mod.cpp 2010-05-26 10:11:37.000000000 +0200
@@ -86,6 +86,7 @@
if (lines > 1) {
_displayfunction |= LCD_2LINE;
}
- _numcols = cols;
_numlines = lines;
_currline = 0;