nuttx/drivers/lcd
Tiago Medicci Serrano ab60d0d3fb Framebuffer's callback buffer starts from the area being drawn.
The commit 664d45dcba updated the
behavior of the framebuffer's putarea callback enabling it to be
used to draw a particular area of the display. Previously, putarea
was only used to draw the entire area of the display. Any different
area was drawn, row by row, by putrun. Also, before checking for
which callback to call, the framebuffer driver adjusted the buffer
reference that was going to be used for calling the driver's callback
to point to the init of the relevant data. After that commit, the
framebuffer's buffer reference passed to the driver's putarea now
contains the data to draw the entire display. Unlike the previous
version of that implementation, only the putrun's callback buffer
was being referenced from the address that contains the data that
actually is being drawn.

This commit fixes it by adjusting the reference for the run buffer
passed to the putrun/putarea callback. It always starts from the
beginning of the relevant data that is actually being drawn. That is
necessary because lcddev (which uses the same LCD display driver
callbacks) actually don't allocate a buffer containing the data to
draw the whole display, so the same putarea implementation of the
LCD drivers would'n be able to work for both lcddev and framebuffer.
Also it's necessary to pass the stride argument to the LCD drivers
in order to enable them to do partial writes by calculating the
buffer offset while sending row-by-row. The stride is equal the
width multiplied by the bytes per pixel (may add some padding)
for framebuffer and is equal to the lenght of the row being drawn
(multiplied by the same BPP) for lcddev.

Why this approach?
Other possible approaches would be:
1) modify lcddev driver to translate received buffer data to a
buffer similar to the framebuffer. That wouldn't be efficient
considering memory allocation.
2) Create a new callback function. While possible, it'd be confusing
to create a different callback to draw the whole screen and another
to draw only an area of the screen. Also, these callbacks would
differ themselves only from the way the buffer is filled.
3) Simply reverting 664d45dcba would
break the usage of the putarea callback to draw an area of the
display, which would also be inefficient.

This approach is based on the Zephyr's implementation of the ST7789
driver: the buffer starts from the beginiing of the region that would
be drawn. The display device driver's putarea implementation should
check if the operation refers to a full screen/full row and implement
(if possible) a single operation to send the data to be drawn more
efficiently.

