diff --git a/docs/src/integration/external_display_controllers/gen_mipi.rst b/docs/src/integration/external_display_controllers/gen_mipi.rst index 9f40b331d0..0c6d0f4deb 100644 --- a/docs/src/integration/external_display_controllers/gen_mipi.rst +++ b/docs/src/integration/external_display_controllers/gen_mipi.rst @@ -1,5 +1,7 @@ +.. _generic mipi driver: + ================================================= -Generic MIPI DCS compatible LCD Controller driver +Generic MIPI DCS-Compatible LCD Controller Driver ================================================= Overview diff --git a/docs/src/integration/external_display_controllers/ili9341.rst b/docs/src/integration/external_display_controllers/ili9341.rst index 492b729ebb..2baf1bf1c2 100644 --- a/docs/src/integration/external_display_controllers/ili9341.rst +++ b/docs/src/integration/external_display_controllers/ili9341.rst @@ -1,68 +1,80 @@ ============================= -ILI9341 LCD Controller driver +ILI9341 LCD Controller Driver ============================= Overview --------- +******** + +The `ILI9341 `__ is a +262,144-color single-chip SOC driver for a-TFT liquid crystal display with resolution +of 240RGBx320 dots, comprising a 720-channel source driver, a 320-channel gate +driver, 172,800 bytes GRAM for graphic display data of 240RGBx320 dots, and power +supply circuit. ILI9341 supports parallel 8-/9-/16-/18-bit data bus MCU interface, +6-/16-/18-bit data bus RGB interface and 3-/4-line serial peripheral interface(SPI). + +The ILI9341 LCD controller +`driver `__ is +a platform-agnostic driver, based on the :ref:`generic MIPI driver`. It implements +display initialization, supports display rotation and implements the display flush +callback. The user needs to implement only two platform-specific functions to send a +command or pixel data to the controller via SPI or parallel bus. Typically these are +implemented by calling the appropriate SDK library functions on the given platform. -The `ILI9341 `__ is a 262,144-color single-chip SOC driver for a-TFT liquid crystal display with resolution of 240RGBx320 -dots, comprising a 720-channel source driver, a 320-channel gate driver, 172,800 bytes GRAM for graphic -display data of 240RGBx320 dots, and power supply circuit. -ILI9341 supports parallel 8-/9-/16-/18-bit data bus MCU interface, 6-/16-/18-bit data bus RGB interface and -3-/4-line serial peripheral interface (SPI). -The ILI9341 LCD controller `driver `__ is a platform-agnostic driver, based on the `generic MIPI driver `__. -It implements display initialization, supports display rotation and implements the display flush callback. The user needs to implement only two platform-specific functions to send -a command or pixel data to the controller via SPI or parallel bus. Typically these are implemented by calling the appropriate SDK library functions on the given platform. Prerequisites -------------- +************* There are no prerequisites. -Configuring the driver ----------------------- -Enable the ILI9341 driver support in lv_conf.h, by cmake compiler define or by KConfig + +Configuring the Driver +********************** + +Enable the ILI9341 driver support in lv_conf.h, by cmake compiler define or by KConfig: .. code-block:: c - #define LV_USE_ILI9341 1 + #define LV_USE_ILI9341 1 + + Usage ------ +***** You need to implement two platform-dependent functions: .. code-block:: c - /* Send short command to the LCD. This function shall wait until the transaction finishes. */ - void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) - { - ... - } + /* Send short command to the LCD. This function shall wait until the transaction finishes. */ + void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) + { + ... + } - /* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */ - void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) - { - ... - } + /* Send large array of pixel data to the LCD. If necessary, this function has to + * do the byte-swapping. This function can do the transfer in the background. */ + void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) + { + ... + } To create an ILI9341-based display use the function .. code-block:: c - /** - * Create an LCD display with ILI9341 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ - lv_display_t * lv_ili9341_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_ili9341_send_cmd_cb_t send_cmd_cb, lv_ili9341_send_color_cb_t send_color_cb); + /** + * Create an LCD display with ILI9341 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ + lv_display_t * lv_ili9341_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_ili9341_send_cmd_cb_t send_cmd_cb, lv_ili9341_send_color_cb_t send_color_cb); - -For additional details and a working example see the `generic MIPI driver documentation `__. +For additional details and a working example see the :ref:`generic MIPI driver` +documentation. diff --git a/docs/src/integration/external_display_controllers/nv3007.rst b/docs/src/integration/external_display_controllers/nv3007.rst index c8996336bf..bb68778284 100644 --- a/docs/src/integration/external_display_controllers/nv3007.rst +++ b/docs/src/integration/external_display_controllers/nv3007.rst @@ -1,11 +1,12 @@ ============================= -NV3007 LCD Controller driver +NV3007 LCD Controller Driver ============================= Overview --------- +******** -The `NV3007 `__ is a single-chip driver for 262,144-color, a-Si TFT liquid crystal display +The `NV3007 `__ is a single-chip +driver for 262,144-color, a-Si TFT liquid crystal display with maximum resolution of 168RGBx428 dots. It contains 252-channel source driver, a 24-channel GIP driver which used for dual-gate control, 161,784-byte GRAM for graphic display data, internal precise power supply circuit which supports full color, @@ -14,169 +15,182 @@ NV3007 supports 3-/4-line serial peripheral interface (SPI) , quad serial peripheral interface (QSPI). The display area can be specified in internal GRAM by window address function. -The NV3007 LCD controller `driver `__ is a platform-agnostic driver, based on the `generic MIPI driver `__. -It implements display initialization, supports display rotation and implements the display flush callback. The user needs to implement only two platform-specific functions to send -a command or pixel data to the controller via SPI or parallel bus. Typically these are implemented by calling the appropriate SDK library functions on the given platform. +The NV3007 LCD controller `driver `__ +is a platform-agnostic driver, based on the :ref:`generic MIPI driver`. +It implements display initialization, supports display rotation and implements the +display flush callback. The user needs to implement only two platform-specific +functions to send a command or pixel data to the controller via SPI or parallel bus. +Typically these are implemented by calling the appropriate SDK library functions on +the given platform. + + Prerequisites -------------- +************* There are no prerequisites. -Configuring the driver ----------------------- -Enable the NV3007 driver support in lv_conf.h, by cmake compiler define or by KConfig + +Configuring the Driver +********************** + +Enable the NV3007 driver support in lv_conf.h, by cmake compiler define or by KConfig: .. code-block:: c - #define LV_USE_NV3007 1 + #define LV_USE_NV3007 1 + + Usage ------ +***** You need to implement two platform-dependent functions: .. code-block:: c - /* Send short command to the LCD. This function shall wait until the transaction finishes. */ - void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) - { - ... - } + /* Send short command to the LCD. This function shall wait until the transaction finishes. */ + void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) + { + ... + } - /* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */ - void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) - { - ... - } + /* Send large array of pixel data to the LCD. If necessary, this function has to + * do the byte-swapping. This function can do the transfer in the background. */ + void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) + { + ... + } To create an NV3007-based display use the function .. code-block:: c - /** - * Create an LCD display with NV3007 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ - lv_display_t * lv_nv3007_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_nv3007_send_cmd_cb_t send_cmd_cb, lv_nv3007_send_color_cb_t send_color_cb); + /** + * Create an LCD display with NV3007 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ + lv_display_t * lv_nv3007_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_nv3007_send_cmd_cb_t send_cmd_cb, lv_nv3007_send_color_cb_t send_color_cb); + Arduino Example ---------------- +*************** Here is a simple example of using the NV3007 display with Arduino framework and SPI interface: .. code-block:: cpp - #include + #include - /* Platform-specific includes */ - #include + /* Platform-specific includes */ + #include - #define LCD_DC 21 - #define LCD_CS 5 - #define LCD_RST 4 - #define LCD_SCK 18 - #define LCD_MOSI 23 - #define LCD_MISO -1 - #define LCD_BL 15 - #define SPI_CLK 40000000 + #define LCD_DC 21 + #define LCD_CS 5 + #define LCD_RST 4 + #define LCD_SCK 18 + #define LCD_MOSI 23 + #define LCD_MISO -1 + #define LCD_BL 15 + #define SPI_CLK 40000000 - #define BUFFER_SIZE 142 * 50 - uint8_t buf[BUFFER_SIZE]; + #define BUFFER_SIZE 142 * 50 + uint8_t buf[BUFFER_SIZE]; - /* Define your platform-specific functions to send commands and data */ - void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) - { - SPI.beginTransaction(SPISettings(SPI_CLK, MSBFIRST, SPI_MODE0)); - /* Send command */ - digitalWrite(LCD_DC, LOW); /* command mode */ - digitalWrite(LCD_CS, LOW); /* CS low */ - SPI.transferBytes(cmd, NULL, cmd_size); + /* Define your platform-specific functions to send commands and data */ + void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) + { + SPI.beginTransaction(SPISettings(SPI_CLK, MSBFIRST, SPI_MODE0)); + /* Send command */ + digitalWrite(LCD_DC, LOW); /* command mode */ + digitalWrite(LCD_CS, LOW); /* CS low */ + SPI.transferBytes(cmd, NULL, cmd_size); - /* Send parameters (if any) */ - if (param != NULL && param_size > 0) - { - digitalWrite(LCD_DC, HIGH); /* data mode */ - SPI.transferBytes(param, NULL, param_size); - } - digitalWrite(LCD_CS, HIGH); /* CS high */ - SPI.endTransaction(); - } + /* Send parameters (if any) */ + if (param != NULL && param_size > 0) + { + digitalWrite(LCD_DC, HIGH); /* data mode */ + SPI.transferBytes(param, NULL, param_size); + } + digitalWrite(LCD_CS, HIGH); /* CS high */ + SPI.endTransaction(); + } - void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) - { - SPI.beginTransaction(SPISettings(SPI_CLK, MSBFIRST, SPI_MODE0)); - digitalWrite(LCD_CS, LOW); + void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) + { + SPI.beginTransaction(SPISettings(SPI_CLK, MSBFIRST, SPI_MODE0)); + digitalWrite(LCD_CS, LOW); - /* Send the command first */ - digitalWrite(LCD_DC, LOW); - SPI.transferBytes(cmd, NULL, cmd_size); + /* Send the command first */ + digitalWrite(LCD_DC, LOW); + SPI.transferBytes(cmd, NULL, cmd_size); - /* Then send the pixel data */ - if (param && param_size > 0) - { - digitalWrite(LCD_DC, HIGH); - SPI.transferBytes(param, NULL, param_size); - } + /* Then send the pixel data */ + if (param && param_size > 0) + { + digitalWrite(LCD_DC, HIGH); + SPI.transferBytes(param, NULL, param_size); + } - digitalWrite(LCD_CS, HIGH); - SPI.endTransaction(); + digitalWrite(LCD_CS, HIGH); + SPI.endTransaction(); - /* Important: signal LVGL that we're done */ - lv_display_flush_ready(disp); - } + /* Important: signal LVGL that we're done */ + lv_display_flush_ready(disp); + } - void setup() - { + void setup() + { - pinMode(LCD_BL, OUTPUT); - digitalWrite(LCD_BL, HIGH); /* turn on backlight */ + pinMode(LCD_BL, OUTPUT); + digitalWrite(LCD_BL, HIGH); /* turn on backlight */ - pinMode(LCD_DC, OUTPUT); - pinMode(LCD_CS, OUTPUT); - pinMode(LCD_RST, OUTPUT); - /* reset sequence */ - digitalWrite(LCD_RST, HIGH); - delay(100); - digitalWrite(LCD_RST, LOW); - delay(120); - digitalWrite(LCD_RST, HIGH); - delay(120); + pinMode(LCD_DC, OUTPUT); + pinMode(LCD_CS, OUTPUT); + pinMode(LCD_RST, OUTPUT); + /* reset sequence */ + digitalWrite(LCD_RST, HIGH); + delay(100); + digitalWrite(LCD_RST, LOW); + delay(120); + digitalWrite(LCD_RST, HIGH); + delay(120); - SPI.begin(LCD_SCK, LCD_MISO, LCD_MOSI, LCD_CS); /* SCK, MISO, MOSI, SS */ + SPI.begin(LCD_SCK, LCD_MISO, LCD_MOSI, LCD_CS); /* SCK, MISO, MOSI, SS */ - digitalWrite(LCD_CS, HIGH); /* disable device */ - delay(100); /* wait for device to stabilize */ + digitalWrite(LCD_CS, HIGH); /* disable device */ + delay(100); /* wait for device to stabilize */ - lv_init(); + lv_init(); - lv_tick_set_cb(my_tick); + lv_tick_set_cb(my_tick); - /* Create NV3007 display */ - lv_display_t *disp = lv_nv3007_create(142, 428, LV_LCD_FLAG_NONE, my_lcd_send_cmd, my_lcd_send_color); - lv_nv3007_set_gap(disp, 0, 14); - lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_270); - lv_display_set_color_format(disp, LV_COLOR_FORMAT_RGB565_SWAPPED); - lv_display_set_buffers(disp, buf, NULL, BUFFER_SIZE, LV_DISP_RENDER_MODE_PARTIAL); + /* Create NV3007 display */ + lv_display_t *disp = lv_nv3007_create(142, 428, LV_LCD_FLAG_NONE, my_lcd_send_cmd, my_lcd_send_color); + lv_nv3007_set_gap(disp, 0, 14); + lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_270); + lv_display_set_color_format(disp, LV_COLOR_FORMAT_RGB565_SWAPPED); + lv_display_set_buffers(disp, buf, NULL, BUFFER_SIZE, LV_DISP_RENDER_MODE_PARTIAL); - /* Create a simple label on the display */ - lv_obj_t *label = lv_label_create(lv_screen_active()); - lv_label_set_text(label, "Hello NV3007!"); - lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); - } + /* Create a simple label on the display */ + lv_obj_t *label = lv_label_create(lv_screen_active()); + lv_label_set_text(label, "Hello NV3007!"); + lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); + } - void loop() - { - lv_task_handler(); - delay(5); - } + void loop() + { + lv_task_handler(); + delay(5); + } -For additional details and a working example see the `generic MIPI driver documentation `__. +For additional details and a working example see the :ref:`generic MIPI driver` +documentation. diff --git a/docs/src/integration/external_display_controllers/st7735.rst b/docs/src/integration/external_display_controllers/st7735.rst index dfb72b6e71..d4d51133dd 100644 --- a/docs/src/integration/external_display_controllers/st7735.rst +++ b/docs/src/integration/external_display_controllers/st7735.rst @@ -1,70 +1,83 @@ ============================ -ST7735 LCD Controller driver +ST7735 LCD Controller Driver ============================ Overview --------- +******** + +The `ST7735S `__ is a single-chip +controller/driver for 262K-color, graphic type TFT-LCD. It consists of 396 source +line and 162 gate line driving circuits. This chip is capable of connecting directly +to an external microprocessor, and accepts Serial Peripheral Interface +(SPI), 8-bit/9-bit/16-bit/18-bit parallel interface. Display data can be stored in +the on-chip display data RAM of 132 x 162 x 18 bits. It can perform display data RAM +read/write operation with no external operation clock to minimize power consumption. +In addition, because of the integrated power supply circuits necessary to drive +liquid crystal, it is possible to make a display system with fewer components. + +The ST7735 LCD controller +`driver `__ is a +platform-agnostic driver, based on the :ref:`generic MIPI driver`. It implements +display initialization, supports display rotation and implements the display flush +callback. The user needs to implement only two platform-specific functions to send a +command or pixel data to the controller via SPI or parallel bus. Typically these are +implemented by calling the appropriate SDK library functions on the given platform. -The `ST7735S `__ is a single-chip controller/driver for 262K-color, graphic type TFT-LCD. It consists of 396 -source line and 162 gate line driving circuits. This chip is capable of connecting directly to an external -microprocessor, and accepts Serial Peripheral Interface (SPI), 8-bit/9-bit/16-bit/18-bit parallel interface. -Display data can be stored in the on-chip display data RAM of 132 x 162 x 18 bits. It can perform display data -RAM read/write operation with no external operation clock to minimize power consumption. In addition, -because of the integrated power supply circuits necessary to drive liquid crystal, it is possible to make a -display system with fewer components. -The ST7735 LCD controller `driver `__ is a platform-agnostic driver, based on the `generic MIPI driver `__. -It implements display initialization, supports display rotation and implements the display flush callback. The user needs to implement only two platform-specific functions to send -a command or pixel data to the controller via SPI or parallel bus. Typically these are implemented by calling the appropriate SDK library functions on the given platform. Prerequisites -------------- +************* There are no prerequisites. -Configuring the driver ----------------------- -Enable the ST7735 driver support in lv_conf.h, by cmake compiler define or by KConfig + +Configuring the Driver +********************** + +Enable the ST7735 driver support in lv_conf.h, by cmake compiler define or by KConfig: .. code-block:: c - #define LV_USE_ST7735 1 + #define LV_USE_ST7735 1 + + Usage ------ +***** You need to implement two platform-dependent functions: .. code-block:: c - /* Send short command to the LCD. This function shall wait until the transaction finishes. */ - void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) - { - ... - } + /* Send short command to the LCD. This function shall wait until the transaction finishes. */ + void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) + { + ... + } - /* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */ - void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) - { - ... - } + /* Send large array of pixel data to the LCD. If necessary, this function has to + * do the byte-swapping. This function can do the transfer in the background. */ + void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) + { + ... + } To create an ST7735-based display use the function .. code-block:: c - /** - * Create an LCD display with ST7735 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ - lv_display_t * lv_st7735_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_st7735_send_cmd_cb_t send_cmd_cb, lv_st7735_send_color_cb_t send_color_cb); + /** + * Create an LCD display with ST7735 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ + lv_display_t * lv_st7735_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_st7735_send_cmd_cb_t send_cmd_cb, lv_st7735_send_color_cb_t send_color_cb); - -For additional details and a working example see the `generic MIPI driver documentation `__. +For additional details and a working example see the :ref:`generic MIPI driver` +documentation. diff --git a/docs/src/integration/external_display_controllers/st7789.rst b/docs/src/integration/external_display_controllers/st7789.rst index ce417d8027..ca8770fee0 100644 --- a/docs/src/integration/external_display_controllers/st7789.rst +++ b/docs/src/integration/external_display_controllers/st7789.rst @@ -1,69 +1,83 @@ ============================ -ST7789 LCD Controller driver +ST7789 LCD Controller Driver ============================ Overview --------- +******** + +The `ST7789 `__ is a single-chip +controller/driver for 262K-color, graphic type TFT-LCD. It consists of 720 source +line and 320 gate line driving circuits. This chip is capable of connecting directly +to an external microprocessor, and accepts, 8-bits/9-bits/16-bits/18-bits parallel +interface. Display data can be stored in the on-chip display data RAM of 240x320x18 +bits. It can perform display data RAM read/write operation with no external operation +clock to minimize power consumption. In addition, because of the integrated power +supply circuit necessary to drive liquid crystal; it is possible to make a display +system with the fewest components. + +The ST7789 LCD controller +`driver `__ is a +platform-agnostic driver, based on the :ref:`generic MIPI driver`. It implements +display initialization, supports display rotation and implements the display flush +callback. The user needs to implement only two platform-specific functions to send a +command or pixel data to the controller via SPI or parallel bus. Typically these are +implemented by calling the appropriate SDK library functions on the given platform. -The `ST7789 `__ is a single-chip controller/driver for 262K-color, graphic type TFT-LCD. It consists of 720 -source line and 320 gate line driving circuits. This chip is capable of connecting directly to an external -microprocessor, and accepts, 8-bits/9-bits/16-bits/18-bits parallel interface. Display data can be stored in the -on-chip display data RAM of 240x320x18 bits. It can perform display data RAM read/write operation with no -external operation clock to minimize power consumption. In addition, because of the integrated power supply -circuit necessary to drive liquid crystal; it is possible to make a display system with the fewest components. -The ST7789 LCD controller `driver `__ is a platform-agnostic driver, based on the `generic MIPI driver `__. -It implements display initialization, supports display rotation and implements the display flush callback. The user needs to implement only two platform-specific functions to send -a command or pixel data to the controller via SPI or parallel bus. Typically these are implemented by calling the appropriate SDK library functions on the given platform. Prerequisites -------------- +************* There are no prerequisites. -Configuring the driver ----------------------- -Enable the ST7789 driver support in lv_conf.h, by cmake compiler define or by KConfig + +Configuring the Driver +********************** + +Enable the ST7789 driver support in lv_conf.h, by cmake compiler define or by KConfig: .. code-block:: c - #define LV_USE_ST7789 1 + #define LV_USE_ST7789 1 + + Usage ------ +***** You need to implement two platform-dependent functions: .. code-block:: c - /* Send short command to the LCD. This function shall wait until the transaction finishes. */ - void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) - { - ... - } + /* Send short command to the LCD. This function shall wait until the transaction finishes. */ + void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) + { + ... + } - /* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */ - void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) - { - ... - } + /* Send large array of pixel data to the LCD. If necessary, this function has to + * do the byte-swapping. This function can do the transfer in the background. */ + void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) + { + ... + } To create an ST7789-based display use the function .. code-block:: c - /** - * Create an LCD display with ST7789 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ - lv_display_t * lv_st7789_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_st7789_send_cmd_cb_t send_cmd_cb, lv_st7789_send_color_cb_t send_color_cb); + /** + * Create an LCD display with ST7789 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ + lv_display_t * lv_st7789_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_st7789_send_cmd_cb_t send_cmd_cb, lv_st7789_send_color_cb_t send_color_cb); - -For additional details and a working example see the `generic MIPI driver documentation `__. +For additional details and a working example see the :ref:`generic MIPI driver` +documentation. diff --git a/docs/src/integration/external_display_controllers/st7796.rst b/docs/src/integration/external_display_controllers/st7796.rst index 47e7a1afaa..47eec45966 100644 --- a/docs/src/integration/external_display_controllers/st7796.rst +++ b/docs/src/integration/external_display_controllers/st7796.rst @@ -1,70 +1,83 @@ ============================ -ST7796 LCD Controller driver +ST7796 LCD Controller Driver ============================ Overview --------- +******** + +The `ST7796S `__ is a single-chip +controller/driver for 262K-color, graphic type TFT-LCD. It consists of 960 source +lines and 480 gate lines driving circuits. The ST7796S is capable of connecting +directly to an external microprocessor, and accepts 8-bit/9-bit/16-bit/18-bit +parallel interface, SPI, and the ST7796S also provides MIPI interface. Display data +can be stored in the on-chip display data RAM of 320x480x18 bits. It can perform +display data RAM read-/write-operation with no external clock to minimize power +consumption. In addition, because of the integrated power supply circuit necessary to +drive liquid crystal; it is possible to make a display system with fewest components. + +The ST7796 LCD controller +`driver `__ is a +platform-agnostic driver, based on the :ref:`generic MIPI driver`. It implements +display initialization, supports display rotation and implements the display flush +callback. The user needs to implement only two platform-specific functions to send a +command or pixel data to the controller via SPI or parallel bus. Typically these are +implemented by calling the appropriate SDK library functions on the given platform. -The `ST7796S `__ is a single-chip controller/driver for 262K-color, graphic type TFT-LCD. It consists of 960 -source lines and 480 gate lines driving circuits. The ST7796S is capable of connecting directly to an external -microprocessor, and accepts 8-bit/9-bit/16-bit/18-bit parallel interface, SPI, and the ST7796S also provides -MIPI interface. Display data can be stored in the on-chip display data RAM of 320x480x18 bits. It can perform -display data RAM read-/write-operation with no external clock to minimize power consumption. In addition, -because of the integrated power supply circuit necessary to drive liquid crystal; it is possible to make a display -system with fewest components. -The ST7796 LCD controller `driver `__ is a platform-agnostic driver, based on the `generic MIPI driver `__. -It implements display initialization, supports display rotation and implements the display flush callback. The user needs to implement only two platform-specific functions to send -a command or pixel data to the controller via SPI or parallel bus. Typically these are implemented by calling the appropriate SDK library functions on the given platform. Prerequisites -------------- +************* There are no prerequisites. -Configuring the driver ----------------------- -Enable the ST7796 driver support in lv_conf.h, by cmake compiler define or by KConfig + +Configuring the Driver +********************** + +Enable the ST7796 driver support in lv_conf.h, by cmake compiler define or by KConfig: .. code-block:: c - #define LV_USE_ST7796 1 + #define LV_USE_ST7796 1 + + Usage ------ +***** You need to implement two platform-dependent functions: .. code-block:: c - /* Send short command to the LCD. This function shall wait until the transaction finishes. */ - void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) - { - ... - } + /* Send short command to the LCD. This function shall wait until the transaction finishes. */ + void my_lcd_send_cmd(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, const uint8_t *param, size_t param_size) + { + ... + } - /* Send large array of pixel data to the LCD. If necessary, this function has to do the byte-swapping. This function can do the transfer in the background. */ - void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) - { - ... - } + /* Send large array of pixel data to the LCD. If necessary, this function has to + * do the byte-swapping. This function can do the transfer in the background. */ + void my_lcd_send_color(lv_display_t *disp, const uint8_t *cmd, size_t cmd_size, uint8_t *param, size_t param_size) + { + ... + } To create an ST7796-based display use the function .. code-block:: c - /** - * Create an LCD display with ST7796 driver - * @param hor_res horizontal resolution - * @param ver_res vertical resolution - * @param flags default configuration settings (mirror, RGB ordering, etc.) - * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) - * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) - * @return pointer to the created display - */ - lv_display_t * lv_st7796_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, - lv_st7796_send_cmd_cb_t send_cmd_cb, lv_st7796_send_color_cb_t send_color_cb); + /** + * Create an LCD display with ST7796 driver + * @param hor_res horizontal resolution + * @param ver_res vertical resolution + * @param flags default configuration settings (mirror, RGB ordering, etc.) + * @param send_cmd platform-dependent function to send a command to the LCD controller (usually uses polling transfer) + * @param send_color platform-dependent function to send pixel data to the LCD controller (usually uses DMA transfer: must implement a 'ready' callback) + * @return pointer to the created display + */ + lv_display_t * lv_st7796_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags, + lv_st7796_send_cmd_cb_t send_cmd_cb, lv_st7796_send_color_cb_t send_color_cb); - -For additional details and a working example see the `generic MIPI driver documentation `__. +For additional details and a working example see the :ref:`generic MIPI driver` +documentation.