LCD:jhd1313m1:HD44780 Adding workaround of errata on init

HD44780 fails to initialize unsuccessfully without the workaround.

Adding workaround based on HD77480 datasheet for initialization
and software reset.

Signed-off-by: Akira Tsukamoto <akira.tsukamoto@linaro.org>
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Akira Tsukamoto 2016-05-31 17:17:43 +09:00 committed by Abhishek Malik
parent 33e2c03b48
commit 25c0f8ebb1

View File

@ -46,13 +46,19 @@ Jhd1313m1::Jhd1313m1(int bus, int lcdAddress, int rgbAddress)
": I2c.address() failed");
}
/* HD44780 requires writing three times to initialize or reset
according to the hardware errata on page 45 figure 23 of
the Hitachi HD44780 datasheet */
/* First try */
usleep(50000);
ret = command(LCD_FUNCTIONSET | LCD_2LINE);
if (!ret) {
ret = command(LCD_FUNCTIONSET | LCD_2LINE);
UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the LCD controller");
}
ret = command(LCD_FUNCTIONSET | LCD_8BITMODE);
/* Second try */
usleep(4500);
ret = command(LCD_FUNCTIONSET | LCD_8BITMODE);
/* Third try */
usleep(150);
ret = command(LCD_FUNCTIONSET | LCD_8BITMODE);
UPM_CHECK_MRAA_SUCCESS(ret, "Unable to initialise the LCD controller");
usleep(100);
ret = displayOn();