Browse Source

[bsp] 修复bsp自带的lvgl移植 (#8357)

Fu You 1 year ago
parent
commit
a1df90dcf0

+ 6 - 0
bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.c

@@ -11,6 +11,7 @@
 #include <board.h>
 #include <board.h>
 #include <drv_lcd.h>
 #include <drv_lcd.h>
 
 
+#define LCD_DEV_NAME "lcd"
 // #define MY_DISP_HOR_RES LCD_W
 // #define MY_DISP_HOR_RES LCD_W
 // #define DISP_BUFFER_LINES 70
 // #define DISP_BUFFER_LINES 70
 
 
@@ -65,6 +66,11 @@ void lv_port_disp_init(void)
     /*Used to copy the buffer's content to the display*/
     /*Used to copy the buffer's content to the display*/
     disp_drv.flush_cb = disp_flush;
     disp_drv.flush_cb = disp_flush;
 
 
+    /*Init lcd device*/
+    rt_device_t lcd_dev = rt_device_find(LCD_DEV_NAME);
+    rt_device_open(lcd_dev, RT_DEVICE_FLAG_STANDALONE);
+    disp_drv.user_data = lcd_dev;
+
     /*Finally register the driver*/
     /*Finally register the driver*/
     lv_disp_drv_register(&disp_drv);
     lv_disp_drv_register(&disp_drv);
 }
 }