Finally, this approach requires that the drivers which implement
the putarea callback and expects the entire framebuffer buffer
to be modified. They don't need to calculate where the data begins
as the new buffer represents the data from the address that is
actually being drawn. This includes adjusting the LCD drivers
GC9A01 and ST7789 and the driver for APA102-based LED matrix display.
2022-08-13 20:36:45 +08:00
..
apa102.c Framebuffer's callback buffer starts from the area being drawn. 2022-08-13 20:36:45 +08:00
ft80x_spi.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
ft80x.c Don't include assert.h from public header file 2021-06-03 08:36:03 -07:00
ft80x.h pid_t: unify usage of special task IDs 2022-03-22 21:22:32 +08:00
gc9a01.c Framebuffer's callback buffer starts from the area being drawn. 2022-08-13 20:36:45 +08:00
gc9a01.h drivers/lcd: Add GC9A01 driver and refine ST7735 2021-09-16 08:39:35 -03:00
ht16k33_14seg.c drivers: remove unimplemented open/close/ioctl interfaces 2022-04-15 16:56:25 +08:00
ili9225.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ili9340.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ili9341.c drivers/lcd: Fix regression on ILI9341 introduced after #6465 2022-06-24 17:44:53 -03:00
Kconfig drivers/lcd: Add support to use APA102 LED Matrix as LCD Display 2022-07-19 18:50:04 +03:00
lcd_dev.c Framebuffer's callback buffer starts from the area being drawn. 2022-08-13 20:36:45 +08:00
lcd_framebuffer.c Framebuffer's callback buffer starts from the area being drawn. 2022-08-13 20:36:45 +08:00
lcddrv_spiif.c drivers: lcd: update licenses to Apache 2021-08-17 19:52:31 -07:00
lpm013m091a.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
Make.defs drivers/lcd: Add support to use APA102 LED Matrix as LCD Display 2022-07-19 18:50:04 +03:00
max7219.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
memlcd.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
mio283qt2.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
mio283qt9a.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
p14201.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
pcd8544.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
pcd8544.h
pcf8574_lcd_backpack_readme.txt
pcf8574_lcd_backpack.c drivers: remove unimplemented open/close/ioctl interfaces 2022-04-15 16:56:25 +08:00
pcf8833.h
ra8875.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ra8875.h
README.txt
s1d15g10.h
sd1329.h
skeleton.c drivers/lcd: getplaneinfo fix for ST7789,ST7565 and skeleton driver 2022-06-26 22:24:36 +03:00
ssd1289.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ssd1289.h
ssd1305.h
ssd1306_base.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ssd1306_i2c.c
ssd1306_spi.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ssd1306.h Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ssd1351.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ssd1680.c SSD1680 Landscape mode bugfix 2022-07-09 16:13:22 +08:00
ssd1680.h Fix various typos 2022-07-08 02:15:54 +08:00
st7032.c drivers: remove unimplemented open/close/ioctl interfaces 2022-04-15 16:56:25 +08:00
st7565.c drivers/lcd: getplaneinfo fix for ST7789,ST7565 and skeleton driver 2022-06-26 22:24:36 +03:00
st7565.h author: Zilogic Systems: update licenses to Apache 2021-07-19 03:08:00 -07:00
st7567.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
st7567.h author: Zilogic Systems: update licenses to Apache 2021-07-19 03:08:00 -07:00
st7735.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
st7735.h drivers/lcd: Add GC9A01 driver and refine ST7735 2021-09-16 08:39:35 -03:00
st7789.c Framebuffer's callback buffer starts from the area being drawn. 2022-08-13 20:36:45 +08:00
st7789.h
tda19988.c drivers: update licenses to Apache 2021-09-01 11:56:31 +08:00
tda19988.h
ug-2864ambag01.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00
ug-9664hswag01.c Add lcd_dev_s pointer to lcd_planeinfo_s 2022-06-21 21:33:23 +08:00

nuttx/drivers/lcd README
========================

This is the README.txt file for the drivers/lcd/ directory.

Contents
========

  - LCD Header files
    include/nuttx/lcd/lcd.h
    struct lcd_dev_s
  - Binding LCD Drivers
  - Examples: /drivers/lcd/
  - Examples: boards/
  - graphics/

LCD Header files
================

  include/nuttx/lcd/lcd.h

      Structures and APIs needed to work with LCD drivers are provided in
      this header file.  This header file also depends on some of the same
      definitions used for the frame buffer driver as provided in
      include/nuttx/video/fb.h.

  struct lcd_dev_s

      Each LCD device driver must implement an instance of struct lcd_dev_s.
      That structure defines a call table with the following methods:

      - Get information about the LCD video controller configuration and the
        configuration of each LCD color plane.

        int (*getvideoinfo)(FAR struct lcd_dev_s *dev,
                            FAR struct fb_videoinfo_s *vinfo);
        int (*getplaneinfo)(FAR struct lcd_dev_s *dev, unsigned int planeno,
                            FAR struct lcd_planeinfo_s *pinfo);

      - The following are provided only if the video hardware supports RGB
        color mapping:

        int (*getcmap)(FAR struct lcd_dev_s *dev,
                       FAR struct fb_cmap_s *cmap);
        int (*putcmap)(FAR struct lcd_dev_s *dev,
                       FAR const struct fb_cmap_s *cmap);

      - The following are provided only if the video hardware supports a
        hardware cursor:

        int (*getcursor)(FAR struct lcd_dev_s *dev,
                         FAR struct fb_cursorattrib_s *attrib);
        int (*setcursor)(FAR struct lcd_dev_s *dev,
                         FAR struct fb_setcursor_s *settings);

      - Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER:
        full on). On backlit LCDs, this setting may correspond to the
        backlight setting.

        int (*getpower)(struct lcd_dev_s *dev);

      - Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER:
        full on). On backlit LCDs, this setting may correspond to the
        backlight setting.

        int (*setpower)(struct lcd_dev_s *dev, int power);

      - Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST) */

        int (*getcontrast)(struct lcd_dev_s *dev);

     - Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST)

        int (*setcontrast)(struct lcd_dev_s *dev, unsigned int contrast);

