Add lcd_dev_s pointer to lcd_planeinfo_s

In order to support multiple LCD instances per board, add a pointer from
lcd_planeinfo_s to the lcd_dev_s which it belongs to.  Also enhance the
putrun, getrun, putarea and getarea methods to pass through the
lcd_dev_s pointer to the respective device driver.

Port all LCD device drivers to this lcd_planeinfo_s extension.

Enhance SSD1306 driver to support multiple LCDs.

Signed-off-by: Michael Jung <michael.jung@secore.ly>
This commit is contained in:
Michael Jung
2022-06-17 12:17:18 +02:00
committed by Xiang Xiao
parent f68a5f0913
commit 9140693567
47 changed files with 589 additions and 629 deletions
+18 -14
View File
@@ -102,13 +102,13 @@ struct sim_dev_s
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int sim_putrun(fb_coord_t row, fb_coord_t col, static int sim_putrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels); const uint8_t *buffer, size_t npixels);
static int sim_putarea(fb_coord_t row_start, fb_coord_t row_end, static int sim_putarea(struct lcd_dev_s *dev, fb_coord_t row_start,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t row_end, fb_coord_t col_start,
const uint8_t *buffer); fb_coord_t col_end, const uint8_t *buffer);
static int sim_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sim_getrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
size_t npixels); uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -217,6 +217,7 @@ static struct sim_dev_s g_lcddev =
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The LCD device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -225,10 +226,10 @@ static struct sim_dev_s g_lcddev =
* *
****************************************************************************/ ****************************************************************************/
static int sim_putrun(fb_coord_t row, fb_coord_t col, static int sim_putrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels) const uint8_t *buffer, size_t npixels)
{ {
lcdinfo("row: %d col: %d npixels: %d\n", row, col, npixels); lcdinfo("row: %d col: %d npixels: %zu\n", row, col, npixels);
#ifdef CONFIG_SIM_X11FB #ifdef CONFIG_SIM_X11FB
memcpy(&g_planeinfo.buffer[row * g_stride + col * (g_planeinfo.bpp / 8)], memcpy(&g_planeinfo.buffer[row * g_stride + col * (g_planeinfo.bpp / 8)],
@@ -244,6 +245,7 @@ static int sim_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The LCD device
* row_start - Starting row to write to (range: 0 <= row < yres) * row_start - Starting row to write to (range: 0 <= row < yres)
* row_end - Ending row to write to (range: row_start <= row < yres) * row_end - Ending row to write to (range: row_start <= row < yres)
* col_start - Starting column to write to (range: 0 <= col <= xres) * col_start - Starting column to write to (range: 0 <= col <= xres)
@@ -253,9 +255,9 @@ static int sim_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int sim_putarea(fb_coord_t row_start, fb_coord_t row_end, static int sim_putarea(struct lcd_dev_s *dev, fb_coord_t row_start,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t row_end, fb_coord_t col_start,
const uint8_t *buffer) fb_coord_t col_end, const uint8_t *buffer)
{ {
fb_coord_t row; fb_coord_t row;
size_t rows; size_t rows;
@@ -301,6 +303,7 @@ static int sim_putarea(fb_coord_t row_start, fb_coord_t row_end,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The LCD device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -309,10 +312,10 @@ static int sim_putarea(fb_coord_t row_start, fb_coord_t row_end,
* *
****************************************************************************/ ****************************************************************************/
static int sim_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sim_getrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
size_t npixels) uint8_t *buffer, size_t npixels)
{ {
lcdinfo("row: %d col: %d npixels: %d\n", row, col, npixels); lcdinfo("row: %d col: %d npixels: %zu\n", row, col, npixels);
return -ENOSYS; return -ENOSYS;
} }
@@ -350,6 +353,7 @@ static int sim_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+9 -11
View File
@@ -96,11 +96,10 @@
****************************************************************************/ ****************************************************************************/
static int init_graph_vga(int width, int height, int chain4); static int init_graph_vga(int width, int height, int chain4);
static int vga_putrun(fb_coord_t row, static int vga_putrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
fb_coord_t col, const uint8_t *buffer, const uint8_t *buffer, size_t npixels);
size_t npixels); static int vga_getrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
static int vga_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, uint8_t *buffer, size_t npixels);
size_t npixels);
static int vga_getvideoinfo(struct lcd_dev_s *dev, static int vga_getvideoinfo(struct lcd_dev_s *dev,
struct fb_videoinfo_s *vinfo); struct fb_videoinfo_s *vinfo);
static int vga_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno, static int vga_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
@@ -414,16 +413,15 @@ static int init_graph_vga(int width, int height, int chain4)
return 0; return 0;
} }
static int vga_putrun(fb_coord_t row, static int vga_putrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
fb_coord_t col, const uint8_t *buffer, const uint8_t *buffer, size_t npixels)
size_t npixels)
{ {
memcpy(&g_pscreen[row*VGA_XRES + col], buffer, npixels); memcpy(&g_pscreen[row*VGA_XRES + col], buffer, npixels);
return OK; return OK;
} }
static int vga_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int vga_getrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
size_t npixels) uint8_t *buffer, size_t npixels)
{ {
memcpy(buffer, &g_pscreen[row*VGA_XRES + col], npixels); memcpy(buffer, &g_pscreen[row*VGA_XRES + col], npixels);
return OK; return OK;
@@ -445,8 +443,8 @@ static int vga_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
pinfo->putrun = vga_putrun; /* Put a run into LCD memory */ pinfo->putrun = vga_putrun; /* Put a run into LCD memory */
pinfo->getrun = vga_getrun; /* Get a run from LCD memory */ pinfo->getrun = vga_getrun; /* Get a run from LCD memory */
pinfo->buffer = g_runbuffer; /* Run scratch buffer */ pinfo->buffer = g_runbuffer; /* Run scratch buffer */
pinfo->display = 0;
pinfo->bpp = VGA_BPP; /* Bits-per-pixel */ pinfo->bpp = VGA_BPP; /* Bits-per-pixel */
pinfo->dev = dev; /* LCD device */
return OK; return OK;
} }
+12 -4
View File
@@ -313,10 +313,12 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels); size_t npixels);
static int sam_getrun(fb_coord_t row, fb_coord_t col, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -583,6 +585,7 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - LCD device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -591,7 +594,8 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg)
* *
****************************************************************************/ ****************************************************************************/
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
@@ -654,6 +658,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - LCD device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -662,7 +667,9 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int sam_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
uint16_t *run = (uint16_t *)buffer; uint16_t *run = (uint16_t *)buffer;
@@ -746,6 +753,7 @@ static int sam_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+10 -4
View File
@@ -295,10 +295,12 @@ static int sam_poweroff(struct sam_dev_s *priv);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels); size_t npixels);
static int sam_getrun(fb_coord_t row, fb_coord_t col, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -666,7 +668,8 @@ static int sam_poweroff(struct sam_dev_s *priv)
* *
****************************************************************************/ ****************************************************************************/
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
@@ -729,7 +732,9 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int sam_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
uint8_t value[2]; uint8_t value[2];
@@ -819,6 +824,7 @@ static int sam_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+10 -4
View File
@@ -302,10 +302,12 @@ static int sam_poweroff(struct sam_dev_s *priv);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels); size_t npixels);
static int sam_getrun(fb_coord_t row, fb_coord_t col, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -704,7 +706,8 @@ static int sam_poweroff(struct sam_dev_s *priv)
* *
****************************************************************************/ ****************************************************************************/
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
@@ -763,7 +766,9 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int sam_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
#if defined(CONFIG_SAM4EEK_LCD_RGB565) #if defined(CONFIG_SAM4EEK_LCD_RGB565)
@@ -840,6 +845,7 @@ static int sam_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+18 -7
View File
@@ -373,11 +373,14 @@ static int sam_lcd_rxtransfer(struct sam_dev_s *priv,
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels); size_t npixels);
static int sam_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sam_getrun(struct lcd_dev_s *dev,
size_t npixels); fb_coord_t row, fb_coord_t col,
uint8_t *buffer,
size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -1117,6 +1120,7 @@ static int sam_lcd_rxtransfer(struct sam_dev_s *priv,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - LCD device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -1125,8 +1129,10 @@ static int sam_lcd_rxtransfer(struct sam_dev_s *priv,
* *
****************************************************************************/ ****************************************************************************/
static int sam_putrun(fb_coord_t row, fb_coord_t col, static int sam_putrun(struct lcd_dev_s *dev,
const uint8_t *buffer, size_t npixels) fb_coord_t row, fb_coord_t col,
const uint8_t *buffer,
size_t npixels)
{ {
struct sam_dev_s *priv = &g_lcddev; struct sam_dev_s *priv = &g_lcddev;
int ret; int ret;
@@ -1158,6 +1164,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - LCD device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -1166,7 +1173,9 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int sam_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int sam_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
struct sam_dev_s *priv = &g_lcddev; struct sam_dev_s *priv = &g_lcddev;
@@ -1226,6 +1235,7 @@ static int sam_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
@@ -1681,7 +1691,8 @@ void sam_lcdclear(uint16_t color)
for (row = 0; row < SAM_YRES; row++) for (row = 0; row < SAM_YRES; row++)
{ {
ret = sam_putrun(row, 0, (const uint8_t *)g_runbuffer, SAM_XRES); ret = sam_putrun(&priv->dev, row, 0, (const uint8_t *)g_runbuffer,
SAM_XRES);
if (ret < 0) if (ret < 0)
{ {
lcderr("ERROR: sam_putrun failed on row %d: %d\n", row, ret); lcderr("ERROR: sam_putrun failed on row %d: %d\n", row, ret);
@@ -118,9 +118,9 @@ static void lcd_clear(uint16_t color);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int lcd_putrun(fb_coord_t row, fb_coord_t col, static int lcd_putrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels); const uint8_t *buffer, size_t npixels);
static int lcd_getrun(fb_coord_t row, fb_coord_t col, static int lcd_getrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels); uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -428,9 +428,8 @@ static void lcd_setcursor(unsigned int x, unsigned int y)
* *
****************************************************************************/ ****************************************************************************/
static int lcd_putrun(fb_coord_t row, fb_coord_t col, static int lcd_putrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer, size_t npixels)
size_t npixels)
{ {
int i; int i;
const uint16_t *src = (const uint16_t *) buffer; const uint16_t *src = (const uint16_t *) buffer;
@@ -466,8 +465,8 @@ static int lcd_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int lcd_getrun(fb_coord_t row, fb_coord_t col, uint8_t *buffer, static int lcd_getrun(struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
size_t npixels) uint8_t *buffer, size_t npixels)
{ {
uint16_t *dest = (uint16_t *) buffer; uint16_t *dest = (uint16_t *) buffer;
int i; int i;
@@ -528,6 +527,7 @@ static int lcd_getplaneinfo(struct lcd_dev_s *dev, unsigned int planeno,
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+11 -4
View File
@@ -417,9 +417,11 @@ static void stm32_setcursor(struct stm32_dev_s *priv,
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int stm32_putrun(fb_coord_t row, fb_coord_t col, static int stm32_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels); const uint8_t *buffer, size_t npixels);
static int stm32_getrun(fb_coord_t row, fb_coord_t col, static int stm32_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels); uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -843,6 +845,7 @@ static void stm32_dumprun(const char *msg,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - LCD device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -851,7 +854,8 @@ static void stm32_dumprun(const char *msg,
* *
****************************************************************************/ ****************************************************************************/
static int stm32_putrun(fb_coord_t row, fb_coord_t col, static int stm32_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels) const uint8_t *buffer, size_t npixels)
{ {
struct stm32_dev_s *priv = &g_lcddev; struct stm32_dev_s *priv = &g_lcddev;
@@ -953,6 +957,7 @@ static int stm32_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - LCD device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -961,7 +966,8 @@ static int stm32_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int stm32_getrun(fb_coord_t row, fb_coord_t col, static int stm32_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels) uint8_t *buffer, size_t npixels)
{ {
struct stm32_dev_s *priv = &g_lcddev; struct stm32_dev_s *priv = &g_lcddev;
@@ -1126,6 +1132,7 @@ static int stm32_getplaneinfo(struct lcd_dev_s *dev,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+11 -4
View File
@@ -345,10 +345,12 @@ static void stm3210e_setcursor(uint16_t col, uint16_t row);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, static int stm3210e_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels); size_t npixels);
static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, static int stm3210e_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -704,6 +706,7 @@ static void stm3210e_dumprun(const char *msg, uint16_t *run,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -712,7 +715,8 @@ static void stm3210e_dumprun(const char *msg, uint16_t *run,
* *
****************************************************************************/ ****************************************************************************/
static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, static int stm3210e_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
@@ -798,6 +802,7 @@ static int stm3210e_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -806,7 +811,8 @@ static int stm3210e_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, static int stm3210e_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
@@ -959,6 +965,7 @@ static int stm3210e_getplaneinfo(struct lcd_dev_s *dev,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+12 -7
View File
@@ -289,9 +289,11 @@ static void stm3220g_setcursor(uint16_t col, uint16_t row);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int stm3220g_putrun(fb_coord_t row, fb_coord_t col, static int stm3220g_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels); const uint8_t *buffer, size_t npixels);
static int stm3220g_getrun(fb_coord_t row, fb_coord_t col, static int stm3220g_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels); uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -543,6 +545,7 @@ static void stm3220g_dumprun(const char *msg,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The LCD device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -551,10 +554,9 @@ static void stm3220g_dumprun(const char *msg,
* *
****************************************************************************/ ****************************************************************************/
static int stm3220g_putrun(fb_coord_t row, static int stm3220g_putrun(struct lcd_dev_s *dev,
fb_coord_t col, fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, const uint8_t *buffer, size_t npixels)
size_t npixels)
{ {
const uint16_t *src = (const uint16_t *)buffer; const uint16_t *src = (const uint16_t *)buffer;
int i; int i;
@@ -665,6 +667,7 @@ static int stm3220g_putrun(fb_coord_t row,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The LCD device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -673,7 +676,8 @@ static int stm3220g_putrun(fb_coord_t row,
* *
****************************************************************************/ ****************************************************************************/
static int stm3220g_getrun(fb_coord_t row, fb_coord_t col, static int stm3220g_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels) uint8_t *buffer, size_t npixels)
{ {
uint16_t *dest = (uint16_t *)buffer; uint16_t *dest = (uint16_t *)buffer;
@@ -838,6 +842,7 @@ static int stm3220g_getplaneinfo(struct lcd_dev_s *dev,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+12 -6
View File
@@ -289,9 +289,11 @@ static void stm3240g_setcursor(uint16_t col, uint16_t row);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, static int stm3240g_putrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
const uint8_t *buffer, size_t npixels); const uint8_t *buffer, size_t npixels);
static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, static int stm3240g_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels); uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -542,6 +544,7 @@ static void stm3240g_dumprun(const char *msg,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -550,9 +553,9 @@ static void stm3240g_dumprun(const char *msg,
* *
****************************************************************************/ ****************************************************************************/
static int stm3240g_putrun(fb_coord_t row, fb_coord_t col, static int stm3240g_putrun(struct lcd_dev_s *dev,
const uint8_t *buffer, fb_coord_t row, fb_coord_t col,
size_t npixels) const uint8_t *buffer, size_t npixels)
{ {
const uint16_t *src = (const uint16_t *)buffer; const uint16_t *src = (const uint16_t *)buffer;
int i; int i;
@@ -665,6 +668,7 @@ static int stm3240g_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -673,7 +677,8 @@ static int stm3240g_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int stm3240g_getrun(fb_coord_t row, fb_coord_t col, static int stm3240g_getrun(struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
uint8_t *buffer, size_t npixels) uint8_t *buffer, size_t npixels)
{ {
uint16_t *dest = (uint16_t *)buffer; uint16_t *dest = (uint16_t *)buffer;
@@ -838,6 +843,7 @@ static int stm3240g_getplaneinfo(struct lcd_dev_s *dev,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+8
View File
@@ -360,6 +360,14 @@ config LCD_SSD1306
if LCD_SSD1306 if LCD_SSD1306
config SSD1306_NUMDEVS
int "Number of SSD1306 displays"
range 1 256
default 1
---help---
Specifies the number of SSD1306 devices present on the respective board.
Currently only multiple displays of the same type are supported.
choice choice
prompt "SSD1306 Interface" prompt "SSD1306 Interface"
default LCD_SSD1306_SPI default LCD_SSD1306_SPI
+20 -10
View File
@@ -198,13 +198,16 @@ static void gc9a01_fill(FAR struct gc9a01_dev_s *dev, uint16_t color);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int gc9a01_putrun(fb_coord_t row, fb_coord_t col, static int gc9a01_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
static int gc9a01_putarea(fb_coord_t row_start, fb_coord_t row_end, static int gc9a01_putarea(FAR struct lcd_dev_s *dev,
fb_coord_t row_start, fb_coord_t row_end,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t col_start, fb_coord_t col_end,
FAR const uint8_t *buffer); FAR const uint8_t *buffer);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int gc9a01_getrun(fb_coord_t row, fb_coord_t col, static int gc9a01_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels); FAR uint8_t *buffer, size_t npixels);
#endif #endif
@@ -597,6 +600,7 @@ static void gc9a01_fill(FAR struct gc9a01_dev_s *dev, uint16_t color)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -605,10 +609,11 @@ static void gc9a01_fill(FAR struct gc9a01_dev_s *dev, uint16_t color)
* *
****************************************************************************/ ****************************************************************************/
static int gc9a01_putrun(fb_coord_t row, fb_coord_t col, static int gc9a01_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
FAR struct gc9a01_dev_s *priv = &g_lcddev; FAR struct gc9a01_dev_s *priv = (FAR struct gc9a01_dev_s *)dev;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -626,6 +631,7 @@ static int gc9a01_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to write a partial area to the LCD: * This method can be used to write a partial area to the LCD:
* *
* dev - The lcd device
* row_start - Starting row to write to (range: 0 <= row < yres) * row_start - Starting row to write to (range: 0 <= row < yres)
* row_end - Ending row to write to (range: row_start <= row < yres) * row_end - Ending row to write to (range: row_start <= row < yres)
* col_start - Starting column to write to (range: 0 <= col <= xres) * col_start - Starting column to write to (range: 0 <= col <= xres)
@@ -635,11 +641,12 @@ static int gc9a01_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int gc9a01_putarea(fb_coord_t row_start, fb_coord_t row_end, static int gc9a01_putarea(FAR struct lcd_dev_s *dev,
fb_coord_t row_start, fb_coord_t row_end,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t col_start, fb_coord_t col_end,
FAR const uint8_t *buffer) FAR const uint8_t *buffer)
{ {
FAR struct gc9a01_dev_s *priv = &g_lcddev; FAR struct gc9a01_dev_s *priv = (FAR struct gc9a01_dev_s *)dev;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
ginfo("row_start: %d row_end: %d col_start: %d col_end: %d\n", ginfo("row_start: %d row_end: %d col_start: %d col_end: %d\n",
@@ -660,6 +667,7 @@ static int gc9a01_putarea(fb_coord_t row_start, fb_coord_t row_end,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -669,10 +677,11 @@ static int gc9a01_putarea(fb_coord_t row_start, fb_coord_t row_end,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int gc9a01_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int gc9a01_getrun(FAR struct lcd_dev_s *dev,
size_t npixels) fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels)
{ {
FAR struct gc9a01_dev_s *priv = &g_lcddev; FAR struct gc9a01_dev_s *priv = (FAR struct gc9a01_dev_s *)dev;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -731,6 +740,7 @@ static int gc9a01_getplaneinfo(FAR struct lcd_dev_s *dev,
#endif #endif
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = priv->bpp; /* Bits-per-pixel */ pinfo->bpp = priv->bpp; /* Bits-per-pixel */
pinfo->dev = dev; /* The lcd device */
return OK; return OK;
} }
+15 -8
View File
@@ -186,11 +186,13 @@ static void ili9225_fill(FAR struct ili9225_dev_s *dev, uint16_t color);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int ili9225_putrun(fb_coord_t row, fb_coord_t col, static int ili9225_putrun(FAR struct lcd_dev_s *dev,
FAR const uint8_t *buffer, size_t npixels); fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int ili9225_getrun(fb_coord_t row, fb_coord_t col, static int ili9225_getrun(FAR struct lcd_dev_s *dev,
FAR uint8_t *buffer, size_t npixels); fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels);
#endif #endif
/* LCD Configuration */ /* LCD Configuration */
@@ -547,6 +549,7 @@ static void ili9225_fill(FAR struct ili9225_dev_s *dev, uint16_t color)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -555,10 +558,11 @@ static void ili9225_fill(FAR struct ili9225_dev_s *dev, uint16_t color)
* *
****************************************************************************/ ****************************************************************************/
static int ili9225_putrun(fb_coord_t row, fb_coord_t col, static int ili9225_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
FAR struct ili9225_dev_s *priv = &g_lcddev; FAR struct ili9225_dev_s *priv = (FAR struct ili9225_dev_s *)dev;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -576,6 +580,7 @@ static int ili9225_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -585,10 +590,11 @@ static int ili9225_putrun(fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int ili9225_getrun(fb_coord_t row, fb_coord_t col, static int ili9225_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels) FAR uint8_t *buffer, size_t npixels)
{ {
FAR struct ili9225_dev_s *priv = &g_lcddev; FAR struct ili9225_dev_s *priv = (FAR struct ili9225_dev_s *)dev;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -646,6 +652,7 @@ static int ili9225_getplaneinfo(FAR struct lcd_dev_s *dev,
#endif #endif
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = priv->bpp; /* Bits-per-pixel */ pinfo->bpp = priv->bpp; /* Bits-per-pixel */
pinfo->dev = dev; /* The lcd device */
return OK; return OK;
} }
+19 -130
View File
@@ -366,16 +366,6 @@ struct ili9340_dev_s
FAR struct ili9340_lcd_s *lcd; FAR struct ili9340_lcd_s *lcd;
/* Driver specific putrun function */
int (*putrun)(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN
/* Driver specific getrun function */
int (*getrun)(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels);
#endif
/* Run buffer for the device */ /* Run buffer for the device */
uint16_t *runbuffer; uint16_t *runbuffer;
@@ -408,35 +398,13 @@ static inline uint16_t ili9340_getyres(FAR struct ili9340_dev_s *dev);
/* lcd data transfer methods */ /* lcd data transfer methods */
static int ili9340_putrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9340_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t * buffer, size_t npixels); fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int ili9340_getrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9340_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t * buffer, size_t npixels); fb_coord_t col, FAR uint8_t *buffer,
#endif size_t npixels);
/* Definition of the public visible getrun / putrun methods
* each for a single LCD driver
*/
#ifdef CONFIG_LCD_ILI9340_IFACE0
static int ili9340_putrun0(fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixsels);
#endif
#ifdef CONFIG_LCD_ILI9340_IFACE1
static int ili9340_putrun1(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixsels);
#endif
#ifndef CONFIG_LCD_NOGETRUN
# ifdef CONFIG_LCD_ILI9340_IFACE0
static int ili9340_getrun0(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixsels);
# endif
# ifdef CONFIG_LCD_ILI9340_IFACE1
static int ili9340_getrun1(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixsels);
# endif
#endif #endif
/* lcd configuration */ /* lcd configuration */
@@ -472,10 +440,6 @@ static struct ili9340_dev_s g_lcddev[CONFIG_LCD_ILI9340_NINTERFACES] =
#ifdef CONFIG_LCD_ILI9340_IFACE0 #ifdef CONFIG_LCD_ILI9340_IFACE0
{ {
.lcd = 0, .lcd = 0,
.putrun = ili9340_putrun0,
# ifndef CONFIG_LCD_NOGETRUN
.getrun = ili9340_getrun0,
# endif
.runbuffer = g_runbuffer0, .runbuffer = g_runbuffer0,
.orient = ILI9340_IFACE0_ORIENT, .orient = ILI9340_IFACE0_ORIENT,
.pxfmt = ILI9340_IFACE0_PXFMT, .pxfmt = ILI9340_IFACE0_PXFMT,
@@ -486,10 +450,6 @@ static struct ili9340_dev_s g_lcddev[CONFIG_LCD_ILI9340_NINTERFACES] =
#ifdef CONFIG_LCD_ILI9340_IFACE1 #ifdef CONFIG_LCD_ILI9340_IFACE1
{ {
.lcd = 0, .lcd = 0,
.putrun = ili9340_putrun1,
# ifndef CONFIG_LCD_NOGETRUN
.getrun = ili9340_getrun1,
# endif
.runbuffer = g_runbuffer1, .runbuffer = g_runbuffer1,
.orient = ILI9340_IFACE1_ORIENT, .orient = ILI9340_IFACE1_ORIENT,
.pxfmt = ILI9340_IFACE1_PXFMT, .pxfmt = ILI9340_IFACE1_PXFMT,
@@ -600,7 +560,7 @@ static void ili9340_selectarea(FAR struct ili9340_lcd_s *lcd,
* Write a partial raster line to the LCD. * Write a partial raster line to the LCD.
* *
* Parameters: * Parameters:
* devno - Number of lcd device * lcd_dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -614,10 +574,11 @@ static void ili9340_selectarea(FAR struct ili9340_lcd_s *lcd,
* *
****************************************************************************/ ****************************************************************************/
static int ili9340_putrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9340_putrun(FAR struct lcd_dev_s *lcd_dev, fb_coord_t row,
FAR const uint8_t * buffer, size_t npixels) fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels)
{ {
FAR struct ili9340_dev_s *dev = &g_lcddev[devno]; FAR struct ili9340_dev_s *dev = (FAR struct ili9340_dev_s *)lcd_dev;
FAR struct ili9340_lcd_s *lcd = dev->lcd; FAR struct ili9340_lcd_s *lcd = dev->lcd;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
@@ -660,7 +621,7 @@ static int ili9340_putrun(int devno, fb_coord_t row, fb_coord_t col,
* Read a partial raster line from the LCD. * Read a partial raster line from the LCD.
* *
* Parameter: * Parameter:
* devno - Number of the lcd device * lcd_dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -675,10 +636,11 @@ static int ili9340_putrun(int devno, fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
# ifndef CONFIG_LCD_NOGETRUN # ifndef CONFIG_LCD_NOGETRUN
static int ili9340_getrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9340_getrun(FAR struct lcd_dev_s *lcd_dev, fb_coord_t row,
FAR uint8_t * buffer, size_t npixels) fb_coord_t col, FAR uint8_t *buffer,
size_t npixels)
{ {
FAR struct ili9340_dev_s *dev = &g_lcddev[devno]; FAR struct ili9340_dev_s *dev = (FAR struct ili9340_dev_s *)lcd_dev;
FAR struct ili9340_lcd_s *lcd = dev->lcd; FAR struct ili9340_lcd_s *lcd = dev->lcd;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
@@ -813,80 +775,6 @@ static int ili9340_hwinitialize(FAR struct ili9340_dev_s *dev)
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: ili9340_putrunx
*
* Description:
* Write a partial raster line to the LCD.
*
* Parameter:
* row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD
* npixels - The number of pixels to write to the
* (range: 0 < npixels <= xres-col)
*
* Returned Value:
*
* On success - OK
* On error - -EINVAL
*
****************************************************************************/
#ifdef CONFIG_LCD_ILI9340_IFACE0
static int ili9340_putrun0(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels)
{
return ili9340_putrun(0, row, col, buffer, npixels);
}
#endif
#ifdef CONFIG_LCD_ILI9340_IFACE1
static int ili9340_putrun1(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels)
{
return ili9340_putrun(1, row, col, buffer, npixels);
}
#endif
/****************************************************************************
* Name: ili9340_getrunx
*
* Description:
* Read a partial raster line from the LCD.
*
* Parameter:
* row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read from (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD
* npixels - The number of pixels to read from the
* (range: 0 < npixels <= xres-col)
*
* Returned Value:
*
* On success - OK
* On error - -EINVAL
*
****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN
# ifdef CONFIG_LCD_ILI9340_IFACE0
static int ili9340_getrun0(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels)
{
return ili9340_getrun(0, row, col, buffer, npixels);
}
# endif
# ifdef CONFIG_LCD_ILI9340_IFACE1
static int ili9340_getrun1(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels)
{
return ili9340_getrun(1, row, col, buffer, npixels);
}
# endif
#endif
/**************************************************************************** /****************************************************************************
* Name: ili9340_getvideoinfo * Name: ili9340_getvideoinfo
* *
@@ -951,12 +839,13 @@ static int ili9340_getplaneinfo(FAR struct lcd_dev_s *dev,
{ {
FAR struct ili9340_dev_s *priv = (FAR struct ili9340_dev_s *)dev; FAR struct ili9340_dev_s *priv = (FAR struct ili9340_dev_s *)dev;
pinfo->putrun = priv->putrun; pinfo->putrun = ili9340_putrun;
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
pinfo->getrun = priv->getrun; pinfo->getrun = ili9340_getrun;
#endif #endif
pinfo->bpp = priv->bpp; pinfo->bpp = priv->bpp;
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->dev = dev;
lcdinfo("planeno: %d bpp: %d\n", planeno, pinfo->bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, pinfo->bpp);
+19 -130
View File
@@ -366,16 +366,6 @@ struct ili9341_dev_s
FAR struct ili9341_lcd_s *lcd; FAR struct ili9341_lcd_s *lcd;
/* Driver specific putrun function */
int (*putrun)(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN
/* Driver specific getrun function */
int (*getrun)(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels);
#endif
/* Run buffer for the device */ /* Run buffer for the device */
uint16_t *runbuffer; uint16_t *runbuffer;
@@ -408,35 +398,13 @@ static inline uint16_t ili9341_getyres(FAR struct ili9341_dev_s *dev);
/* lcd data transfer methods */ /* lcd data transfer methods */
static int ili9341_putrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9341_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t * buffer, size_t npixels); fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int ili9341_getrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9341_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t * buffer, size_t npixels); fb_coord_t col, FAR uint8_t * buffer,
#endif size_t npixels);
/* Definition of the public visible getrun / putrun methods
* each for a single LCD driver
*/
#ifdef CONFIG_LCD_ILI9341_IFACE0
static int ili9341_putrun0(fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixsels);
#endif
#ifdef CONFIG_LCD_ILI9341_IFACE1
static int ili9341_putrun1(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixsels);
#endif
#ifndef CONFIG_LCD_NOGETRUN
# ifdef CONFIG_LCD_ILI9341_IFACE0
static int ili9341_getrun0(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixsels);
# endif
# ifdef CONFIG_LCD_ILI9341_IFACE1
static int ili9341_getrun1(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixsels);
# endif
#endif #endif
/* lcd configuration */ /* lcd configuration */
@@ -472,10 +440,6 @@ static struct ili9341_dev_s g_lcddev[CONFIG_LCD_ILI9341_NINTERFACES] =
#ifdef CONFIG_LCD_ILI9341_IFACE0 #ifdef CONFIG_LCD_ILI9341_IFACE0
{ {
.lcd = 0, .lcd = 0,
.putrun = ili9341_putrun0,
# ifndef CONFIG_LCD_NOGETRUN
.getrun = ili9341_getrun0,
# endif
.runbuffer = g_runbuffer0, .runbuffer = g_runbuffer0,
.orient = ILI9341_IFACE0_ORIENT, .orient = ILI9341_IFACE0_ORIENT,
.pxfmt = ILI9341_IFACE0_PXFMT, .pxfmt = ILI9341_IFACE0_PXFMT,
@@ -486,10 +450,6 @@ static struct ili9341_dev_s g_lcddev[CONFIG_LCD_ILI9341_NINTERFACES] =
#ifdef CONFIG_LCD_ILI9341_IFACE1 #ifdef CONFIG_LCD_ILI9341_IFACE1
{ {
.lcd = 0, .lcd = 0,
.putrun = ili9341_putrun1,
# ifndef CONFIG_LCD_NOGETRUN
.getrun = ili9341_getrun1,
# endif
.runbuffer = g_runbuffer1, .runbuffer = g_runbuffer1,
.orient = ILI9341_IFACE1_ORIENT, .orient = ILI9341_IFACE1_ORIENT,
.pxfmt = ILI9341_IFACE1_PXFMT, .pxfmt = ILI9341_IFACE1_PXFMT,
@@ -600,7 +560,7 @@ static void ili9341_selectarea(FAR struct ili9341_lcd_s *lcd,
* Write a partial raster line to the LCD. * Write a partial raster line to the LCD.
* *
* Input Parameters: * Input Parameters:
* devno - Number of lcd device * lcd_dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -614,10 +574,11 @@ static void ili9341_selectarea(FAR struct ili9341_lcd_s *lcd,
* *
****************************************************************************/ ****************************************************************************/
static int ili9341_putrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9341_putrun(FAR struct lcd_dev_s *lcd_dev, fb_coord_t row,
FAR const uint8_t * buffer, size_t npixels) fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels)
{ {
FAR struct ili9341_dev_s *dev = &g_lcddev[devno]; FAR struct ili9341_dev_s *dev = (FAR struct ili9341_dev_s *)dev;
FAR struct ili9341_lcd_s *lcd = dev->lcd; FAR struct ili9341_lcd_s *lcd = dev->lcd;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
@@ -660,7 +621,7 @@ static int ili9341_putrun(int devno, fb_coord_t row, fb_coord_t col,
* Read a partial raster line from the LCD. * Read a partial raster line from the LCD.
* *
* Input Parameters: * Input Parameters:
* devno - Number of the lcd device * lcd_dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -675,10 +636,11 @@ static int ili9341_putrun(int devno, fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
# ifndef CONFIG_LCD_NOGETRUN # ifndef CONFIG_LCD_NOGETRUN
static int ili9341_getrun(int devno, fb_coord_t row, fb_coord_t col, static int ili9341_getrun(FAR struct lcd_dev_s *lcd_dev, fb_coord_t row,
FAR uint8_t * buffer, size_t npixels) fb_coord_t col, FAR uint8_t * buffer,
size_t npixels)
{ {
FAR struct ili9341_dev_s *dev = &g_lcddev[devno]; FAR struct ili9341_dev_s *dev = (FAR struct ili9341_dev_s *)lcd_dev;
FAR struct ili9341_lcd_s *lcd = dev->lcd; FAR struct ili9341_lcd_s *lcd = dev->lcd;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
@@ -813,80 +775,6 @@ static int ili9341_hwinitialize(FAR struct ili9341_dev_s *dev)
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: ili9341_putrunx
*
* Description:
* Write a partial raster line to the LCD.
*
* Input Parameters:
* row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD
* npixels - The number of pixels to write to the
* (range: 0 < npixels <= xres-col)
*
* Returned Value:
*
* On success - OK
* On error - -EINVAL
*
****************************************************************************/
#ifdef CONFIG_LCD_ILI9341_IFACE0
static int ili9341_putrun0(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels)
{
return ili9341_putrun(0, row, col, buffer, npixels);
}
#endif
#ifdef CONFIG_LCD_ILI9341_IFACE1
static int ili9341_putrun1(fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels)
{
return ili9341_putrun(1, row, col, buffer, npixels);
}
#endif
/****************************************************************************
* Name: ili9341_getrunx
*
* Description:
* Read a partial raster line from the LCD.
*
* Input Parameters:
* row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read from (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD
* npixels - The number of pixels to read from the
* (range: 0 < npixels <= xres-col)
*
* Returned Value:
*
* On success - OK
* On error - -EINVAL
*
****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN
# ifdef CONFIG_LCD_ILI9341_IFACE0
static int ili9341_getrun0(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels)
{
return ili9341_getrun(0, row, col, buffer, npixels);
}
# endif
# ifdef CONFIG_LCD_ILI9341_IFACE1
static int ili9341_getrun1(fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels)
{
return ili9341_getrun(1, row, col, buffer, npixels);
}
# endif
#endif
/**************************************************************************** /****************************************************************************
* Name: ili9341_getvideoinfo * Name: ili9341_getvideoinfo
* *
@@ -951,12 +839,13 @@ static int ili9341_getplaneinfo(FAR struct lcd_dev_s *dev,
{ {
FAR struct ili9341_dev_s *priv = (FAR struct ili9341_dev_s *)dev; FAR struct ili9341_dev_s *priv = (FAR struct ili9341_dev_s *)dev;
pinfo->putrun = priv->putrun; pinfo->putrun = ili9341_putrun;
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
pinfo->getrun = priv->getrun; pinfo->getrun = ili9341_getrun;
#endif #endif
pinfo->bpp = priv->bpp; pinfo->bpp = priv->bpp;
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->dev = dev;
lcdinfo("planeno: %d bpp: %d\n", planeno, pinfo->bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, pinfo->bpp);
+13 -7
View File
@@ -102,8 +102,9 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct lcddev_run_s *lcd_run = FAR struct lcddev_run_s *lcd_run =
(FAR struct lcddev_run_s *)arg; (FAR struct lcddev_run_s *)arg;
ret = priv->planeinfo.getrun(lcd_run->row, lcd_run->col, ret = priv->planeinfo.getrun(priv->lcd_ptr, lcd_run->row,
lcd_run->data, lcd_run->npixels); lcd_run->col, lcd_run->data,
lcd_run->npixels);
} }
break; break;
case LCDDEVIO_PUTRUN: case LCDDEVIO_PUTRUN:
@@ -111,7 +112,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR const struct lcddev_run_s *lcd_run = FAR const struct lcddev_run_s *lcd_run =
(FAR const struct lcddev_run_s *)arg; (FAR const struct lcddev_run_s *)arg;
ret = priv->planeinfo.putrun(lcd_run->row, lcd_run->col, ret = priv->planeinfo.putrun(priv->lcd_ptr,
lcd_run->row, lcd_run->col,
lcd_run->data, lcd_run->npixels); lcd_run->data, lcd_run->npixels);
} }
break; break;
@@ -122,7 +124,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
if (priv->planeinfo.getarea) if (priv->planeinfo.getarea)
{ {
ret = priv->planeinfo.getarea(lcd_area->row_start, ret = priv->planeinfo.getarea(priv->lcd_ptr,
lcd_area->row_start,
lcd_area->row_end, lcd_area->row_end,
lcd_area->col_start, lcd_area->col_start,
lcd_area->col_end, lcd_area->col_end,
@@ -138,7 +141,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
for (row = lcd_area->row_start; row <= lcd_area->row_end; row++) for (row = lcd_area->row_start; row <= lcd_area->row_end; row++)
{ {
ret = priv->planeinfo.getrun(row, lcd_area->col_start, buf, ret = priv->planeinfo.getrun(priv->lcd_ptr, row,
lcd_area->col_start, buf,
npixels); npixels);
if (ret < 0) if (ret < 0)
{ {
@@ -157,7 +161,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
if (priv->planeinfo.putarea) if (priv->planeinfo.putarea)
{ {
ret = priv->planeinfo.putarea(lcd_area->row_start, ret = priv->planeinfo.putarea(priv->lcd_ptr,
lcd_area->row_start,
lcd_area->row_end, lcd_area->row_end,
lcd_area->col_start, lcd_area->col_start,
lcd_area->col_end, lcd_area->col_end,
@@ -173,7 +178,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
for (row = lcd_area->row_start; row <= lcd_area->row_end; row++) for (row = lcd_area->row_start; row <= lcd_area->row_end; row++)
{ {
ret = priv->planeinfo.putrun(row, lcd_area->col_start, buf, ret = priv->planeinfo.putrun(priv->lcd_ptr, row,
lcd_area->col_start, buf,
npixels); npixels);
if (ret < 0) if (ret < 0)
{ {
+1 -1
View File
@@ -226,7 +226,7 @@ static int lcdfb_updateearea(FAR struct fb_vtable_s *vtable,
* memory. * memory.
*/ */
ret = pinfo->putrun(row, startx, run, width); ret = pinfo->putrun(pinfo->dev, row, startx, run, width);
if (ret < 0) if (ret < 0)
{ {
return ret; return ret;
+14 -8
View File
@@ -82,10 +82,12 @@ static int lpm013m091a_hwinitialize(FAR struct lpm013m091a_dev_s *dev);
/* lcd data transfer methods */ /* lcd data transfer methods */
static int lpm013m091a_putrun(fb_coord_t row, fb_coord_t col, static int lpm013m091a_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int lpm013m091a_getrun(fb_coord_t row, fb_coord_t col, static int lpm013m091a_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
#endif #endif
@@ -276,7 +278,7 @@ static int lpm013m091a_hwinitialize(FAR struct lpm013m091a_dev_s *dev)
* Write a partial raster line to the LCD. * Write a partial raster line to the LCD.
* *
* Parameters: * Parameters:
* devno - Number of lcd device * dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -290,11 +292,12 @@ static int lpm013m091a_hwinitialize(FAR struct lpm013m091a_dev_s *dev)
* *
****************************************************************************/ ****************************************************************************/
static int lpm013m091a_putrun(fb_coord_t row, fb_coord_t col, static int lpm013m091a_putrun(FAR struct lcd_dev_s *lcd_dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
FAR struct lpm013m091a_dev_s *dev = (FAR struct lpm013m091a_dev_s *) FAR struct lpm013m091a_dev_s *dev = (FAR struct lpm013m091a_dev_s *)
&g_lpm013m091a_dev; lcd_dev;
FAR struct lpm013m091a_lcd_s *lcd = dev->lcd; FAR struct lpm013m091a_lcd_s *lcd = dev->lcd;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
@@ -337,7 +340,7 @@ static int lpm013m091a_putrun(fb_coord_t row, fb_coord_t col,
* Read a partial raster line from the LCD. * Read a partial raster line from the LCD.
* *
* Parameter: * Parameter:
* devno - Number of the lcd device * dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -352,8 +355,10 @@ static int lpm013m091a_putrun(fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
int lpm013m091a_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer, static int lpm013m091a_getrun(FAR struct lcd_dev_s *dev,
size_t npixels) fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels)
{ {
lcderr("getrun is not supported for now.\n"); lcderr("getrun is not supported for now.\n");
return -ENOSYS; return -ENOSYS;
@@ -418,6 +423,7 @@ static int lpm013m091a_getplaneinfo(FAR struct lcd_dev_s *dev,
if (dev && pinfo && planeno == 0) if (dev && pinfo && planeno == 0)
{ {
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
lcdinfo("planeno: %d bpp: %d\n", planeno, pinfo->bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, pinfo->bpp);
+18 -10
View File
@@ -161,10 +161,12 @@ static void max7219_deselect(FAR struct spi_dev_s *spi);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int max7219_putrun(fb_coord_t row, fb_coord_t col, static int max7219_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t *buffer, size_t npixels); fb_coord_t col, FAR const uint8_t *buffer,
static int max7219_getrun(fb_coord_t row, fb_coord_t col, size_t npixels);
FAR uint8_t *buffer, size_t npixels); static int max7219_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
fb_coord_t col, FAR uint8_t *buffer,
size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -389,6 +391,7 @@ static void max7219_deselect(FAR struct spi_dev_s *spi)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -397,14 +400,15 @@ static void max7219_deselect(FAR struct spi_dev_s *spi)
* *
****************************************************************************/ ****************************************************************************/
static int max7219_putrun(fb_coord_t row, fb_coord_t col, static int max7219_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t *buffer, size_t npixels) fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single /* Because of this line of code, we will only be able to support a single
* MAX7219 device . * MAX7219 device .
*/ */
FAR struct max7219_dev_s *priv = &g_max7219dev; FAR struct max7219_dev_s *priv = (FAR struct max7219_dev_s *)dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint16_t data; uint16_t data;
@@ -522,6 +526,7 @@ static int max7219_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -530,14 +535,15 @@ static int max7219_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int max7219_getrun(fb_coord_t row, fb_coord_t col, static int max7219_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t *buffer, size_t npixels) fb_coord_t col, FAR uint8_t *buffer,
size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single /* Because of this line of code, we will only be able to support a single
* MAX7219 device. * MAX7219 device.
*/ */
FAR struct max7219_dev_s *priv = &g_max7219dev; FAR struct max7219_dev_s *priv = (FAR struct max7219_dev_s *)dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t usrmask; uint8_t usrmask;
@@ -646,6 +652,8 @@ static int max7219_getplaneinfo(FAR struct lcd_dev_s *dev,
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+13 -6
View File
@@ -139,9 +139,11 @@ static void memlcd_deselect(FAR struct spi_dev_s *spi);
/* lcd data transfer methods */ /* lcd data transfer methods */
static int memlcd_putrun(fb_coord_t row, fb_coord_t col, static int memlcd_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels); FAR const uint8_t * buffer, size_t npixels);
static int memlcd_getrun(fb_coord_t row, fb_coord_t col, static int memlcd_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels); FAR uint8_t * buffer, size_t npixels);
/* lcd configuration */ /* lcd configuration */
@@ -383,6 +385,7 @@ static int memlcd_extcominisr(int irq, FAR void *context, void *arg)
* This method can be used to write a partial raster line to the LCD. * This method can be used to write a partial raster line to the LCD.
* *
* Input Parameters: * Input Parameters:
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -391,10 +394,11 @@ static int memlcd_extcominisr(int irq, FAR void *context, void *arg)
* *
****************************************************************************/ ****************************************************************************/
static int memlcd_putrun(fb_coord_t row, fb_coord_t col, static int memlcd_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t * buffer, size_t npixels) FAR const uint8_t * buffer, size_t npixels)
{ {
FAR struct memlcd_dev_s *mlcd = (FAR struct memlcd_dev_s *)&g_memlcddev; FAR struct memlcd_dev_s *mlcd = (FAR struct memlcd_dev_s *)dev;
uint16_t cmd; uint16_t cmd;
uint8_t *p; uint8_t *p;
uint8_t *pfb; uint8_t *pfb;
@@ -475,6 +479,7 @@ static int memlcd_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD. * This method can be used to read a partial raster line from the LCD.
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -483,10 +488,11 @@ static int memlcd_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int memlcd_getrun(fb_coord_t row, fb_coord_t col, static int memlcd_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t * buffer, size_t npixels) FAR uint8_t * buffer, size_t npixels)
{ {
FAR struct memlcd_dev_s *mlcd = (FAR struct memlcd_dev_s *)&g_memlcddev; FAR struct memlcd_dev_s *mlcd = (FAR struct memlcd_dev_s *)dev;
uint8_t *p; uint8_t *p;
uint8_t *pfb; uint8_t *pfb;
uint8_t usrmask; uint8_t usrmask;
@@ -574,6 +580,7 @@ static int memlcd_getplaneinfo(FAR struct lcd_dev_s *dev,
DEBUGASSERT(pinfo && planeno == 0); DEBUGASSERT(pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+14 -11
View File
@@ -281,10 +281,12 @@ static void mio283qt2_setarea(FAR struct mio283qt2_lcd_s *lcd,
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int mio283qt2_putrun(fb_coord_t row, fb_coord_t col, static int mio283qt2_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int mio283qt2_getrun(fb_coord_t row, fb_coord_t col, static int mio283qt2_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -325,8 +327,6 @@ static inline int mio283qt2_hwinitialize(FAR struct mio283qt2_dev_s *priv);
****************************************************************************/ ****************************************************************************/
/* This driver can support only a signal MIO283QT2 device. /* This driver can support only a signal MIO283QT2 device.
* This is due to an unfortunate decision made whent he getrun and
* putrun methods were designed.
* The following is the single MIO283QT2 driver state instance: * The following is the single MIO283QT2 driver state instance:
*/ */
@@ -513,6 +513,7 @@ static void mio283qt2_dumprun(FAR const char *msg,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -521,11 +522,12 @@ static void mio283qt2_dumprun(FAR const char *msg,
* *
****************************************************************************/ ****************************************************************************/
static int mio283qt2_putrun(fb_coord_t row, fb_coord_t col, static int mio283qt2_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct mio283qt2_dev_s *priv = &g_lcddev; FAR struct mio283qt2_dev_s *priv = (FAR struct mio283qt2_dev_s *)dev;
FAR struct mio283qt2_lcd_s *lcd = priv->lcd; FAR struct mio283qt2_lcd_s *lcd = priv->lcd;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
int i; int i;
@@ -562,6 +564,7 @@ static int mio283qt2_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -570,12 +573,13 @@ static int mio283qt2_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int mio283qt2_getrun(fb_coord_t row, fb_coord_t col, static int mio283qt2_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
FAR struct mio283qt2_dev_s *priv = &g_lcddev; FAR struct mio283qt2_dev_s *priv = (FAR struct mio283qt2_dev_s *)dev;
FAR struct mio283qt2_lcd_s *lcd = priv->lcd; FAR struct mio283qt2_lcd_s *lcd = priv->lcd;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
uint16_t accum; uint16_t accum;
@@ -662,6 +666,7 @@ static int mio283qt2_getplaneinfo(FAR struct lcd_dev_s *dev,
pinfo->getrun = mio283qt2_getrun; /* Get a run from LCD memory */ pinfo->getrun = mio283qt2_getrun; /* Get a run from LCD memory */
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = MIO283QT2_BPP; /* Bits-per-pixel */ pinfo->bpp = MIO283QT2_BPP; /* Bits-per-pixel */
pinfo->dev = dev; /* LCD device */
return OK; return OK;
} }
@@ -965,9 +970,7 @@ FAR struct lcd_dev_s *mio283qt2_lcdinitialize(
lcdinfo("Initializing\n"); lcdinfo("Initializing\n");
/* If we ccould support multiple MIO283QT2 devices, this is where we /* If we ccould support multiple MIO283QT2 devices, this is where we
* would allocate a new driver data structure... but we can't. * would allocate a new driver data structure.
* Why not?
* Because of a bad should the form of the getrun() and putrun methods.
*/ */
FAR struct mio283qt2_dev_s *priv = &g_lcddev; FAR struct mio283qt2_dev_s *priv = &g_lcddev;
+16 -12
View File
@@ -166,10 +166,12 @@ static void mio283qt9a_setarea(FAR struct mio283qt9a_lcd_s *lcd,
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int mio283qt9a_putrun(fb_coord_t row, fb_coord_t col, static int mio283qt9a_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int mio283qt9a_getrun(fb_coord_t row, fb_coord_t col, static int mio283qt9a_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -211,8 +213,6 @@ static inline int mio283qt9a_hwinitialize(
****************************************************************************/ ****************************************************************************/
/* This driver can support only a signal MIO283QT9A device. /* This driver can support only a signal MIO283QT9A device.
* This is due to an unfortunate decision made when the getrun and putrun
* methods were designed.
* The following is the single MIO283QT9A driver state instance: * The following is the single MIO283QT9A driver state instance:
*/ */
@@ -416,6 +416,7 @@ static void mio283qt9a_dumprun(FAR const char *msg,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -424,11 +425,12 @@ static void mio283qt9a_dumprun(FAR const char *msg,
* *
****************************************************************************/ ****************************************************************************/
static int mio283qt9a_putrun(fb_coord_t row, fb_coord_t col, static int mio283qt9a_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct mio283qt9a_dev_s *priv = &g_lcddev; FAR struct mio283qt9a_dev_s *priv = (FAR struct mio283qt9a_dev_s *)dev;
FAR struct mio283qt9a_lcd_s *lcd = priv->lcd; FAR struct mio283qt9a_lcd_s *lcd = priv->lcd;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
int i; int i;
@@ -464,6 +466,7 @@ static int mio283qt9a_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -472,15 +475,17 @@ static int mio283qt9a_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int mio283qt9a_getrun(fb_coord_t row, fb_coord_t col, static int mio283qt9a_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
FAR struct mio283qt9a_dev_s *priv = &g_lcddev; FAR struct mio283qt9a_dev_s *priv = (FAR struct mio283qt9a_dev_s *)dev;
FAR struct mio283qt9a_lcd_s *lcd = priv->lcd; FAR struct mio283qt9a_lcd_s *lcd = priv->lcd;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
uint16_t accum, test; uint16_t accum;
uint16_t test;
int i; int i;
/* Buffer must be provided and aligned to a 16-bit address boundary */ /* Buffer must be provided and aligned to a 16-bit address boundary */
@@ -562,6 +567,7 @@ static int mio283qt9a_getplaneinfo(FAR struct lcd_dev_s *dev,
pinfo->getrun = mio283qt9a_getrun; /* Get a run from LCD memory */ pinfo->getrun = mio283qt9a_getrun; /* Get a run from LCD memory */
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = MIO283QT9A_BPP; /* Bits-per-pixel */ pinfo->bpp = MIO283QT9A_BPP; /* Bits-per-pixel */
pinfo->dev = dev; /* The lcd device */
return OK; return OK;
} }
@@ -851,9 +857,7 @@ FAR struct lcd_dev_s *mio283qt9a_lcdinitialize(
lcdinfo("Initializing\n"); lcdinfo("Initializing\n");
/* If we could support multiple MIO283QT9A devices, this is where we would /* If we could support multiple MIO283QT9A devices, this is where we would
* allocate a new driver data structure... but we can't. * allocate a new driver data structure.
* Why not?
* Because of a bad should the form of the getrun() and putrun methods.
*/ */
priv = &g_lcddev; priv = &g_lcddev;
+18 -9
View File
@@ -201,10 +201,12 @@ static void rit_sndcmds(FAR struct rit_dev_s *priv,
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int rit_putrun(fb_coord_t row, fb_coord_t col, static int rit_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int rit_getrun(fb_coord_t row, fb_coord_t col, static int rit_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -634,6 +636,7 @@ static inline void rit_clear(FAR struct rit_dev_s *priv)
* This method can be used to write a partial raster line to the LCD. * This method can be used to write a partial raster line to the LCD.
* *
* Input Parameters: * Input Parameters:
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -643,11 +646,12 @@ static inline void rit_clear(FAR struct rit_dev_s *priv)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_P14201_FRAMEBUFFER #ifdef CONFIG_P14201_FRAMEBUFFER
static int rit_putrun(fb_coord_t row, fb_coord_t col, static int rit_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct rit_dev_s *priv = (FAR struct rit_dev_s *)&g_oleddev; FAR struct rit_dev_s *priv = (FAR struct rit_dev_s *)dev;
uint8_t cmd[3]; uint8_t cmd[3];
uint8_t *run; uint8_t *run;
int start; int start;
@@ -809,11 +813,12 @@ static int rit_putrun(fb_coord_t row, fb_coord_t col,
return OK; return OK;
} }
#else #else
static int rit_putrun(fb_coord_t row, fb_coord_t col, static int rit_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct rit_dev_s *priv = (FAR struct rit_dev_s *)&g_oleddev; FAR struct rit_dev_s *priv = (FAR struct rit_dev_s *)dev;
uint8_t cmd[3]; uint8_t cmd[3];
ritinfo("row: %d col: %d npixels: %d\n", row, col, npixels); ritinfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -871,6 +876,7 @@ static int rit_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -880,7 +886,9 @@ static int rit_putrun(fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_P14201_FRAMEBUFFER #ifdef CONFIG_P14201_FRAMEBUFFER
static int rit_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int rit_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
uint8_t *run; uint8_t *run;
@@ -980,8 +988,8 @@ static int rit_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
return OK; return OK;
} }
#else #else
static int rit_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int rit_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
size_t npixels) fb_coord_t col, FAR uint8_t *buffer, size_t npixels)
{ {
/* Can't read from OLED GDDRAM in SPI mode */ /* Can't read from OLED GDDRAM in SPI mode */
@@ -1023,6 +1031,7 @@ static int rit_getplaneinfo(FAR struct lcd_dev_s *dev,
DEBUGASSERT(pinfo && planeno == 0); DEBUGASSERT(pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+13 -6
View File
@@ -210,9 +210,11 @@ static void pcd8544_deselect(FAR struct spi_dev_s *spi);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int pcd8544_putrun(fb_coord_t row, fb_coord_t col, static int pcd8544_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
static int pcd8544_getrun(fb_coord_t row, fb_coord_t col, static int pcd8544_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels); FAR uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -409,6 +411,7 @@ static void pcd8544_deselect(FAR struct spi_dev_s *spi)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -417,14 +420,15 @@ static void pcd8544_deselect(FAR struct spi_dev_s *spi)
* *
****************************************************************************/ ****************************************************************************/
static int pcd8544_putrun(fb_coord_t row, fb_coord_t col, static int pcd8544_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single /* Because of this line of code, we will only be able to support a single
* PCD8544 device * PCD8544 device
*/ */
FAR struct pcd8544_dev_s *priv = &g_pcd8544dev; FAR struct pcd8544_dev_s *priv = (FAR struct pcd8544_dev_s *)dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t fbmask; uint8_t fbmask;
@@ -559,6 +563,7 @@ static int pcd8544_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -567,14 +572,15 @@ static int pcd8544_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int pcd8544_getrun(fb_coord_t row, fb_coord_t col, static int pcd8544_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels) FAR uint8_t *buffer, size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single /* Because of this line of code, we will only be able to support a single
* PCD8544 device * PCD8544 device
*/ */
FAR struct pcd8544_dev_s *priv = &g_pcd8544dev; FAR struct pcd8544_dev_s *priv = (FAR struct pcd8544_dev_s *)dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
uint8_t page; uint8_t page;
uint8_t fbmask; uint8_t fbmask;
@@ -716,6 +722,7 @@ static int pcd8544_getplaneinfo(FAR struct lcd_dev_s *dev,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+27 -19
View File
@@ -263,10 +263,12 @@ static void ra8875_showrun(FAR struct ra8875_dev_s *priv, fb_coord_t row,
# define ra8875_showrun(p,r,c,n,b) # define ra8875_showrun(p,r,c,n,b)
#endif #endif
static int ra8875_putrun(fb_coord_t row, fb_coord_t col, static int ra8875_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int ra8875_getrun(fb_coord_t row, fb_coord_t col, static int ra8875_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -306,9 +308,8 @@ static inline int ra8875_hwinitialize(FAR struct ra8875_dev_s *priv);
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* This driver can support only a signal RA8875 device. This is due to an /* This driver can support only a signal RA8875 device.
* unfortunate decision made when the getrun and putrun methods were * The following is the single RA8875 driver state instance:
* designed. The following is the single RA8875 driver state instance:
*/ */
static struct ra8875_dev_s g_lcddev; static struct ra8875_dev_s g_lcddev;
@@ -617,6 +618,7 @@ static void ra8875_showrun(FAR struct ra8875_dev_s *priv, fb_coord_t row,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -625,11 +627,12 @@ static void ra8875_showrun(FAR struct ra8875_dev_s *priv, fb_coord_t row,
* *
****************************************************************************/ ****************************************************************************/
static int ra8875_putrun(fb_coord_t row, fb_coord_t col, static int ra8875_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct ra8875_dev_s *priv = &g_lcddev; FAR struct ra8875_dev_s *priv = (FAR struct ra8875_dev_s *)dev;
FAR struct ra8875_lcd_s *lcd = priv->lcd; FAR struct ra8875_lcd_s *lcd = priv->lcd;
int16_t curhinc = 0; int16_t curhinc = 0;
int16_t curvinc = 0; int16_t curvinc = 0;
@@ -737,6 +740,7 @@ static int ra8875_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -745,11 +749,13 @@ static int ra8875_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int ra8875_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int ra8875_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
FAR struct ra8875_dev_s *priv = &g_lcddev; FAR struct ra8875_dev_s *priv = (FAR struct ra8875_dev_s *)dev;
FAR struct ra8875_lcd_s *lcd = priv->lcd; FAR struct ra8875_lcd_s *lcd = priv->lcd;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
int i; int i;
@@ -876,6 +882,7 @@ static int ra8875_getplaneinfo(FAR struct lcd_dev_s *dev,
pinfo->getrun = ra8875_getrun; /* Get a run from LCD memory */ pinfo->getrun = ra8875_getrun; /* Get a run from LCD memory */
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = RA8875_BPP; /* Bits-per-pixel */ pinfo->bpp = RA8875_BPP; /* Bits-per-pixel */
pinfo->dev = dev; /* The lcd device */
return OK; return OK;
} }
@@ -891,8 +898,10 @@ static int ra8875_getplaneinfo(FAR struct lcd_dev_s *dev,
static int ra8875_getpower(FAR struct lcd_dev_s *dev) static int ra8875_getpower(FAR struct lcd_dev_s *dev)
{ {
FAR struct ra8875_dev_s *priv = (FAR struct ra8875_dev_s *)dev;
lcdinfo("power: %d\n", 0); lcdinfo("power: %d\n", 0);
return g_lcddev.power; return priv->power;
} }
/**************************************************************************** /****************************************************************************
@@ -916,9 +925,6 @@ static int ra8875_poweroff(FAR struct ra8875_lcd_s *lcd)
ra8875_putreg(lcd, RA8875_PWRR, RA8875_PWRR_DISPLAY_OFF); ra8875_putreg(lcd, RA8875_PWRR, RA8875_PWRR_DISPLAY_OFF);
/* Remember the power off state */
g_lcddev.power = 0;
return OK; return OK;
} }
@@ -944,7 +950,7 @@ static int ra8875_setpower(FAR struct lcd_dev_s *dev, int power)
if (power > 0) if (power > 0)
{ {
if (g_lcddev.power == 0) if (priv->power == 0)
{ {
/* Set the backlight level */ /* Set the backlight level */
@@ -959,13 +965,17 @@ static int ra8875_setpower(FAR struct lcd_dev_s *dev, int power)
ra8875_putreg(lcd, RA8875_PWRR, RA8875_PWRR_DISPLAY_ON); ra8875_putreg(lcd, RA8875_PWRR, RA8875_PWRR_DISPLAY_ON);
g_lcddev.power = power; priv->power = power;
} }
else else
{ {
/* Turn the display off */ /* Turn the display off */
ra8875_poweroff(lcd); ra8875_poweroff(lcd);
/* Remember the power off state */
priv->power = 0;
} }
return OK; return OK;
@@ -1125,9 +1135,7 @@ FAR struct lcd_dev_s *ra8875_lcdinitialize(FAR struct ra8875_lcd_s *lcd)
lcdinfo("Initializing\n"); lcdinfo("Initializing\n");
/* If we could support multiple RA8875 devices, this is where we would /* If we could support multiple RA8875 devices, this is where we would
* allocate a new driver data structure... but we can't. * allocate a new driver data structure.
* Why not? Because of a bad should the form of the getrun() and putrun
* methods.
*/ */
FAR struct ra8875_dev_s *priv = &g_lcddev; FAR struct ra8875_dev_s *priv = &g_lcddev;
@@ -1157,7 +1165,7 @@ FAR struct lcd_dev_s *ra8875_lcdinitialize(FAR struct ra8875_lcd_s *lcd)
lcdinfo("Initialized\n"); lcdinfo("Initialized\n");
return &g_lcddev.dev; return &priv->dev;
} }
return NULL; return NULL;
+18 -13
View File
@@ -106,10 +106,12 @@ struct skel_dev_s
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int skel_putrun(fb_coord_t row, fb_coord_t col, static int skel_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int skel_getrun(fb_coord_t row, fb_coord_t col, static int skel_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -135,10 +137,10 @@ static int skel_getplaneinfo(FAR struct lcd_dev_s *dev,
/* LCD Specific Controls */ /* LCD Specific Controls */
static int skel_getpower(struct lcd_dev_s *dev); static int skel_getpower(FAR struct lcd_dev_s *dev);
static int skel_setpower(struct lcd_dev_s *dev, int power); static int skel_setpower(FAR struct lcd_dev_s *dev, int power);
static int skel_getcontrast(struct lcd_dev_s *dev); static int skel_getcontrast(FAR struct lcd_dev_s *dev);
static int skel_setcontrast(struct lcd_dev_s *dev, static int skel_setcontrast(FAR struct lcd_dev_s *dev,
unsigned int contrast); unsigned int contrast);
/**************************************************************************** /****************************************************************************
@@ -220,7 +222,8 @@ static struct skel_dev_s g_lcddev =
* *
****************************************************************************/ ****************************************************************************/
static int skel_putrun(fb_coord_t row, fb_coord_t col, static int skel_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
@@ -250,7 +253,9 @@ static int skel_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int skel_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int skel_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
/* Buffer must be provided and aligned to a 16-bit address boundary */ /* Buffer must be provided and aligned to a 16-bit address boundary */
@@ -327,7 +332,7 @@ static int skel_getpower(struct lcd_dev_s *dev)
* *
****************************************************************************/ ****************************************************************************/
static int skel_setpower(struct lcd_dev_s *dev, int power) static int skel_setpower(FAR struct lcd_dev_s *dev, int power)
{ {
struct skel_dev_s *priv = (struct skel_dev_s *)dev; struct skel_dev_s *priv = (struct skel_dev_s *)dev;
@@ -348,7 +353,7 @@ static int skel_setpower(struct lcd_dev_s *dev, int power)
* *
****************************************************************************/ ****************************************************************************/
static int skel_getcontrast(struct lcd_dev_s *dev) static int skel_getcontrast(FAR struct lcd_dev_s *dev)
{ {
ginfo("Not implemented\n"); ginfo("Not implemented\n");
#warning "Missing logic" #warning "Missing logic"
@@ -363,7 +368,7 @@ static int skel_getcontrast(struct lcd_dev_s *dev)
* *
****************************************************************************/ ****************************************************************************/
static int skel_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) static int skel_setcontrast(FAR struct lcd_dev_s *dev, unsigned int contrast)
{ {
ginfo("contrast: %d\n", contrast); ginfo("contrast: %d\n", contrast);
#warning "Missing logic" #warning "Missing logic"
@@ -380,8 +385,8 @@ static int skel_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
* Description: * Description:
* Initialize the LCD video hardware. * Initialize the LCD video hardware.
* The initial state of the LCD is fully initialized, display memory * The initial state of the LCD is fully initialized, display memory
* cleared, and the LCD ready to use, but with the power setting at 0 * cleared, and the LCD ready to use, but with the power setting at 0
* (full off). * (full off).
* *
****************************************************************************/ ****************************************************************************/
+17 -13
View File
@@ -293,10 +293,12 @@ static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row,
# define ssd1289_showrun(p,r,c,n,b) # define ssd1289_showrun(p,r,c,n,b)
#endif #endif
static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, static int ssd1289_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, static int ssd1289_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -336,9 +338,8 @@ static inline int ssd1289_hwinitialize(FAR struct ssd1289_dev_s *priv);
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* This driver can support only a signal SSD1289 device. This is due to an /* This driver can support only a signal SSD1289 device.
* unfortunate decision made whent he getrun and putrun methods were * The following is the single SSD1289 driver state instance:
* designed. The following is the single SSD1289 driver state instance:
*/ */
static struct ssd1289_dev_s g_lcddev; static struct ssd1289_dev_s g_lcddev;
@@ -580,6 +581,7 @@ static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -588,11 +590,12 @@ static void ssd1289_showrun(FAR struct ssd1289_dev_s *priv, fb_coord_t row,
* *
****************************************************************************/ ****************************************************************************/
static int ssd1289_putrun(fb_coord_t row, fb_coord_t col, static int ssd1289_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct ssd1289_dev_s *priv = &g_lcddev; FAR struct ssd1289_dev_s *priv = (FAR struct ssd1289_dev_s *)dev;
FAR struct ssd1289_lcd_s *lcd = priv->lcd; FAR struct ssd1289_lcd_s *lcd = priv->lcd;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
int i; int i;
@@ -713,6 +716,7 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -721,12 +725,13 @@ static int ssd1289_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int ssd1289_getrun(fb_coord_t row, fb_coord_t col, static int ssd1289_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
FAR struct ssd1289_dev_s *priv = &g_lcddev; FAR struct ssd1289_dev_s *priv = (FAR struct ssd1289_dev_s *)dev;
FAR struct ssd1289_lcd_s *lcd = priv->lcd; FAR struct ssd1289_lcd_s *lcd = priv->lcd;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
uint16_t accum; uint16_t accum;
@@ -889,6 +894,7 @@ static int ssd1289_getplaneinfo(FAR struct lcd_dev_s *dev,
pinfo->getrun = ssd1289_getrun; /* Get a run from LCD memory */ pinfo->getrun = ssd1289_getrun; /* Get a run from LCD memory */
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = SSD1289_BPP; /* Bits-per-pixel */ pinfo->bpp = SSD1289_BPP; /* Bits-per-pixel */
pinfo->dev = dev; /* The lcd device */
return OK; return OK;
} }
@@ -1335,10 +1341,8 @@ FAR struct lcd_dev_s *ssd1289_lcdinitialize(FAR struct ssd1289_lcd_s *lcd)
lcdinfo("Initializing\n"); lcdinfo("Initializing\n");
/* If we ccould support multiple SSD1289 devices, this is where we would /* If we support multiple SSD1289 devices, this is where we would allocate
* allocate a new driver data structure... but we can't. * a new driver data structure.
* Why not? Because of a bad should the form of the getrun() and
* putrun methods.
*/ */
FAR struct ssd1289_dev_s *priv = &g_lcddev; FAR struct ssd1289_dev_s *priv = &g_lcddev;
+2
View File
@@ -283,6 +283,7 @@ struct ssd1306_dev_s
FAR struct i2c_master_s *i2c; /* Cached I2C device reference */ FAR struct i2c_master_s *i2c; /* Cached I2C device reference */
uint8_t addr; /* 7-bit I2C address */ uint8_t addr; /* 7-bit I2C address */
#endif #endif
uint8_t devno; /* LCD device instance */
uint8_t contrast; /* Current contrast setting */ uint8_t contrast; /* Current contrast setting */
bool on; /* true: display is on */ bool on; /* true: display is on */
bool is_conf; /* true: display had been configured */ bool is_conf; /* true: display had been configured */
@@ -296,6 +297,7 @@ struct ssd1306_dev_s
*/ */
uint8_t fb[SSD1306_DEV_FBSIZE]; uint8_t fb[SSD1306_DEV_FBSIZE];
uint8_t runbuffer[SSD1306_DEV_ROWSIZE];
}; };
/**************************************************************************** /****************************************************************************
+28 -38
View File
@@ -139,10 +139,12 @@
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int ssd1306_putrun(fb_coord_t row, fb_coord_t col, static int ssd1306_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t *buffer, size_t npixels); fb_coord_t col, FAR const uint8_t *buffer,
static int ssd1306_getrun(fb_coord_t row, fb_coord_t col, size_t npixels);
FAR uint8_t *buffer, size_t npixels); static int ssd1306_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
fb_coord_t col, FAR uint8_t *buffer,
size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -180,19 +182,6 @@ static int ssd1306_redrawfb(struct ssd1306_dev_s *priv);
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* This is working memory allocated by the LCD driver for each LCD device
* and for each color plane. This memory will hold one raster line of data.
* The size of the allocated run buffer must therefore be at least
* (bpp * xres / 8). Actual alignment of the buffer must conform to the
* bitwidth of the underlying pixel type.
*
* If there are multiple planes, they may share the same working buffer
* because different planes will not be operate on concurrently. However,
* if there are multiple LCD devices, they must each have unique run buffers.
*/
static uint8_t g_runbuffer[SSD1306_DEV_ROWSIZE];
/* This structure describes the overall LCD video controller */ /* This structure describes the overall LCD video controller */
static const struct fb_videoinfo_s g_videoinfo = static const struct fb_videoinfo_s g_videoinfo =
@@ -203,16 +192,6 @@ static const struct fb_videoinfo_s g_videoinfo =
.nplanes = 1, /* Number of color planes supported */ .nplanes = 1, /* Number of color planes supported */
}; };
/* This is the standard, NuttX Plane information object */
static const struct lcd_planeinfo_s g_planeinfo =
{
.putrun = ssd1306_putrun, /* Put a run into LCD memory */
.getrun = ssd1306_getrun, /* Get a run from LCD memory */
.buffer = (FAR uint8_t *)g_runbuffer, /* Run scratch buffer */
.bpp = SSD1306_DEV_BPP, /* Bits-per-pixel */
};
/* This is the outside visible interface for the OLED driver */ /* This is the outside visible interface for the OLED driver */
static const struct lcd_dev_s g_oleddev_dev = static const struct lcd_dev_s g_oleddev_dev =
@@ -238,7 +217,7 @@ static const struct lcd_dev_s g_oleddev_dev =
* for now. * for now.
*/ */
static struct ssd1306_dev_s g_oleddev; static struct ssd1306_dev_s g_oleddev[CONFIG_SSD1306_NUMDEVS];
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@@ -260,11 +239,11 @@ static struct ssd1306_dev_s g_oleddev;
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) #if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
static int ssd1306_putrun(fb_coord_t row, fb_coord_t col, static int ssd1306_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t *buffer, fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
FAR struct ssd1306_dev_s *priv = (FAR struct ssd1306_dev_s *)&g_oleddev; FAR struct ssd1306_dev_s *priv = (FAR struct ssd1306_dev_s *)dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t devcol; uint8_t devcol;
@@ -489,10 +468,11 @@ static int ssd1306_putrun(fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) #if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
static int ssd1306_getrun(fb_coord_t row, fb_coord_t col, static int ssd1306_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t *buffer, size_t npixels) fb_coord_t col, FAR uint8_t *buffer,
size_t npixels)
{ {
FAR struct ssd1306_dev_s *priv = &g_oleddev; FAR struct ssd1306_dev_s *priv = (FAR struct ssd1306_dev_s *)dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
uint8_t page; uint8_t page;
uint8_t fbmask; uint8_t fbmask;
@@ -664,10 +644,19 @@ static int ssd1306_getplaneinfo(FAR struct lcd_dev_s *dev,
unsigned int planeno, unsigned int planeno,
FAR struct lcd_planeinfo_s *pinfo) FAR struct lcd_planeinfo_s *pinfo)
{ {
FAR struct ssd1306_dev_s *priv = (FAR struct ssd1306_dev_s *)dev;
DEBUGASSERT(pinfo && planeno == 0); DEBUGASSERT(pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, SSD1306_DEV_BPP);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
memset(pinfo, 0, sizeof(struct lcd_planeinfo_s));
pinfo->putrun = ssd1306_putrun;
pinfo->getrun = ssd1306_getrun;
pinfo->bpp = SSD1306_DEV_BPP;
pinfo->buffer = (FAR uint8_t *)priv->runbuffer;
pinfo->dev = dev;
return OK; return OK;
} }
@@ -1434,12 +1423,13 @@ FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_master_s *dev,
unsigned int devno) unsigned int devno)
#endif #endif
{ {
FAR struct ssd1306_dev_s *priv = &g_oleddev; FAR struct ssd1306_dev_s *priv = &g_oleddev[devno];
priv->dev = g_oleddev_dev; priv->dev = g_oleddev_dev;
DEBUGASSERT(dev && devno == 0); DEBUGASSERT(dev && devno < CONFIG_SSD1306_NUMDEVS);
priv->devno = (uint8_t)devno;
priv->on = false; priv->on = false;
priv->is_conf = false; priv->is_conf = false;
+2 -2
View File
@@ -118,7 +118,7 @@ void ssd1306_select(FAR struct ssd1306_dev_s *priv, bool cs)
/* Select/deselect SPI device */ /* Select/deselect SPI device */
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), cs); SPI_SELECT(priv->spi, SPIDEV_DISPLAY(priv->devno), cs);
/* If we are deselecting the device */ /* If we are deselecting the device */
@@ -142,6 +142,6 @@ void ssd1306_cmddata(FAR struct ssd1306_dev_s *priv, bool cmd)
{ {
/* Select command transfer */ /* Select command transfer */
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(0), cmd); SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY(priv->devno), cmd);
} }
#endif /* CONFIG_LCD_SSD1306 && CONFIG_LCD_SSD1306_SPI */ #endif /* CONFIG_LCD_SSD1306 && CONFIG_LCD_SSD1306_SPI */
+13 -6
View File
@@ -408,9 +408,11 @@ static void ssd1351_write(FAR struct ssd1351_dev_s *priv, uint8_t cmd,
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int ssd1351_putrun(fb_coord_t row, fb_coord_t col, static int ssd1351_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
static int ssd1351_getrun(fb_coord_t row, fb_coord_t col, static int ssd1351_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels); FAR uint8_t *buffer, size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -690,6 +692,7 @@ static void ssd1351_setcursor(FAR struct ssd1351_dev_s *priv, uint8_t col,
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* Input Parameters: * Input Parameters:
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels * col - Starting column to write to (range: 0 <= col <= xres-npixels
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -698,10 +701,11 @@ static void ssd1351_setcursor(FAR struct ssd1351_dev_s *priv, uint8_t col,
* *
****************************************************************************/ ****************************************************************************/
static int ssd1351_putrun(fb_coord_t row, fb_coord_t col, static int ssd1351_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
FAR struct ssd1351_dev_s *priv = &g_lcddev; FAR struct ssd1351_dev_s *priv = (FAR struct ssd1351_dev_s *)dev;
/* Sanity check */ /* Sanity check */
@@ -736,6 +740,7 @@ static int ssd1351_putrun(fb_coord_t row, fb_coord_t col,
* This method can be used to read a partial raster line from the LCD. * This method can be used to read a partial raster line from the LCD.
* *
* Input Parameters: * Input Parameters:
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read from (range: 0 <= col <= xres-npixels) * col - Starting column to read from (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -744,11 +749,12 @@ static int ssd1351_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int ssd1351_getrun(fb_coord_t row, fb_coord_t col, static int ssd1351_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels) FAR uint8_t *buffer, size_t npixels)
{ {
#if defined(CONFIG_SSD1351_PARALLEL8BIT) && !defined(CONFIG_LCD_NOGETRUN) #if defined(CONFIG_SSD1351_PARALLEL8BIT) && !defined(CONFIG_LCD_NOGETRUN)
FAR struct ssd1351_dev_s *priv = &g_lcddev; FAR struct ssd1351_dev_s *priv = (FAR struct ssd1351_dev_s *)dev;
/* Sanity check */ /* Sanity check */
@@ -822,6 +828,7 @@ static int ssd1351_getplaneinfo(FAR struct lcd_dev_s *dev,
pinfo->getrun = ssd1351_getrun; pinfo->getrun = ssd1351_getrun;
pinfo->buffer = (uint8_t *)priv->runbuffer; pinfo->buffer = (uint8_t *)priv->runbuffer;
pinfo->bpp = SSD1351_BPP; pinfo->bpp = SSD1351_BPP;
pinfo->dev = dev;
ginfo("planeno: %u bpp: %u\n", planeno, pinfo->bpp); ginfo("planeno: %u bpp: %u\n", planeno, pinfo->bpp);
return OK; return OK;
+17 -10
View File
@@ -163,11 +163,13 @@ static void ssd1680_configspi(FAR struct spi_dev_s *spi);
static void ssd1680_select(FAR struct ssd1680_dev_s *priv, bool cs); static void ssd1680_select(FAR struct ssd1680_dev_s *priv, bool cs);
static void ssd1680_cmddata(FAR struct ssd1680_dev_s *priv, bool cmd); static void ssd1680_cmddata(FAR struct ssd1680_dev_s *priv, bool cmd);
static int ssd1680_putrun(fb_coord_t row, fb_coord_t col, static int ssd1680_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t *buffer, size_t npixels); fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels);
static int ssd1680_getrun(fb_coord_t row, fb_coord_t col, static int ssd1680_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t *buffer, size_t npixels); fb_coord_t col, FAR uint8_t *buffer,
size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -287,6 +289,7 @@ static const uint8_t ssd1680_lut[] =
* This method can be used to write a partial raster line to the LCD. * This method can be used to write a partial raster line to the LCD.
* *
* Input Parameters: * Input Parameters:
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -295,10 +298,11 @@ static const uint8_t ssd1680_lut[] =
* *
****************************************************************************/ ****************************************************************************/
static int ssd1680_putrun(fb_coord_t row, fb_coord_t col, static int ssd1680_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t *buffer, size_t npixels) fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels)
{ {
FAR struct ssd1680_dev_s *priv = (FAR struct ssd1680_dev_s *)&g_epaperdev; FAR struct ssd1680_dev_s *priv = (FAR struct ssd1680_dev_s *)dev;
uint8_t *dst = priv->shadow_fb + uint8_t *dst = priv->shadow_fb +
row * SSD1680_DEV_ROWSIZE + (col >> SSD1680_PDF); row * SSD1680_DEV_ROWSIZE + (col >> SSD1680_PDF);
@@ -324,6 +328,7 @@ static int ssd1680_putrun(fb_coord_t row, fb_coord_t col,
* *
* Input Parameters: * Input Parameters:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read * col - Starting column to read read
* (range: 0 <= col <= xres-npixels) * (range: 0 <= col <= xres-npixels)
@@ -332,11 +337,12 @@ static int ssd1680_putrun(fb_coord_t row, fb_coord_t col,
* (range: 0 < npixels <= xres-col) * (range: 0 < npixels <= xres-col)
*/ */
static int ssd1680_getrun(fb_coord_t row, fb_coord_t col, static int ssd1680_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t *buffer, size_t npixels) fb_coord_t col, FAR uint8_t *buffer,
size_t npixels)
{ {
lcdinfo("(%d, %d, %d)\n", row, col, npixels); lcdinfo("(%d, %d, %d)\n", row, col, npixels);
FAR struct ssd1680_dev_s *priv = (FAR struct ssd1680_dev_s *)&g_epaperdev; FAR struct ssd1680_dev_s *priv = (FAR struct ssd1680_dev_s *)dev;
bitscpy_ss(buffer, bitscpy_ss(buffer,
priv->shadow_fb + row * SSD1680_DEV_FBSIZE + (col >> SSD1680_PDF), priv->shadow_fb + row * SSD1680_DEV_FBSIZE + (col >> SSD1680_PDF),
@@ -381,6 +387,7 @@ static int ssd1680_getplaneinfo(FAR struct lcd_dev_s *dev,
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+13 -18
View File
@@ -192,10 +192,11 @@ static inline int st7565_backlight(FAR struct st7565_dev_s *priv, int level);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int st7565_putrun(fb_coord_t row, fb_coord_t col, static int st7565_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t * buffer, size_t npixels); fb_coord_t col, FAR const uint8_t *buffer,
static int st7565_getrun(fb_coord_t row, fb_coord_t col, size_t npixels);
FAR uint8_t * buffer, static int st7565_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
fb_coord_t col, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
/* LCD Configuration */ /* LCD Configuration */
@@ -416,6 +417,7 @@ static inline int st7565_backlight(FAR struct st7565_dev_s *priv, int level)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -424,14 +426,11 @@ static inline int st7565_backlight(FAR struct st7565_dev_s *priv, int level)
* *
****************************************************************************/ ****************************************************************************/
static int st7565_putrun(fb_coord_t row, fb_coord_t col, static int st7565_putrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR const uint8_t * buffer, size_t npixels) fb_coord_t col, FAR const uint8_t *buffer,
size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct st7565_dev_s *priv = (FAR struct st7565_dev_s *)dev;
* ST7565 device.
*/
FAR struct st7565_dev_s *priv = &g_st7565dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t fbmask; uint8_t fbmask;
@@ -578,15 +577,11 @@ static int st7565_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int st7565_getrun(fb_coord_t row, fb_coord_t col, static int st7565_getrun(FAR struct lcd_dev_s *dev, fb_coord_t row,
FAR uint8_t * buffer, fb_coord_t col, FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct st7565_dev_s *priv = (FAR struct st7565_dev_s *)dev;
* ST7565 device.
*/
FAR struct st7565_dev_s *priv = &g_st7565dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
uint8_t page; uint8_t page;
uint8_t fbmask; uint8_t fbmask;
+15 -15
View File
@@ -224,10 +224,12 @@ static void st7567_deselect(FAR struct spi_dev_s *spi);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int st7567_putrun(fb_coord_t row, fb_coord_t col, static int st7567_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int st7567_getrun(fb_coord_t row, fb_coord_t col, static int st7567_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -395,6 +397,7 @@ static void st7567_deselect(FAR struct spi_dev_s *spi)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -403,15 +406,12 @@ static void st7567_deselect(FAR struct spi_dev_s *spi)
* *
****************************************************************************/ ****************************************************************************/
static int st7567_putrun(fb_coord_t row, fb_coord_t col, static int st7567_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct st7567_dev_s *priv = (FAR struct st7567_dev_s *)dev;
* ST7567 device
*/
FAR struct st7567_dev_s *priv = &g_st7567dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t fbmask; uint8_t fbmask;
@@ -547,6 +547,7 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -555,14 +556,12 @@ static int st7567_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int st7567_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int st7567_getrun(FAR struct lcd_dev_s *dev,
size_t npixels) fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct st7567_dev_s *priv = (FAR struct st7567_dev_s *)dev;
* ST7567 device
*/
FAR struct st7567_dev_s *priv = &g_st7567dev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
uint8_t page; uint8_t page;
uint8_t fbmask; uint8_t fbmask;
@@ -704,6 +703,7 @@ static int st7567_getplaneinfo(FAR struct lcd_dev_s *dev,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+13 -7
View File
@@ -208,10 +208,12 @@ static void st7735_fill(FAR struct st7735_dev_s *dev, uint16_t color);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int st7735_putrun(fb_coord_t row, fb_coord_t col, static int st7735_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int st7735_getrun(fb_coord_t row, fb_coord_t col, static int st7735_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels); FAR uint8_t *buffer, size_t npixels);
#endif #endif
@@ -520,6 +522,7 @@ static void st7735_fill(FAR struct st7735_dev_s *dev, uint16_t color)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -528,10 +531,11 @@ static void st7735_fill(FAR struct st7735_dev_s *dev, uint16_t color)
* *
****************************************************************************/ ****************************************************************************/
static int st7735_putrun(fb_coord_t row, fb_coord_t col, static int st7735_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
FAR struct st7735_dev_s *priv = &g_lcddev; FAR struct st7735_dev_s *priv = (FAR struct st7735_dev_s *)dev;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -558,10 +562,11 @@ static int st7735_putrun(fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int st7735_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int st7735_getrun(FAR struct lcd_dev_s *dev,
size_t npixels) fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels)
{ {
FAR struct st7735_dev_s *priv = &g_lcddev; FAR struct st7735_dev_s *priv = (FAR struct st7735_dev_s *)dev;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -619,6 +624,7 @@ static int st7735_getplaneinfo(FAR struct lcd_dev_s *dev,
#endif #endif
pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */ pinfo->buffer = (FAR uint8_t *)priv->runbuffer; /* Run scratch buffer */
pinfo->bpp = priv->bpp; /* Bits-per-pixel */ pinfo->bpp = priv->bpp; /* Bits-per-pixel */
pinfo->dev = dev; /* The lcd device */
return OK; return OK;
} }
+19 -10
View File
@@ -195,13 +195,16 @@ static void st7789_fill(FAR struct st7789_dev_s *dev, uint16_t color);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int st7789_putrun(fb_coord_t row, fb_coord_t col, static int st7789_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
static int st7789_putarea(fb_coord_t row_start, fb_coord_t row_end, static int st7789_putarea(FAR struct lcd_dev_s *dev,
fb_coord_t row_start, fb_coord_t row_end,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t col_start, fb_coord_t col_end,
FAR const uint8_t *buffer); FAR const uint8_t *buffer);
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int st7789_getrun(fb_coord_t row, fb_coord_t col, static int st7789_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels); FAR uint8_t *buffer, size_t npixels);
#endif #endif
@@ -503,6 +506,7 @@ static void st7789_fill(FAR struct st7789_dev_s *dev, uint16_t color)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -511,10 +515,11 @@ static void st7789_fill(FAR struct st7789_dev_s *dev, uint16_t color)
* *
****************************************************************************/ ****************************************************************************/
static int st7789_putrun(fb_coord_t row, fb_coord_t col, static int st7789_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
FAR struct st7789_dev_s *priv = &g_lcddev; FAR struct st7789_dev_s *priv = (FAR struct st7789_dev_s *)dev;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
@@ -532,6 +537,7 @@ static int st7789_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to write a partial area to the LCD: * This method can be used to write a partial area to the LCD:
* *
* dev - The lcd device
* row_start - Starting row to write to (range: 0 <= row < yres) * row_start - Starting row to write to (range: 0 <= row < yres)
* row_end - Ending row to write to (range: row_start <= row < yres) * row_end - Ending row to write to (range: row_start <= row < yres)
* col_start - Starting column to write to (range: 0 <= col <= xres) * col_start - Starting column to write to (range: 0 <= col <= xres)
@@ -541,11 +547,12 @@ static int st7789_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int st7789_putarea(fb_coord_t row_start, fb_coord_t row_end, static int st7789_putarea(FAR struct lcd_dev_s *dev,
fb_coord_t row_start, fb_coord_t row_end,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t col_start, fb_coord_t col_end,
FAR const uint8_t *buffer) FAR const uint8_t *buffer)
{ {
FAR struct st7789_dev_s *priv = &g_lcddev; FAR struct st7789_dev_s *priv = (FAR struct st7789_dev_s *)dev;
FAR const uint16_t *src = (FAR const uint16_t *)buffer; FAR const uint16_t *src = (FAR const uint16_t *)buffer;
ginfo("row_start: %d row_end: %d col_start: %d col_end: %d\n", ginfo("row_start: %d row_end: %d col_start: %d col_end: %d\n",
@@ -566,6 +573,7 @@ static int st7789_putarea(fb_coord_t row_start, fb_coord_t row_end,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD: * This method can be used to read a partial raster line from the LCD:
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -575,10 +583,11 @@ static int st7789_putarea(fb_coord_t row_start, fb_coord_t row_end,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_LCD_NOGETRUN #ifndef CONFIG_LCD_NOGETRUN
static int st7789_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int st7789_getrun(FAR struct lcd_dev_s *dev,
size_t npixels) fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, size_t npixels)
{ {
FAR struct st7789_dev_s *priv = &g_lcddev; FAR struct st7789_dev_s *priv = (FAR struct st7789_dev_s *)dev;
FAR uint16_t *dest = (FAR uint16_t *)buffer; FAR uint16_t *dest = (FAR uint16_t *)buffer;
ginfo("row: %d col: %d npixels: %d\n", row, col, npixels); ginfo("row: %d col: %d npixels: %d\n", row, col, npixels);
+16 -17
View File
@@ -290,9 +290,11 @@ static void ug2864ambag01_unlock(FAR struct spi_dev_s *spi);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col, static int ug2864ambag01_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, size_t npixels); FAR const uint8_t *buffer, size_t npixels);
static int ug2864ambag01_getrun(fb_coord_t row, fb_coord_t col, static int ug2864ambag01_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -455,6 +457,7 @@ static inline void ug2864ambag01_unlock(FAR struct spi_dev_s *spi)
* This method can be used to write a partial raster line to the LCD. * This method can be used to write a partial raster line to the LCD.
* *
* Input Parameters: * Input Parameters:
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -464,16 +467,12 @@ static inline void ug2864ambag01_unlock(FAR struct spi_dev_s *spi)
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) #if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col, static int ug2864ambag01_putrun(FAR struct lcd_dev_s *dev,
FAR const uint8_t *buffer, fb_coord_t row, fb_coord_t col,
size_t npixels) FAR const uint8_t *buffer, size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct ug2864ambag01_dev_s *priv = (FAR struct ug2864ambag01_dev_s *)
* UG device dev;
*/
FAR struct ug2864ambag01_dev_s *priv =
(FAR struct ug2864ambag01_dev_s *)&g_oleddev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t devcol; uint8_t devcol;
@@ -673,6 +672,7 @@ static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to write a partial raster line to the LCD. * This method can be used to write a partial raster line to the LCD.
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -682,15 +682,13 @@ static int ug2864ambag01_putrun(fb_coord_t row, fb_coord_t col,
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) #if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE)
static int ug2864ambag01_getrun(fb_coord_t row, fb_coord_t col, static int ug2864ambag01_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct ug2864ambag01_dev_s *priv = (FAR struct ug2864ambag01_dev_s *)
* UG device dev;
*/
FAR struct ug2864ambag01_dev_s *priv = &g_oleddev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
uint8_t page; uint8_t page;
uint8_t fbmask; uint8_t fbmask;
@@ -867,6 +865,7 @@ static int ug2864ambag01_getplaneinfo(FAR struct lcd_dev_s *dev,
DEBUGASSERT(pinfo && planeno == 0); DEBUGASSERT(pinfo && planeno == 0);
lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); lcdinfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+14 -14
View File
@@ -234,10 +234,12 @@ static void ug_deselect(FAR struct spi_dev_s *spi);
/* LCD Data Transfer Methods */ /* LCD Data Transfer Methods */
static int ug_putrun(fb_coord_t row, fb_coord_t col, static int ug_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels); size_t npixels);
static int ug_getrun(fb_coord_t row, fb_coord_t col, static int ug_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer, FAR uint8_t *buffer,
size_t npixels); size_t npixels);
@@ -432,6 +434,7 @@ static void ug_deselect(FAR struct spi_dev_s *spi)
* Description: * Description:
* This method can be used to write a partial raster line to the LCD: * This method can be used to write a partial raster line to the LCD:
* *
* dev - The lcd device
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -440,15 +443,12 @@ static void ug_deselect(FAR struct spi_dev_s *spi)
* *
****************************************************************************/ ****************************************************************************/
static int ug_putrun(fb_coord_t row, fb_coord_t col, static int ug_putrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR const uint8_t *buffer, FAR const uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct ug_dev_s *priv = (FAR struct ug_dev_s *)dev;
* UG device
*/
FAR struct ug_dev_s *priv = &g_ugdev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
FAR uint8_t *ptr; FAR uint8_t *ptr;
uint8_t devcol; uint8_t devcol;
@@ -634,6 +634,7 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col,
* Description: * Description:
* This method can be used to read a partial raster line from the LCD. * This method can be used to read a partial raster line from the LCD.
* *
* dev - The lcd device
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read (range: 0 <= col <= xres-npixels) * col - Starting column to read read (range: 0 <= col <= xres-npixels)
* buffer - The buffer in which to return the run read from the LCD * buffer - The buffer in which to return the run read from the LCD
@@ -642,14 +643,12 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col,
* *
****************************************************************************/ ****************************************************************************/
static int ug_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, static int ug_getrun(FAR struct lcd_dev_s *dev,
fb_coord_t row, fb_coord_t col,
FAR uint8_t *buffer,
size_t npixels) size_t npixels)
{ {
/* Because of this line of code, we will only be able to support a single FAR struct ug_dev_s *priv = (FAR struct ug_dev_s *)dev;
* UG device
*/
FAR struct ug_dev_s *priv = &g_ugdev;
FAR uint8_t *fbptr; FAR uint8_t *fbptr;
uint8_t page; uint8_t page;
uint8_t fbmask; uint8_t fbmask;
@@ -822,6 +821,7 @@ static int ug_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
DEBUGASSERT(dev && pinfo && planeno == 0); DEBUGASSERT(dev && pinfo && planeno == 0);
ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); ginfo("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp);
memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s));
pinfo->dev = dev;
return OK; return OK;
} }
+2 -2
View File
@@ -92,7 +92,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
pinfo->buffer, pinfo->buffer,
remainder, remainder,
ncols); ncols);
pinfo->putrun(row, dest->pt1.x, pinfo->buffer, ncols); pinfo->putrun(pinfo->dev, row, dest->pt1.x, pinfo->buffer, ncols);
} }
else else
#endif #endif
@@ -101,7 +101,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
* Copy the image data directly from the image memory. * Copy the image data directly from the image memory.
*/ */
pinfo->putrun(row, dest->pt1.x, sline, ncols); pinfo->putrun(pinfo->dev, row, dest->pt1.x, sline, ncols);
} }
/* Then adjust the source pointer to refer to the next line in /* Then adjust the source pointer to refer to the next line in
+1 -1
View File
@@ -78,6 +78,6 @@ void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
{ {
/* Draw the raster line at this row */ /* Draw the raster line at this row */
pinfo->putrun(row, rect->pt1.x, pinfo->buffer, ncols); pinfo->putrun(pinfo->dev, row, rect->pt1.x, pinfo->buffer, ncols);
} }
} }
+1 -1
View File
@@ -220,7 +220,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)
/* Then draw the run from ix1 to ix2 at row */ /* Then draw the run from ix1 to ix2 at row */
ncols = ix2 - ix1 + 1; ncols = ix2 - ix1 + 1;
pinfo->putrun(row, ix1, pinfo->buffer, ncols); pinfo->putrun(pinfo->dev, row, ix1, pinfo->buffer, ncols);
} }
/* Add the dx/dy value to get the run positions on the next row */ /* Add the dx/dy value to get the run positions on the next row */
+1 -1
View File
@@ -66,7 +66,7 @@ void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX)
for (srcrow = rect->pt1.y; srcrow <= rect->pt2.y; srcrow++) for (srcrow = rect->pt1.y; srcrow <= rect->pt2.y; srcrow++)
{ {
pinfo->getrun(srcrow, rect->pt1.x, dline, ncols); pinfo->getrun(pinfo->dev, srcrow, rect->pt1.x, dline, ncols);
dline += deststride; dline += deststride;
} }
} }
+8 -4
View File
@@ -72,8 +72,10 @@ void NXGL_FUNCNAME(nxgl_moverectangle, NXGLIB_SUFFIX)
srcrow <= rect->pt2.y; srcrow <= rect->pt2.y;
srcrow++, destrow++) srcrow++, destrow++)
{ {
pinfo->getrun(srcrow, rect->pt1.x, pinfo->buffer, ncols); pinfo->getrun(pinfo->dev, srcrow, rect->pt1.x, pinfo->buffer,
pinfo->putrun(destrow, offset->x, pinfo->buffer, ncols); ncols);
pinfo->putrun(pinfo->dev, destrow, offset->x, pinfo->buffer,
ncols);
} }
} }
@@ -91,8 +93,10 @@ void NXGL_FUNCNAME(nxgl_moverectangle, NXGLIB_SUFFIX)
srcrow >= rect->pt1.y; srcrow >= rect->pt1.y;
srcrow--, destrow--) srcrow--, destrow--)
{ {
pinfo->getrun(srcrow, rect->pt1.x, pinfo->buffer, ncols); pinfo->getrun(pinfo->dev, srcrow, rect->pt1.x, pinfo->buffer,
pinfo->putrun(destrow, offset->x, pinfo->buffer, ncols); ncols);
pinfo->putrun(pinfo->dev, destrow, offset->x, pinfo->buffer,
ncols);
} }
} }
} }
+4 -3
View File
@@ -67,7 +67,7 @@ void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
/* Read the byte that contains the pixel to be changed */ /* Read the byte that contains the pixel to be changed */
pinfo->getrun(pos->y, pos->x, &pixel, 8 / NXGLIB_BITSPERPIXEL); pinfo->getrun(pinfo->dev, pos->y, pos->x, &pixel, 8 / NXGLIB_BITSPERPIXEL);
/* Shift the color into the proper position */ /* Shift the color into the proper position */
@@ -114,13 +114,14 @@ void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
/* Write the modified byte back to graphics memory */ /* Write the modified byte back to graphics memory */
pinfo->putrun(pos->y, pinfo->putrun(pinfo->dev,
pos->y,
pos->x, pos->x,
(FAR uint8_t *)&pixel, (FAR uint8_t *)&pixel,
8 / NXGLIB_BITSPERPIXEL); 8 / NXGLIB_BITSPERPIXEL);
#else #else
/* Draw a single pixel at this position raster line at this row */ /* Draw a single pixel at this position raster line at this row */
pinfo->putrun(pos->y, pos->x, (FAR uint8_t *)&color, 1); pinfo->putrun(pinfo->dev, pos->y, pos->x, (FAR uint8_t *)&color, 1);
#endif #endif
} }
+23 -11
View File
@@ -45,6 +45,8 @@
* Type Definitions * Type Definitions
****************************************************************************/ ****************************************************************************/
struct lcd_dev_s;
/* This structure describes one color plane. Some YUV formats may support /* This structure describes one color plane. Some YUV formats may support
* up to 4 planes (although they probably wouldn't be used on LCD hardware). * up to 4 planes (although they probably wouldn't be used on LCD hardware).
* The framebuffer driver provides the video memory address in its * The framebuffer driver provides the video memory address in its
@@ -58,6 +60,7 @@ struct lcd_planeinfo_s
/* This method can be used to write a partial raster line to the LCD: /* This method can be used to write a partial raster line to the LCD:
* *
* dev - LCD interface to write to
* row - Starting row to write to (range: 0 <= row < yres) * row - Starting row to write to (range: 0 <= row < yres)
* col - Starting column to write to (range: 0 <= col <= xres-npixels) * col - Starting column to write to (range: 0 <= col <= xres-npixels)
* buffer - The buffer containing the run to be written to the LCD * buffer - The buffer containing the run to be written to the LCD
@@ -65,11 +68,12 @@ struct lcd_planeinfo_s
* (range: 0 < npixels <= xres-col) * (range: 0 < npixels <= xres-col)
*/ */
int (*putrun)(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, int (*putrun)(FAR struct lcd_dev_s *dev, fb_coord_t row, fb_coord_t col,
size_t npixels); FAR const uint8_t *buffer, size_t npixels);
/* This method can be used to write a rectangular area to the LCD: /* This method can be used to write a rectangular area to the LCD:
* *
* dev - LCD interface to write to
* row_start - Starting row to write to (range: 0 <= row < yres) * row_start - Starting row to write to (range: 0 <= row < yres)
* row_end - Ending row to write to (range: row_start <= row < yres) * row_end - Ending row to write to (range: row_start <= row < yres)
* col_start - Starting column to write to (range: 0 <= col <= xres) * col_start - Starting column to write to (range: 0 <= col <= xres)
@@ -82,12 +86,13 @@ struct lcd_planeinfo_s
* used. * used.
*/ */
int (*putarea)(fb_coord_t row_start, fb_coord_t row_end, int (*putarea)(FAR struct lcd_dev_s *dev, fb_coord_t row_start,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t row_end, fb_coord_t col_start,
FAR const uint8_t *buffer); fb_coord_t col_end, FAR const uint8_t *buffer);
/* This method can be used to read a partial raster line from the LCD: /* This method can be used to read a partial raster line from the LCD:
* *
* dev - LCD interface to read from
* row - Starting row to read from (range: 0 <= row < yres) * row - Starting row to read from (range: 0 <= row < yres)
* col - Starting column to read read * col - Starting column to read read
* (range: 0 <= col <= xres-npixels) * (range: 0 <= col <= xres-npixels)
@@ -96,11 +101,12 @@ struct lcd_planeinfo_s
* (range: 0 < npixels <= xres-col) * (range: 0 < npixels <= xres-col)
*/ */
int (*getrun)(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, int (*getrun)(FAR struct lcd_dev_s *dev, fb_coord_t row,
size_t npixels); fb_coord_t col, FAR uint8_t *buffer, size_t npixels);
/* This method can be used to read a rectangular area from the LCD: /* This method can be used to read a rectangular area from the LCD:
* *
* dev - LCD interface to read from
* row_start - Starting row to read from (range: 0 <= row < yres) * row_start - Starting row to read from (range: 0 <= row < yres)
* row_end - Ending row to read from (range: row_start <= row < yres) * row_end - Ending row to read from (range: row_start <= row < yres)
* col_start - Starting column to read from (range: 0 <= col <= xres) * col_start - Starting column to read from (range: 0 <= col <= xres)
@@ -113,9 +119,9 @@ struct lcd_planeinfo_s
* used. * used.
*/ */
int (*getarea)(fb_coord_t row_start, fb_coord_t row_end, int (*getarea)(FAR struct lcd_dev_s *dev, fb_coord_t row_start,
fb_coord_t col_start, fb_coord_t col_end, fb_coord_t row_end, fb_coord_t col_start,
FAR uint8_t *buffer); fb_coord_t col_end, FAR uint8_t *buffer);
/* Plane color characteristics ********************************************/ /* Plane color characteristics ********************************************/
@@ -131,7 +137,7 @@ struct lcd_planeinfo_s
* buffers. * buffers.
*/ */
uint8_t *buffer; FAR uint8_t *buffer;
/* This is the number of bits in one pixel. This may be one of {1, 2, 4, /* This is the number of bits in one pixel. This may be one of {1, 2, 4,
* 8, 16, 24, or 32} unless support for one or more of those resolutions * 8, 16, 24, or 32} unless support for one or more of those resolutions
@@ -139,6 +145,12 @@ struct lcd_planeinfo_s
*/ */
uint8_t bpp; uint8_t bpp;
/* This is the LCD interface corresponding to which this color plane
* belongs.
*/
FAR struct lcd_dev_s *dev;
}; };
/* This structure defines an LCD interface */ /* This structure defines an LCD interface */
+4 -4
View File
@@ -110,7 +110,7 @@ extern "C"
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: mio283qt2_lcdinitialize * Name: mio283qt9a_lcdinitialize
* *
* Description: * Description:
* Initialize the LCD video hardware. The initial state of the LCD is fully * Initialize the LCD video hardware. The initial state of the LCD is fully
@@ -119,11 +119,11 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
FAR struct lcd_dev_s *mio283qt2_lcdinitialize( FAR struct lcd_dev_s *mio283qt9a_lcdinitialize(
FAR struct mio283qt9a_lcd_s *lcd); FAR struct mio283qt9a_lcd_s *lcd);
/**************************************************************************** /****************************************************************************
* Name: mio283qt2_clear * Name: mio283qt9a_clear
* *
* Description: * Description:
* This is a non-standard LCD interface. Because of the various rotations, * This is a non-standard LCD interface. Because of the various rotations,
@@ -133,7 +133,7 @@ FAR struct lcd_dev_s *mio283qt2_lcdinitialize(
* *
****************************************************************************/ ****************************************************************************/
void mio283qt2_clear(FAR struct lcd_dev_s *dev, uint16_t color); void mio283qt9a_clear(FAR struct lcd_dev_s *dev, uint16_t color);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus