MIO183QT-9A LCD driver updated to support reading from the LCD. From Toby Duckwork

This commit is contained in:
Gregory Nutt 2014-04-16 12:17:35 -06:00
parent dc3ef08a66
commit f58767ce79
3 changed files with 32 additions and 12 deletions

View File

@ -7174,3 +7174,6 @@
* arch/arm/src/sama5/sam_adc.c, sam_can.c, sam_emac.c, sam_gmac.c,
sam_ssc.c, and sam_twi.c: If running from SDRAM, then BOARD_MCK_FREQUENCY
is not a constant and cannot be used in conditional compilation (2014-4-16).
* drivers/lcd/mio283qt9a.c and include/nuttx/lcd/mio283qt9a.h: Update the
MIO183QT-9A LCD driver to support reading from the LCD. From Toby
Duckworth (2014-4-16).

View File

@ -286,18 +286,32 @@ static uint16_t mio283qt9a_readreg(FAR struct mio283qt9a_lcd_s *lcd, uint8_t reg
#endif
/**************************************************************************************
* Name: mio283qt9a_gramselect
* Name: mio283qt9a_gramselect_write
*
* Description:
* Setup to read or write multiple pixels to the GRAM memory
* Setup to write multiple pixels to the GRAM memory
*
**************************************************************************************/
static inline void mio283qt9a_gramselect(FAR struct mio283qt9a_lcd_s *lcd)
static inline void mio283qt9a_gramselect_write(FAR struct mio283qt9a_lcd_s *lcd)
{
lcd->index(lcd, 0x2c);
}
/**************************************************************************************
* Name: mio283qt9a_gramselect_read
*
* Description:
* Setup to read multiple pixels to the GRAM memory
*
**************************************************************************************/
static inline void mio283qt9a_gramselect_read(FAR struct mio283qt9a_lcd_s *lcd)
{
lcd->index(lcd, 0x2e);
lcd->readgram(lcd);
}
/**************************************************************************************
* Name: mio283qt9a_gramwrite
*
@ -352,7 +366,7 @@ static inline uint16_t mio283qt9a_gramread(FAR struct mio283qt9a_lcd_s *lcd,
{
/* Read the value (GRAM register already selected) */
return lcd->read(lcd);
return lcd->readgram(lcd);
}
#endif
@ -446,7 +460,7 @@ static int mio283qt9a_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *
/* Write the run to GRAM. */
mio283qt9a_setarea(lcd, col, row, col + npixels - 1, row);
mio283qt9a_gramselect(lcd);
mio283qt9a_gramselect_write(lcd);
for (i = 0; i < npixels; i++)
{
@ -481,12 +495,12 @@ static int mio283qt9a_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer
FAR struct mio283qt9a_dev_s *priv = &g_lcddev;
FAR struct mio283qt9a_lcd_s *lcd = priv->lcd;
FAR uint16_t *dest = (FAR uint16_t*)buffer;
uint16_t accum;
uint16_t accum, test;
int i;
/* Buffer must be provided and aligned to a 16-bit address boundary */
lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
lcdvdbg("mio283qt9a_getrun row: %d col: %d npixels: %d\n", row, col, npixels);
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
/* Read the run from GRAM. */
@ -498,7 +512,7 @@ static int mio283qt9a_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer
/* Red the run fram GRAM. */
mio283qt9a_setarea(lcd, col, row, col + npixels - 1, row);
mio283qt9a_gramselect(lcd);
mio283qt9a_gramselect_read(lcd);
/* Prime the pump for unaligned read data */
@ -506,7 +520,9 @@ static int mio283qt9a_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer
for (i = 0; i < npixels; i++)
{
*dest++ = mio283qt9a_gramread(lcd, &accum);
test= mio283qt9a_gramread(lcd, &accum);
// lcddbg("read 0x%04x\n", test);
*dest++ = test;
}
/* De-select the LCD */
@ -891,7 +907,7 @@ void mio283qt9a_clear(FAR struct lcd_dev_s *dev, uint16_t color)
/* Prepare to write GRAM data */
mio283qt9a_gramselect(lcd);
mio283qt9a_gramselect_write(lcd);
/* Copy color into all of GRAM. Orientation does not matter in this case. */

View File

@ -52,7 +52,7 @@
* Pre-processor Definitions
**************************************************************************************/
/* Configuration **********************************************************************/
/* CONFIG_LCD_MIO283QT9A - Enables support for the MIO283QT2-based LCD.
/* CONFIG_LCD_MIO283QT9A - Enables support for the MIO283QT9A-based LCD.
* CONFIG_LCD_NOGETRUN
* NX components need to know if it can read from the LCD or not. If reading from the
* LCD is supported then some graphic operations can be improved. Default: Supported
@ -76,7 +76,7 @@
struct mio283qt9a_lcd_s
{
/* Interface to write to a MIO283QT2 register.
/* Interface to write to a MIO283QT9A register.
*
* - select Select the device (as necessary). The meaning of selecting (and
* and deselecting) is not defined. select() will be called before
@ -94,6 +94,7 @@ struct mio283qt9a_lcd_s
void (*index)(FAR struct mio283qt9a_lcd_s *dev, uint8_t index);
#ifndef CONFIG_LCD_NOGETRUN
uint16_t (*read)(FAR struct mio283qt9a_lcd_s *dev);
uint16_t (*readgram)(FAR struct mio283qt9a_lcd_s *dev);
#endif
void (*write)(FAR struct mio283qt9a_lcd_s *dev, uint16_t value);
void (*backlight)(FAR struct mio283qt9a_lcd_s *dev, int power);