nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acas...@apache.org
Subject [incubator-nuttx-apps] 03/15: apps/examples/lvgldemo: Update fb flush callback for LVGL V6.1.2
Date Wed, 15 Apr 2020 14:38:35 GMT
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 25876e822206b4146affb4cc58a5072af4d44f0f
Author: Qi Huang <huangqi3@xiaomi.com>
AuthorDate: Tue Apr 7 01:00:56 2020 +0000

    apps/examples/lvgldemo: Update fb flush callback for LVGL V6.1.2
    
    Signed-off-by: Qi Huang <huangqi3@xiaomi.com>
    Change-Id: I72a6ff628f2ea2b0b505e444c84b266ba3a28d87
---
 examples/lvgldemo/fbdev.c | 80 +++++++++++++++++++++++++----------------------
 examples/lvgldemo/fbdev.h |  9 +++---
 2 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/examples/lvgldemo/fbdev.c b/examples/lvgldemo/fbdev.c
index 2e6b53d..e462c60 100644
--- a/examples/lvgldemo/fbdev.c
+++ b/examples/lvgldemo/fbdev.c
@@ -171,8 +171,8 @@ int fbdev_init(void)
    * address mapping to make the memory accessible to the application.
    */
 
-  state.fbmem = mmap(NULL, state.pinfo.fblen, PROT_READ|PROT_WRITE,
-                     MAP_SHARED|MAP_FILE, state.fd, 0);
+  state.fbmem = mmap(NULL, state.pinfo.fblen, PROT_READ | PROT_WRITE,
+                     MAP_SHARED | MAP_FILE, state.fd, 0);
   if (state.fbmem == MAP_FAILED)
     {
       int errcode = errno;
@@ -205,12 +205,16 @@ int fbdev_init(void)
  *
  ****************************************************************************/
 
-void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
-                 FAR const lv_color_t *color_p)
+void fbdev_flush(struct _disp_drv_t *disp_drv, const lv_area_t *area,
+                 lv_color_t *color_p)
 {
 #ifdef CONFIG_LCD_UPDATE
   struct nxgl_rect_s rect;
 #endif
+  int32_t x1 = area->x1;
+  int32_t y1 = area->y1;
+  int32_t x2 = area->x2;
+  int32_t y2 = area->y2;
   int32_t act_x1;
   int32_t act_y1;
   int32_t act_x2;
@@ -253,7 +257,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 8)
     {
-      uint8_t *fbp8 = (uint8_t*)state.fbmem;
+      uint8_t *fbp8 = (uint8_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
@@ -272,7 +276,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 16)
     {
-      uint16_t *fbp16 = (uint16_t*)state.fbmem;
+      uint16_t *fbp16 = (uint16_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
@@ -291,7 +295,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32)
     {
-      uint32_t *fbp32 = (uint32_t*)state.fbmem;
+      uint32_t *fbp32 = (uint32_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
@@ -318,7 +322,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   /* Tell the flushing is ready */
 
-  lv_flush_ready();
+  lv_disp_flush_ready(disp_drv);
 }
 
 /****************************************************************************
@@ -387,7 +391,7 @@ void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 8)
     {
-      uint8_t *fbp8 = (uint8_t*)state.fbmem;
+      uint8_t *fbp8 = (uint8_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
@@ -403,7 +407,7 @@ void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 16)
     {
-      uint16_t *fbp16 = (uint16_t*)state.fbmem;
+      uint16_t *fbp16 = (uint16_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
@@ -419,7 +423,7 @@ void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32)
     {
-      uint32_t *fbp32 = (uint32_t*)state.fbmem;
+      uint32_t *fbp32 = (uint32_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
@@ -508,58 +512,58 @@ void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
 
   if (state.pinfo.bpp == 8)
     {
-      uint8_t *fbp8 = (uint8_t*)state.fbmem;
+      uint8_t *fbp8 = (uint8_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
       for (y = act_y1; y <= act_y2; y++)
         {
-            for (x = act_x1; x <= act_x2; x++)
-              {
-                location = x + (y * state.vinfo.xres);
-                fbp8[location] = color_p->full;
-                color_p++;
-              }
-
-            color_p += x2 - act_x2;
+          for (x = act_x1; x <= act_x2; x++)
+            {
+              location = x + (y * state.vinfo.xres);
+              fbp8[location] = color_p->full;
+              color_p++;
+            }
+
+          color_p += x2 - act_x2;
         }
     }
 
   if (state.pinfo.bpp == 16)
     {
-      uint16_t *fbp16 = (uint16_t*)state.fbmem;
+      uint16_t *fbp16 = (uint16_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
       for (y = act_y1; y <= act_y2; y++)
         {
-            for (x = act_x1; x <= act_x2; x++)
-              {
-                location = x + (y * state.vinfo.xres);
-                fbp16[location] = color_p->full;
-                color_p++;
-              }
-
-            color_p += x2 - act_x2;
+          for (x = act_x1; x <= act_x2; x++)
+            {
+              location = x + (y * state.vinfo.xres);
+              fbp16[location] = color_p->full;
+              color_p++;
+            }
+
+          color_p += x2 - act_x2;
         }
     }
 
   if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32)
     {
-      uint32_t *fbp32 = (uint32_t*)state.fbmem;
+      uint32_t *fbp32 = (uint32_t *)state.fbmem;
       uint32_t x;
       uint32_t y;
 
       for (y = act_y1; y <= act_y2; y++)
         {
-            for (x = act_x1; x <= act_x2; x++)
-              {
-                location = x + (y * state.vinfo.xres);
-                fbp32[location] = color_p->full;
-                color_p++;
-              }
-
-            color_p += x2 - act_x2;
+          for (x = act_x1; x <= act_x2; x++)
+            {
+              location = x + (y * state.vinfo.xres);
+              fbp32[location] = color_p->full;
+              color_p++;
+            }
+
+          color_p += x2 - act_x2;
         }
     }
 
diff --git a/examples/lvgldemo/fbdev.h b/examples/lvgldemo/fbdev.h
index 0df0f34..24446d3 100644
--- a/examples/lvgldemo/fbdev.h
+++ b/examples/lvgldemo/fbdev.h
@@ -53,14 +53,15 @@ extern "C"
  ****************************************************************************/
 
 int fbdev_init(void);
-void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
-                 FAR const lv_color_t *color_p);
-void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
+void fbdev_flush(struct _disp_drv_t *disp_drv, const lv_area_t *area,
+                 lv_color_t *color_p);
+void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
+                lv_color_t color);
 void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
                FAR const lv_color_t *color_p);
 
 #ifdef __cplusplus
-} /* extern "C" */
+}
 #endif
 
 #endif /*__APPS_EXAMPLES_LVGLDEMO_FBDEV_H */


Mime
View raw message