From 0a0f4b484d82b3fee34654c8ee836faafc49177c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 18 Jan 2024 14:29:39 +0100 Subject: [PATCH] refactor(driver): rename dev to drivers + Arduino update (#5377) --- docs/integration/driver/X11.rst | 2 +- docs/integration/driver/display/gen_mipi.rst | 4 +- docs/integration/driver/display/ili9341.rst | 2 +- docs/integration/driver/display/st7735.rst | 2 +- docs/integration/driver/display/st7789.rst | 2 +- docs/integration/driver/display/st7796.rst | 2 +- docs/integration/driver/windows.rst | 2 +- .../arduino/LVGL_Arduino/LVGL_Arduino.ino | 156 ++++++++---------- lvgl.h | 23 +-- src/draw/sdl/lv_draw_sdl.c | 2 +- src/{dev => drivers}/README.md | 0 .../display/drm/lv_linux_drm.c | 0 .../display/drm/lv_linux_drm.h | 0 .../display/fb/lv_linux_fbdev.c | 0 .../display/fb/lv_linux_fbdev.h | 0 .../display/ili9341/lv_ili9341.c | 0 .../display/ili9341/lv_ili9341.h | 0 .../display/lcd/lv_lcd_generic_mipi.c | 0 .../display/lcd/lv_lcd_generic_mipi.h | 2 +- .../display/st7735/lv_st7735.c | 0 .../display/st7735/lv_st7735.h | 0 .../display/st7789/lv_st7789.c | 0 .../display/st7789/lv_st7789.h | 0 .../display/st7796/lv_st7796.c | 0 .../display/st7796/lv_st7796.h | 0 .../display/tft_espi/lv_tft_espi.cpp | 18 +- .../display/tft_espi/lv_tft_espi.h | 0 src/{dev => drivers}/evdev/lv_evdev.c | 0 src/{dev => drivers}/evdev/lv_evdev.h | 0 src/drivers/lv_drivers.h | 59 +++++++ src/{dev => drivers}/nuttx/lv_nuttx_cache.c | 0 src/{dev => drivers}/nuttx/lv_nuttx_cache.h | 0 src/{dev => drivers}/nuttx/lv_nuttx_entry.c | 0 src/{dev => drivers}/nuttx/lv_nuttx_entry.h | 0 src/{dev => drivers}/nuttx/lv_nuttx_fbdev.c | 0 src/{dev => drivers}/nuttx/lv_nuttx_fbdev.h | 0 src/{dev => drivers}/nuttx/lv_nuttx_lcd.c | 0 src/{dev => drivers}/nuttx/lv_nuttx_lcd.h | 0 src/{dev => drivers}/nuttx/lv_nuttx_libuv.c | 0 src/{dev => drivers}/nuttx/lv_nuttx_libuv.h | 0 .../nuttx/lv_nuttx_touchscreen.c | 0 .../nuttx/lv_nuttx_touchscreen.h | 0 src/{dev => drivers}/sdl/lv_sdl_keyboard.c | 0 src/{dev => drivers}/sdl/lv_sdl_keyboard.h | 0 src/{dev => drivers}/sdl/lv_sdl_mouse.c | 0 src/{dev => drivers}/sdl/lv_sdl_mouse.h | 0 src/{dev => drivers}/sdl/lv_sdl_mousewheel.c | 0 src/{dev => drivers}/sdl/lv_sdl_mousewheel.h | 0 src/{dev => drivers}/sdl/lv_sdl_window.c | 0 src/{dev => drivers}/sdl/lv_sdl_window.h | 0 .../windows/lv_windows_context.c | 0 .../windows/lv_windows_context.h | 0 .../windows/lv_windows_display.c | 0 .../windows/lv_windows_display.h | 0 .../windows/lv_windows_input.c | 0 .../windows/lv_windows_input.h | 0 src/{dev => drivers}/x11/lv_x11.h | 0 src/{dev => drivers}/x11/lv_x11_display.c | 0 src/{dev => drivers}/x11/lv_x11_input.c | 0 src/indev/lv_indev.c | 1 - src/lv_init.c | 2 +- 61 files changed, 153 insertions(+), 126 deletions(-) rename src/{dev => drivers}/README.md (100%) rename src/{dev => drivers}/display/drm/lv_linux_drm.c (100%) rename src/{dev => drivers}/display/drm/lv_linux_drm.h (100%) rename src/{dev => drivers}/display/fb/lv_linux_fbdev.c (100%) rename src/{dev => drivers}/display/fb/lv_linux_fbdev.h (100%) rename src/{dev => drivers}/display/ili9341/lv_ili9341.c (100%) rename src/{dev => drivers}/display/ili9341/lv_ili9341.h (100%) rename src/{dev => drivers}/display/lcd/lv_lcd_generic_mipi.c (100%) rename src/{dev => drivers}/display/lcd/lv_lcd_generic_mipi.h (99%) rename src/{dev => drivers}/display/st7735/lv_st7735.c (100%) rename src/{dev => drivers}/display/st7735/lv_st7735.h (100%) rename src/{dev => drivers}/display/st7789/lv_st7789.c (100%) rename src/{dev => drivers}/display/st7789/lv_st7789.h (100%) rename src/{dev => drivers}/display/st7796/lv_st7796.c (100%) rename src/{dev => drivers}/display/st7796/lv_st7796.h (100%) rename src/{dev => drivers}/display/tft_espi/lv_tft_espi.cpp (69%) rename src/{dev => drivers}/display/tft_espi/lv_tft_espi.h (100%) rename src/{dev => drivers}/evdev/lv_evdev.c (100%) rename src/{dev => drivers}/evdev/lv_evdev.h (100%) create mode 100644 src/drivers/lv_drivers.h rename src/{dev => drivers}/nuttx/lv_nuttx_cache.c (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_cache.h (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_entry.c (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_entry.h (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_fbdev.c (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_fbdev.h (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_lcd.c (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_lcd.h (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_libuv.c (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_libuv.h (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_touchscreen.c (100%) rename src/{dev => drivers}/nuttx/lv_nuttx_touchscreen.h (100%) rename src/{dev => drivers}/sdl/lv_sdl_keyboard.c (100%) rename src/{dev => drivers}/sdl/lv_sdl_keyboard.h (100%) rename src/{dev => drivers}/sdl/lv_sdl_mouse.c (100%) rename src/{dev => drivers}/sdl/lv_sdl_mouse.h (100%) rename src/{dev => drivers}/sdl/lv_sdl_mousewheel.c (100%) rename src/{dev => drivers}/sdl/lv_sdl_mousewheel.h (100%) rename src/{dev => drivers}/sdl/lv_sdl_window.c (100%) rename src/{dev => drivers}/sdl/lv_sdl_window.h (100%) rename src/{dev => drivers}/windows/lv_windows_context.c (100%) rename src/{dev => drivers}/windows/lv_windows_context.h (100%) rename src/{dev => drivers}/windows/lv_windows_display.c (100%) rename src/{dev => drivers}/windows/lv_windows_display.h (100%) rename src/{dev => drivers}/windows/lv_windows_input.c (100%) rename src/{dev => drivers}/windows/lv_windows_input.h (100%) rename src/{dev => drivers}/x11/lv_x11.h (100%) rename src/{dev => drivers}/x11/lv_x11_display.c (100%) rename src/{dev => drivers}/x11/lv_x11_input.c (100%) diff --git a/docs/integration/driver/X11.rst b/docs/integration/driver/X11.rst index c913e1079..97d5e403f 100644 --- a/docs/integration/driver/X11.rst +++ b/docs/integration/driver/X11.rst @@ -5,7 +5,7 @@ X11 Display/Inputs driver Overview ------------- -| The **X11** display/input `driver `__ offers support for simulating the LVGL display and keyboard/mouse inputs in an X11 desktop window. +| The **X11** display/input `driver `__ offers support for simulating the LVGL display and keyboard/mouse inputs in an X11 desktop window. | It is an alternative to **Wayland**, **XCB**, **SDL** or **Qt**. The main purpose for this driver is for testing/debugging the LVGL application in a **Linux** simulation window. diff --git a/docs/integration/driver/display/gen_mipi.rst b/docs/integration/driver/display/gen_mipi.rst index ee672c8dc..4339017f5 100644 --- a/docs/integration/driver/display/gen_mipi.rst +++ b/docs/integration/driver/display/gen_mipi.rst @@ -92,7 +92,7 @@ Example .. code:: c - #include "src/dev/display/st7789/lv_st7789.h" + #include "src/drivers/display/st7789/lv_st7789.h" #define LCD_H_RES 240 #define LCD_V_RES 320 @@ -208,4 +208,4 @@ the generic MIPI driver supports sending a custom command list to the controller You can add a delay between the commands by using the pseudo-command ``LV_LCD_CMD_DELAY_MS``, which must be followed by the delay given in 10ms units. To terminate the command list you must use a delay with a value of ``LV_LCD_CMD_EOF``, as shown above. -See an actual example of sending a command list `here `__. +See an actual example of sending a command list `here `__. diff --git a/docs/integration/driver/display/ili9341.rst b/docs/integration/driver/display/ili9341.rst index f48c4a1f1..f55956ab3 100644 --- a/docs/integration/driver/display/ili9341.rst +++ b/docs/integration/driver/display/ili9341.rst @@ -11,7 +11,7 @@ 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 `__. +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. diff --git a/docs/integration/driver/display/st7735.rst b/docs/integration/driver/display/st7735.rst index ea7bf54ea..6c21acadd 100644 --- a/docs/integration/driver/display/st7735.rst +++ b/docs/integration/driver/display/st7735.rst @@ -13,7 +13,7 @@ RAM read/write operation with no external operation clock to minimize power cons 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 `__. +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. diff --git a/docs/integration/driver/display/st7789.rst b/docs/integration/driver/display/st7789.rst index 2bbb847ac..be9b83e09 100644 --- a/docs/integration/driver/display/st7789.rst +++ b/docs/integration/driver/display/st7789.rst @@ -12,7 +12,7 @@ on-chip display data RAM of 240x320x18 bits. It can perform display data RAM rea 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 `__. +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. diff --git a/docs/integration/driver/display/st7796.rst b/docs/integration/driver/display/st7796.rst index 27fe92d08..fa9686d43 100644 --- a/docs/integration/driver/display/st7796.rst +++ b/docs/integration/driver/display/st7796.rst @@ -13,7 +13,7 @@ display data RAM read-/write-operation with no external clock to minimize power 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 `__. +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. diff --git a/docs/integration/driver/windows.rst b/docs/integration/driver/windows.rst index c2bd9e8d7..df9678edf 100644 --- a/docs/integration/driver/windows.rst +++ b/docs/integration/driver/windows.rst @@ -5,7 +5,7 @@ Windows Display/Inputs driver Overview ------------- -The **Windows** display/input `driver `__ offers support for simulating the LVGL display and keyboard/mouse inputs in a Windows Win32 window. +The **Windows** display/input `driver `__ offers support for simulating the LVGL display and keyboard/mouse inputs in a Windows Win32 window. The main purpose for this driver is for testing/debugging the LVGL application in a **Windows** simulation window via **simulator mode**, or developing a standard **Windows** desktop application with LVGL via **application mode**. diff --git a/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino b/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino index 661a2655f..4358ebd62 100644 --- a/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino +++ b/examples/arduino/LVGL_Arduino/LVGL_Arduino.ino @@ -2,7 +2,10 @@ *Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html */ #include + +#if LV_USE_TFT_ESPI #include +#endif /*To use the built-in examples and demos of LVGL uncomment the includes below respectively. *You also need to copy `lvgl/examples` to `lvgl/src/examples`. Similarly for the demos `lvgl/demos` to `lvgl/src/demos`. @@ -12,132 +15,117 @@ //#include //#include -/*Change to your screen resolution*/ -static const uint16_t screenWidth = 480; -static const uint16_t screenHeight = 320; +/*Set to your screen resolution*/ +#define TFT_HOR_RES 320 +#define TFT_VER_RES 240 -static lv_disp_draw_buf_t draw_buf; -static lv_color_t buf[ screenWidth * screenHeight / 10 ]; - -TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */ +/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/ +#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8)) #if LV_USE_LOG != 0 -/* Serial debugging */ void my_print( lv_log_level_t level, const char * buf ) { LV_UNUSED(level); + Serial.println(buf); Serial.flush(); } #endif -/* Display flushing */ -void my_disp_flush( lv_disp_t *disp, const lv_area_t *area, lv_color_t *color_p ) +/* LVGL calls it when a rendered image needs to copied to the display*/ +void my_disp_flush( lv_display_t *disp, const lv_area_t *area, uint8_t * px_map) { - uint32_t w = ( area->x2 - area->x1 + 1 ); - uint32_t h = ( area->y2 - area->y1 + 1 ); + /*Copy `px map` to the `area`*/ - tft.startWrite(); - tft.setAddrWindow( area->x1, area->y1, w, h ); - tft.pushColors( ( uint16_t * )&color_p->full, w * h, true ); - tft.endWrite(); + /*For example ("my_..." functions needs to be implemented by you) + uint32_t w = lv_area_get_width(area); + uint32_t h = lv_area_get_height(area); - lv_disp_flush_ready( disp ); + my_set_window(area->x1, area->y1, w, h); + my_draw_bitmaps(px_map, w * h); + */ + + /*Call it to tell LVGL you are ready*/ + lv_disp_flush_ready(disp); } /*Read the touchpad*/ -void my_touchpad_read( lv_indev_t * indev_driver, lv_indev_data_t * data ) +void my_touchpad_read( lv_indev_t * indev, lv_indev_data_t * data ) { - uint16_t touchX, touchY; + /*For example ("my_..." functions needs to be implemented by you) + int32_t x, y; + bool touched = my_get_touch( &x, &y ); - bool touched = tft.getTouch( &touchX, &touchY, 600 ); + if(!touched) { + data->state = LV_INDEV_STATE_RELEASED; + } else { + data->state = LV_INDEV_STATE_PRESSED; - if( !touched ) - { - data->state = LV_INDEV_STATE_REL; - } - else - { - data->state = LV_INDEV_STATE_PR; - - /*Set the coordinates*/ - data->point.x = touchX; - data->point.y = touchY; - - Serial.print( "Data x " ); - Serial.println( touchX ); - - Serial.print( "Data y " ); - Serial.println( touchY ); + data->point.x = x; + data->point.y = y; } + */ } void setup() { - Serial.begin( 115200 ); /* prepare for possible serial debug */ - String LVGL_Arduino = "Hello Arduino! "; LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch(); + Serial.begin( 115200 ); Serial.println( LVGL_Arduino ); - Serial.println( "I am LVGL_Arduino" ); lv_init(); + /* register print function for debugging */ #if LV_USE_LOG != 0 - lv_log_register_print_cb( my_print ); /* register print function for debugging */ + lv_log_register_print_cb( my_print ); #endif - tft.begin(); /* TFT init */ - tft.setRotation( 3 ); /* Landscape orientation, flipped */ - - /*Set the touchscreen calibration data, - the actual data for your display can be acquired using - the Generic -> Touch_calibrate example from the TFT_eSPI library*/ - uint16_t calData[5] = { 275, 3620, 264, 3532, 1 }; - tft.setTouch( calData ); - - lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / 10 ); - - /*Initialize the display*/ - static lv_disp_t disp_drv; - lv_disp_drv_init( &disp_drv ); - /*Change the following line to your display resolution*/ - disp_drv.hor_res = screenWidth; - disp_drv.ver_res = screenHeight; - disp_drv.flush_cb = my_disp_flush; - disp_drv.draw_buf = &draw_buf; - lv_disp_drv_register( &disp_drv ); + uint8_t draw_buf[DRAW_BUF_SIZE]; + lv_display_t * disp; +#if LV_USE_TFT_ESPI + /*TFT_eSPI can be enabled lv_conf.h to initialize the display in a simple way*/ + disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, DRAW_BUF_SIZE); +#else + /*Else create a display yourself*/ + disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES); + lv_display_set_flush_cb(disp, my_disp_flush); + lv_display_set_buffers(disp, draw_buf, NULL, DRAW_BUF_SIZE, LV_DISPLAY_RENDER_MODE_PARTIAL); +#endif /*Initialize the (dummy) input device driver*/ - static lv_indev_t indev_drv; - lv_indev_drv_init( &indev_drv ); - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = my_touchpad_read; - lv_indev_drv_register( &indev_drv ); + lv_indev_t * indev = lv_indev_create(); + lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER); /*Touchpad should have POINTER type*/ + lv_indev_set_read_cb(indev, my_touchpad_read); - /* Create simple label */ - //lv_obj_t *label = lv_label_create( lv_scr_act() ); - //lv_label_set_text( label, LVGL_Arduino.c_str() ); - //lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 ); - - /* Try an example. See all the examples - * online: https://docs.lvgl.io/master/examples.html - * source codes: https://github.com/lvgl/lvgl/tree/e7f88efa5853128bf871dde335c0ca8da9eb7731/examples */ - //lv_example_btn_1(); - - /*Or try out a demo. Don't forget to enable the demos in lv_conf.h. E.g. LV_USE_DEMOS_WIDGETS*/ - lv_demo_widgets(); - // lv_demo_benchmark(); - // lv_demo_keypad_encoder(); - // lv_demo_music(); - // lv_demo_printer(); - // lv_demo_stress(); + /* Create a simple label + * --------------------- + lv_obj_t *label = lv_label_create( lv_scr_act() ); + lv_label_set_text( label, "Hello Arduino, I'm LVGL!" ); + lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 ); + + * Try an example. See all the examples + * - Online: https://docs.lvgl.io/master/examples.html + * - Source codes: https://github.com/lvgl/lvgl/tree/master/examples + * ---------------------------------------------------------------- + + lv_example_btn_1(); + + * Or try out a demo. Don't forget to enable the demos in lv_conf.h. E.g. LV_USE_DEMOS_WIDGETS + * ------------------------------------------------------------------------------------------- + + lv_demo_widgets(); + */ + + lv_obj_t *label = lv_label_create( lv_scr_act() ); + lv_label_set_text( label, "Hello Arduino, I'm LVGL!" ); + lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 ); Serial.println( "Setup done" ); } void loop() { - lv_timer_handler(); /* let the GUI do its work */ + lv_timer_handler(); /* let the UI do its work */ delay( 5 ); } diff --git a/lvgl.h b/lvgl.h index 9e4900900..ccf5d0c4a 100644 --- a/lvgl.h +++ b/lvgl.h @@ -113,29 +113,10 @@ extern "C" { #include "src/themes/lv_theme.h" +#include "src/drivers/lv_drivers.h" + #include "src/lv_api_map.h" -#include "src/dev/sdl/lv_sdl_window.h" -#include "src/dev/sdl/lv_sdl_mouse.h" -#include "src/dev/sdl/lv_sdl_mousewheel.h" -#include "src/dev/sdl/lv_sdl_keyboard.h" - -#include "src/dev/x11/lv_x11.h" - -#include "src/dev/display/drm/lv_linux_drm.h" -#include "src/dev/display/fb/lv_linux_fbdev.h" - -#include "src/dev/nuttx/lv_nuttx_entry.h" -#include "src/dev/nuttx/lv_nuttx_fbdev.h" -#include "src/dev/nuttx/lv_nuttx_touchscreen.h" -#include "src/dev/nuttx/lv_nuttx_lcd.h" -#include "src/dev/nuttx/lv_nuttx_libuv.h" - -#include "src/dev/evdev/lv_evdev.h" - -#include "src/dev/windows/lv_windows_input.h" -#include "src/dev/windows/lv_windows_display.h" - #include "src/core/lv_global.h" /********************* * DEFINES diff --git a/src/draw/sdl/lv_draw_sdl.c b/src/draw/sdl/lv_draw_sdl.c index ddbc78f23..7ce1935df 100644 --- a/src/draw/sdl/lv_draw_sdl.c +++ b/src/draw/sdl/lv_draw_sdl.c @@ -15,7 +15,7 @@ #include "../../core/lv_refr.h" #include "../../display/lv_display_private.h" #include "../../stdlib/lv_string.h" -#include "../../dev/sdl/lv_sdl_window.h" +#include "../../drivers/sdl/lv_sdl_window.h" /********************* * DEFINES diff --git a/src/dev/README.md b/src/drivers/README.md similarity index 100% rename from src/dev/README.md rename to src/drivers/README.md diff --git a/src/dev/display/drm/lv_linux_drm.c b/src/drivers/display/drm/lv_linux_drm.c similarity index 100% rename from src/dev/display/drm/lv_linux_drm.c rename to src/drivers/display/drm/lv_linux_drm.c diff --git a/src/dev/display/drm/lv_linux_drm.h b/src/drivers/display/drm/lv_linux_drm.h similarity index 100% rename from src/dev/display/drm/lv_linux_drm.h rename to src/drivers/display/drm/lv_linux_drm.h diff --git a/src/dev/display/fb/lv_linux_fbdev.c b/src/drivers/display/fb/lv_linux_fbdev.c similarity index 100% rename from src/dev/display/fb/lv_linux_fbdev.c rename to src/drivers/display/fb/lv_linux_fbdev.c diff --git a/src/dev/display/fb/lv_linux_fbdev.h b/src/drivers/display/fb/lv_linux_fbdev.h similarity index 100% rename from src/dev/display/fb/lv_linux_fbdev.h rename to src/drivers/display/fb/lv_linux_fbdev.h diff --git a/src/dev/display/ili9341/lv_ili9341.c b/src/drivers/display/ili9341/lv_ili9341.c similarity index 100% rename from src/dev/display/ili9341/lv_ili9341.c rename to src/drivers/display/ili9341/lv_ili9341.c diff --git a/src/dev/display/ili9341/lv_ili9341.h b/src/drivers/display/ili9341/lv_ili9341.h similarity index 100% rename from src/dev/display/ili9341/lv_ili9341.h rename to src/drivers/display/ili9341/lv_ili9341.h diff --git a/src/dev/display/lcd/lv_lcd_generic_mipi.c b/src/drivers/display/lcd/lv_lcd_generic_mipi.c similarity index 100% rename from src/dev/display/lcd/lv_lcd_generic_mipi.c rename to src/drivers/display/lcd/lv_lcd_generic_mipi.c diff --git a/src/dev/display/lcd/lv_lcd_generic_mipi.h b/src/drivers/display/lcd/lv_lcd_generic_mipi.h similarity index 99% rename from src/dev/display/lcd/lv_lcd_generic_mipi.h rename to src/drivers/display/lcd/lv_lcd_generic_mipi.h index 0ffe29bcf..ae5c0ef14 100644 --- a/src/dev/display/lcd/lv_lcd_generic_mipi.h +++ b/src/drivers/display/lcd/lv_lcd_generic_mipi.h @@ -92,7 +92,7 @@ extern "C" { #define LV_LCD_BIT_RGB_ORDER__RGB 0 /* RGB/BGR Order: RGB */ #define LV_LCD_BIT_RGB_ORDER__BGR LV_LCD_MASK_RGB_ORDER /* RGB/BGR Order: BGR */ #define LV_LCD_BIT_LINE_ADDRESS_ORDER__TTOB 0 /* Line Address Order: LCD Refresh Top to Bottom */ -#define LV_LCD_BIT_LINE_ADDRESS_ORDER__BTOT LV_LCD_MASK_LINE_ADDRESS_ORDER /* Line Address Order: LCD Refresh Botton to Top */ +#define LV_LCD_BIT_LINE_ADDRESS_ORDER__BTOT LV_LCD_MASK_LINE_ADDRESS_ORDER /* Line Address Order: LCD Refresh Bottom to Top */ #define LV_LCD_BIT_PAGE_COLUMN_ORDER__NORMAL 0 /* Page/Column Order: Normal Mode */ #define LV_LCD_BIT_PAGE_COLUMN_ORDER__REVERSE LV_LCD_MASK_PAGE_COLUMN_ORDER /* Page/Column Order: Reverse Mode */ #define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__LTOR 0 /* Column Address Order: Left to Right */ diff --git a/src/dev/display/st7735/lv_st7735.c b/src/drivers/display/st7735/lv_st7735.c similarity index 100% rename from src/dev/display/st7735/lv_st7735.c rename to src/drivers/display/st7735/lv_st7735.c diff --git a/src/dev/display/st7735/lv_st7735.h b/src/drivers/display/st7735/lv_st7735.h similarity index 100% rename from src/dev/display/st7735/lv_st7735.h rename to src/drivers/display/st7735/lv_st7735.h diff --git a/src/dev/display/st7789/lv_st7789.c b/src/drivers/display/st7789/lv_st7789.c similarity index 100% rename from src/dev/display/st7789/lv_st7789.c rename to src/drivers/display/st7789/lv_st7789.c diff --git a/src/dev/display/st7789/lv_st7789.h b/src/drivers/display/st7789/lv_st7789.h similarity index 100% rename from src/dev/display/st7789/lv_st7789.h rename to src/drivers/display/st7789/lv_st7789.h diff --git a/src/dev/display/st7796/lv_st7796.c b/src/drivers/display/st7796/lv_st7796.c similarity index 100% rename from src/dev/display/st7796/lv_st7796.c rename to src/drivers/display/st7796/lv_st7796.c diff --git a/src/dev/display/st7796/lv_st7796.h b/src/drivers/display/st7796/lv_st7796.h similarity index 100% rename from src/dev/display/st7796/lv_st7796.h rename to src/drivers/display/st7796/lv_st7796.h diff --git a/src/dev/display/tft_espi/lv_tft_espi.cpp b/src/drivers/display/tft_espi/lv_tft_espi.cpp similarity index 69% rename from src/dev/display/tft_espi/lv_tft_espi.cpp rename to src/drivers/display/tft_espi/lv_tft_espi.cpp index c1e86a7bd..64e3ee6ab 100644 --- a/src/dev/display/tft_espi/lv_tft_espi.cpp +++ b/src/drivers/display/tft_espi/lv_tft_espi.cpp @@ -25,7 +25,7 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -static void flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p); +static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map); /********************** * STATIC VARIABLES @@ -39,13 +39,13 @@ static void flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t * colo * GLOBAL FUNCTIONS **********************/ -lv_disp_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes) +lv_display_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes) { - lv_tft_espi_t * dsc = lv_malloc_zeroed(sizeof(lv_tft_espi_t)); + lv_tft_espi_t * dsc = (lv_tft_espi_t *)lv_malloc_zeroed(sizeof(lv_tft_espi_t)); LV_ASSERT_MALLOC(dsc); if(dsc == NULL) return NULL; - lv_disp_t * disp = lv_disp_create(hor_res, ver_res); + lv_display_t * disp = lv_display_create(hor_res, ver_res); if(disp == NULL) { lv_free(dsc); return NULL; @@ -56,7 +56,7 @@ lv_disp_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, u dsc->tft->setRotation(3); /* Landscape orientation, flipped */ lv_display_set_driver_data(disp, (void *)dsc); lv_display_set_flush_cb(disp, flush_cb); - lv_display_set_buffers(disp, (void *)buf, NULL, buf_size_bytes, LV_DISP_RENDER_MODE_PARTIAL); + lv_display_set_buffers(disp, (void *)buf, NULL, buf_size_bytes, LV_DISPLAY_RENDER_MODE_PARTIAL); return disp; } @@ -64,19 +64,19 @@ lv_disp_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, u * STATIC FUNCTIONS **********************/ -static void flush_cb(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p) +static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map) { - lv_tft_espi_t * dsc = (lv_tft_espi_t *)lv_disp_get_driver_data(disp); + lv_tft_espi_t * dsc = (lv_tft_espi_t *)lv_display_get_driver_data(disp); uint32_t w = (area->x2 - area->x1 + 1); uint32_t h = (area->y2 - area->y1 + 1); dsc->tft->startWrite(); dsc->tft->setAddrWindow(area->x1, area->y1, w, h); - dsc->tft->pushColors((uint16_t *)&color_p->full, w * h, true); + dsc->tft->pushColors((uint16_t *)px_map, w * h, true); dsc->tft->endWrite(); - lv_disp_flush_ready(disp); + lv_display_flush_ready(disp); } diff --git a/src/dev/display/tft_espi/lv_tft_espi.h b/src/drivers/display/tft_espi/lv_tft_espi.h similarity index 100% rename from src/dev/display/tft_espi/lv_tft_espi.h rename to src/drivers/display/tft_espi/lv_tft_espi.h diff --git a/src/dev/evdev/lv_evdev.c b/src/drivers/evdev/lv_evdev.c similarity index 100% rename from src/dev/evdev/lv_evdev.c rename to src/drivers/evdev/lv_evdev.c diff --git a/src/dev/evdev/lv_evdev.h b/src/drivers/evdev/lv_evdev.h similarity index 100% rename from src/dev/evdev/lv_evdev.h rename to src/drivers/evdev/lv_evdev.h diff --git a/src/drivers/lv_drivers.h b/src/drivers/lv_drivers.h new file mode 100644 index 000000000..ec126d352 --- /dev/null +++ b/src/drivers/lv_drivers.h @@ -0,0 +1,59 @@ +/** + * @file lv_drivers.h + * + */ + +#ifndef LV_DRIVERS_H +#define LV_DRIVERS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "sdl/lv_sdl_window.h" +#include "sdl/lv_sdl_mouse.h" +#include "sdl/lv_sdl_mousewheel.h" +#include "sdl/lv_sdl_keyboard.h" + +#include "x11/lv_x11.h" + +#include "display/drm/lv_linux_drm.h" +#include "display/fb/lv_linux_fbdev.h" + +#include "display/tft_espi/lv_tft_espi.h" + +#include "nuttx/lv_nuttx_entry.h" +#include "nuttx/lv_nuttx_fbdev.h" +#include "nuttx/lv_nuttx_touchscreen.h" +#include "nuttx/lv_nuttx_lcd.h" +#include "nuttx/lv_nuttx_libuv.h" + +#include "evdev/lv_evdev.h" + +#include "windows/lv_windows_input.h" +#include "windows/lv_windows_display.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRIVERS_H*/ diff --git a/src/dev/nuttx/lv_nuttx_cache.c b/src/drivers/nuttx/lv_nuttx_cache.c similarity index 100% rename from src/dev/nuttx/lv_nuttx_cache.c rename to src/drivers/nuttx/lv_nuttx_cache.c diff --git a/src/dev/nuttx/lv_nuttx_cache.h b/src/drivers/nuttx/lv_nuttx_cache.h similarity index 100% rename from src/dev/nuttx/lv_nuttx_cache.h rename to src/drivers/nuttx/lv_nuttx_cache.h diff --git a/src/dev/nuttx/lv_nuttx_entry.c b/src/drivers/nuttx/lv_nuttx_entry.c similarity index 100% rename from src/dev/nuttx/lv_nuttx_entry.c rename to src/drivers/nuttx/lv_nuttx_entry.c diff --git a/src/dev/nuttx/lv_nuttx_entry.h b/src/drivers/nuttx/lv_nuttx_entry.h similarity index 100% rename from src/dev/nuttx/lv_nuttx_entry.h rename to src/drivers/nuttx/lv_nuttx_entry.h diff --git a/src/dev/nuttx/lv_nuttx_fbdev.c b/src/drivers/nuttx/lv_nuttx_fbdev.c similarity index 100% rename from src/dev/nuttx/lv_nuttx_fbdev.c rename to src/drivers/nuttx/lv_nuttx_fbdev.c diff --git a/src/dev/nuttx/lv_nuttx_fbdev.h b/src/drivers/nuttx/lv_nuttx_fbdev.h similarity index 100% rename from src/dev/nuttx/lv_nuttx_fbdev.h rename to src/drivers/nuttx/lv_nuttx_fbdev.h diff --git a/src/dev/nuttx/lv_nuttx_lcd.c b/src/drivers/nuttx/lv_nuttx_lcd.c similarity index 100% rename from src/dev/nuttx/lv_nuttx_lcd.c rename to src/drivers/nuttx/lv_nuttx_lcd.c diff --git a/src/dev/nuttx/lv_nuttx_lcd.h b/src/drivers/nuttx/lv_nuttx_lcd.h similarity index 100% rename from src/dev/nuttx/lv_nuttx_lcd.h rename to src/drivers/nuttx/lv_nuttx_lcd.h diff --git a/src/dev/nuttx/lv_nuttx_libuv.c b/src/drivers/nuttx/lv_nuttx_libuv.c similarity index 100% rename from src/dev/nuttx/lv_nuttx_libuv.c rename to src/drivers/nuttx/lv_nuttx_libuv.c diff --git a/src/dev/nuttx/lv_nuttx_libuv.h b/src/drivers/nuttx/lv_nuttx_libuv.h similarity index 100% rename from src/dev/nuttx/lv_nuttx_libuv.h rename to src/drivers/nuttx/lv_nuttx_libuv.h diff --git a/src/dev/nuttx/lv_nuttx_touchscreen.c b/src/drivers/nuttx/lv_nuttx_touchscreen.c similarity index 100% rename from src/dev/nuttx/lv_nuttx_touchscreen.c rename to src/drivers/nuttx/lv_nuttx_touchscreen.c diff --git a/src/dev/nuttx/lv_nuttx_touchscreen.h b/src/drivers/nuttx/lv_nuttx_touchscreen.h similarity index 100% rename from src/dev/nuttx/lv_nuttx_touchscreen.h rename to src/drivers/nuttx/lv_nuttx_touchscreen.h diff --git a/src/dev/sdl/lv_sdl_keyboard.c b/src/drivers/sdl/lv_sdl_keyboard.c similarity index 100% rename from src/dev/sdl/lv_sdl_keyboard.c rename to src/drivers/sdl/lv_sdl_keyboard.c diff --git a/src/dev/sdl/lv_sdl_keyboard.h b/src/drivers/sdl/lv_sdl_keyboard.h similarity index 100% rename from src/dev/sdl/lv_sdl_keyboard.h rename to src/drivers/sdl/lv_sdl_keyboard.h diff --git a/src/dev/sdl/lv_sdl_mouse.c b/src/drivers/sdl/lv_sdl_mouse.c similarity index 100% rename from src/dev/sdl/lv_sdl_mouse.c rename to src/drivers/sdl/lv_sdl_mouse.c diff --git a/src/dev/sdl/lv_sdl_mouse.h b/src/drivers/sdl/lv_sdl_mouse.h similarity index 100% rename from src/dev/sdl/lv_sdl_mouse.h rename to src/drivers/sdl/lv_sdl_mouse.h diff --git a/src/dev/sdl/lv_sdl_mousewheel.c b/src/drivers/sdl/lv_sdl_mousewheel.c similarity index 100% rename from src/dev/sdl/lv_sdl_mousewheel.c rename to src/drivers/sdl/lv_sdl_mousewheel.c diff --git a/src/dev/sdl/lv_sdl_mousewheel.h b/src/drivers/sdl/lv_sdl_mousewheel.h similarity index 100% rename from src/dev/sdl/lv_sdl_mousewheel.h rename to src/drivers/sdl/lv_sdl_mousewheel.h diff --git a/src/dev/sdl/lv_sdl_window.c b/src/drivers/sdl/lv_sdl_window.c similarity index 100% rename from src/dev/sdl/lv_sdl_window.c rename to src/drivers/sdl/lv_sdl_window.c diff --git a/src/dev/sdl/lv_sdl_window.h b/src/drivers/sdl/lv_sdl_window.h similarity index 100% rename from src/dev/sdl/lv_sdl_window.h rename to src/drivers/sdl/lv_sdl_window.h diff --git a/src/dev/windows/lv_windows_context.c b/src/drivers/windows/lv_windows_context.c similarity index 100% rename from src/dev/windows/lv_windows_context.c rename to src/drivers/windows/lv_windows_context.c diff --git a/src/dev/windows/lv_windows_context.h b/src/drivers/windows/lv_windows_context.h similarity index 100% rename from src/dev/windows/lv_windows_context.h rename to src/drivers/windows/lv_windows_context.h diff --git a/src/dev/windows/lv_windows_display.c b/src/drivers/windows/lv_windows_display.c similarity index 100% rename from src/dev/windows/lv_windows_display.c rename to src/drivers/windows/lv_windows_display.c diff --git a/src/dev/windows/lv_windows_display.h b/src/drivers/windows/lv_windows_display.h similarity index 100% rename from src/dev/windows/lv_windows_display.h rename to src/drivers/windows/lv_windows_display.h diff --git a/src/dev/windows/lv_windows_input.c b/src/drivers/windows/lv_windows_input.c similarity index 100% rename from src/dev/windows/lv_windows_input.c rename to src/drivers/windows/lv_windows_input.c diff --git a/src/dev/windows/lv_windows_input.h b/src/drivers/windows/lv_windows_input.h similarity index 100% rename from src/dev/windows/lv_windows_input.h rename to src/drivers/windows/lv_windows_input.h diff --git a/src/dev/x11/lv_x11.h b/src/drivers/x11/lv_x11.h similarity index 100% rename from src/dev/x11/lv_x11.h rename to src/drivers/x11/lv_x11.h diff --git a/src/dev/x11/lv_x11_display.c b/src/drivers/x11/lv_x11_display.c similarity index 100% rename from src/dev/x11/lv_x11_display.c rename to src/drivers/x11/lv_x11_display.c diff --git a/src/dev/x11/lv_x11_input.c b/src/drivers/x11/lv_x11_input.c similarity index 100% rename from src/dev/x11/lv_x11_input.c rename to src/drivers/x11/lv_x11_input.c diff --git a/src/indev/lv_indev.c b/src/indev/lv_indev.c index 3dafa0c63..5c83739f6 100644 --- a/src/indev/lv_indev.c +++ b/src/indev/lv_indev.c @@ -128,7 +128,6 @@ lv_indev_t * lv_indev_create(void) indev->long_press_repeat_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME; indev->gesture_limit = LV_INDEV_DEF_GESTURE_LIMIT; indev->gesture_min_velocity = LV_INDEV_DEF_GESTURE_MIN_VELOCITY; - return indev; } diff --git a/src/lv_init.c b/src/lv_init.c index 716bf60e8..991f11e46 100644 --- a/src/lv_init.c +++ b/src/lv_init.c @@ -40,7 +40,7 @@ #include "draw/vg_lite/lv_draw_vg_lite.h" #endif #if LV_USE_WINDOWS - #include "dev/windows/lv_windows_context.h" + #include "drivers/windows/lv_windows_context.h" #endif /*********************