Binding LCD Drivers
===================

  LCD drivers are not normally directly accessed by user code, but are
  usually bound to another,  higher level device driver. In general, the
  binding sequence is:

  1. Get an instance of struct lcd_dev_s from the hardware-specific LCD
     device driver, and
  2. Provide that instance to the initialization method of the higher
     level device driver.

Examples: /drivers/lcd/
=======================

Re-usable LCD drivers reside in the drivers/lcd directory:

  LCDs:
  ----
  mio283qt2.c. This is a driver for the MI0283QT-2 LCD from Multi-Inno
    Technology Co., Ltd.  This LCD is based on the Himax HX8347-D LCD
    controller.

  mio283qt9a.c.  This is a driver for the MI0283QT-9A LCD from Multi-Inno
    Technology Co., Ltd.  This LCD is based on the Ilitek ILI9341 LCD
    controller.

  ssd12989.c.  Generic LCD driver for LCDs based on the Solomon Systech
    SSD1289 LCD controller. Think of this as a template for an LCD driver
    that you will probably have to customize for any particular LCD
    hardware. (See also boards/arm/stm32/hymini-stm32v/src/ssd1289.c below).

  st7567.c.  LCD Display Module, ST7567, Univision Technology Inc. Used
    with the LPCXpresso and Embedded Artists base board.

  memlcd.c.  Sharp Memory LCD Suite, LS013B7DH01, LS013B7DH03, etc.
    There are some more different models, they are basically controlled
    by similar logics, thus this driver can be extended.

  ra8875.c.  RAiO Technologies RA8875 LCD controller.  Contributed by
    Marten Svanfeldt.

  OLEDs:
  -----
  p14201.c.  Driver for RiT P14201 series display with SD1329 IC
    controller.  Based on the SD1329 controller.  This OLED is used with
    older versions of the TI/Luminary LM3S8962 Evaluation Kit.  Example
    usage:

      boards/arm/tiva/lm3s6965-ek/src
      boards/arm/tiva/lm3s8962-ek/src

  ug-2864ambag01.c.  OLED Display Module, UUG-2864AMBAG01, Univision
    Technology Inc.  Based on the SH1101A controller.  Example usage:

      boards/arm/stm32/stm32f4discovery
      boards/arm/lpc214x/zp214xpa

  ug-9664hswag01.c.  OLED Display Module, UG-9664HSWAG01, Univision
    Technology Inc.  Based on the SSD1305 controller.  Used with the
    LPC Xpresso and Embedded Artists base board.  Example usage:

      boards/arm/lpc71xx_40xx/lpcxpresso-lpc1768

  ssd1306.c.  OLED Display Modules based on the SSD1306 controllers.
    This includes the UG-2864HSWEG01 and UG2832HSWEG04, both from Univision
    Technology Inc.  The latter is used with the OLED1 module that comes
    with the Atmel SAM4l Xplained Pro board.  This driver also supports
    Densitron Technologies DD-12864WO-4A which is based on SSD1309 LCD
    controller. Example usage:

      boards/arm/stm32/stm32f4discovery
      boards/arm/sam34/sam4l-xplained

  Segment LCDS (SLCDs):
  ---------------------

  pcf8574_lcd_backpack.c:  See pcf8574_lcd_backpack_readme.txt.

Examples: boards/
==================

