mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
Merge branch 'ide-1.5.x-lcd' of github.com:matthijskooijman/Arduino
This commit is contained in:
@ -10,6 +10,8 @@ ARDUINO 1.5.9
|
|||||||
* sam: added -MMD flag to let gcc produce dependency files (full rebuild on Arduino Due is now triggered only if needed)
|
* sam: added -MMD flag to let gcc produce dependency files (full rebuild on Arduino Due is now triggered only if needed)
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
* LiquidCrystal: added setRowOffsets function to support different LCD hardware configurations (Mark Sproul)
|
||||||
|
* LiquidCrystal: various improvements and optimizations (Matthijs Kooijman)
|
||||||
* Fixed PROGMEM error in Robot_Control/examples/explore/R06_Wheel_Calibration
|
* Fixed PROGMEM error in Robot_Control/examples/explore/R06_Wheel_Calibration
|
||||||
|
|
||||||
The following changes are included also in the Arduino IDE 1.0.7:
|
The following changes are included also in the Arduino IDE 1.0.7:
|
||||||
|
@ -87,10 +87,11 @@ void LiquidCrystal::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) {
|
|||||||
_displayfunction |= LCD_2LINE;
|
_displayfunction |= LCD_2LINE;
|
||||||
}
|
}
|
||||||
_numlines = lines;
|
_numlines = lines;
|
||||||
_currline = 0;
|
|
||||||
|
setRowOffsets(0x00, 0x40, 0x00 + cols, 0x40 + cols);
|
||||||
|
|
||||||
// for some 1 line displays you can select a 10 pixel high font
|
// 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;
|
_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! */
|
/********** high level commands, for the user! */
|
||||||
void LiquidCrystal::clear()
|
void LiquidCrystal::clear()
|
||||||
{
|
{
|
||||||
@ -172,12 +181,15 @@ void LiquidCrystal::home()
|
|||||||
|
|
||||||
void LiquidCrystal::setCursor(uint8_t col, uint8_t row)
|
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 ) {
|
if ( row >= _numlines ) {
|
||||||
row = _numlines-1; // we count rows starting w/0
|
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)
|
// Turn the display on/off (quickly)
|
||||||
|
@ -77,6 +77,7 @@ public:
|
|||||||
void autoscroll();
|
void autoscroll();
|
||||||
void noAutoscroll();
|
void noAutoscroll();
|
||||||
|
|
||||||
|
void setRowOffsets(int row1, int row2, int row3, int row4);
|
||||||
void createChar(uint8_t, uint8_t[]);
|
void createChar(uint8_t, uint8_t[]);
|
||||||
void setCursor(uint8_t, uint8_t);
|
void setCursor(uint8_t, uint8_t);
|
||||||
virtual size_t write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
@ -100,7 +101,8 @@ private:
|
|||||||
|
|
||||||
uint8_t _initialized;
|
uint8_t _initialized;
|
||||||
|
|
||||||
uint8_t _numlines,_currline;
|
uint8_t _numlines;
|
||||||
|
uint8_t _row_offsets[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user