There are additional LCD drivers in the boards/<arch>/<chip>/<board>/src
directory that support additional LCDs.  LCD drivers in the configuration
directory if they support some differ LCD interface (such as a parallel
interface) that makes then less re-usable:

  SSD1289 Drivers:

    boards/arm/stm32/hymini-stm32v/src/ssd1289.c.  See also
      drivers/lcd/ssd1298.c above.
    boards/arm/stm32/stm32f4discovery/src/stm32_ssd1289.c.  This examples
      is the bottom half for the SSD1289 driver at drivers/lcd/ssd1289.c
    boards/arm/stm32/hymini-stm32v/src/ssd1289.c.  See also
      drivers/lcd/ssd1298.c above.
    boards/arm/stm32/shenzhou/src/stm32_ssd1289.c

  kwikstik-k40:

    boards/arm/kinetis/kwikstik-k40/src/k40_lcd.c.  Don't waste your time.
      This is just a stub.

  HX8346:

    boards/arm/sam34/sam3u-ek/src/sam_lcd.c.  The SAM3U-EK development board
      features a TFT/Transmissive color LCD module with touch-screen,
      FTM280C12D, with integrated driver IC HX8346.

  HX8347:

    boards/mips/pic32mx/pic32mx7mmb/src/pic32_mio283qt2.c.  This driver is
      for the MI0283QT-2 LCD from Multi-Inno Technology Co., Ltd. This LCD
      is based on the Himax HX8347-D LCD controller.

  ILI93xx and Similar:

    boards/arm/stm32/stm3210e-eval/src/stm32_lcd.c. This driver supports the
    following LCDs:

      1. Ampire AM-240320LTNQW00H
      2. Orise Tech SPFD5408B
      3. RenesasSP R61580

    boards/arm/stm32/stm3220g-eval/src/stm32_lcd.c and
    boards/stm3240g-eval/src/smt32_lcd.c.
      AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) and
      AM-240320D5TOQW01H (LCD_ILI9325)

    boards/arm/stm32/shenzhou/src/stm32_ili93xx.c. Another ILI93xx driver.
    config/arm/sam34/sam4e-ek/src/sam_ili9325.c. ILI9325 driver
    config/arm/sam34/sam4e-ek/src/sam_ili9341.c. ILI9341 driver

  ILI9488

    boards/arm/samv7/samv71-xult/src/sam_ili9488.c
    include/nuttx/lcd/ili9488.h

  R61505U

    boards/arm/stm32/hymini-stm32v/src/stm32_r61505u.c

  Sharp Memory LCD:

    boards/arm/stm32/maple/src/stm32_lcd.c

  OLEDs:

    boards/arm/stm32/stm32f4discovery/src/stm32_ug2864ambag01.c
    boards/arm/stm32/stm32f4discovery/src/stm32_ug2864hsweg01.c
    boards/arm/sam34/sam4l-xplained/src/sam_ug2832hsweg04.c
    boards/arm/lpc214x/zp214xpa/src/lpc2148_ug2864ambag01.c

  LCD controllers built-into the MCU:

    arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.c and
    boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_lcd.c.
      RGB LCD display panel.
    boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c.  1x6 segment LCD with
      bars using the segment LCD controller built-into the STM32L15X.

  Alphanumeric/segment LCD Displays:

    boards/renesas/m16c/skp16c26/src/m16c_lcd.c.  Untested alphanumeric
      LCD driver.
    boards/mips/pic32mx/sure-pic32mx/src/pic32_lcd1602.c. An LCD1602 segment
      LCD.  This is a bit-bang version of the driver and appears to
      be fully functional.  This version of the LCD1602 driver has
      been verified and is working fine.
    boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c.  1x6 segment LCD with
      bars using the segment LCD controller built-into the STM32L15X.

  TFT Panel Drivers:

    boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_lcd.c and
    arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.c
    boards/arm/sama5/sama5d3x-ek/src and boards/arm/sama5/sama5d4-ek/src:
    Use
      arch/arm/src/sama5/sam_lcd.c

graphics/
=========

  See also the usage of the LCD driver in the graphics/ directory.