refactor(driver): rename dev to drivers + Arduino update (#5377)
This commit is contained in:
committed by
GitHub
parent
f2cb462be3
commit
0a0f4b484d
@@ -5,7 +5,7 @@ X11 Display/Inputs driver
|
|||||||
Overview
|
Overview
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
| The **X11** display/input `driver <https://github.com/lvgl/lvgl/src/dev/x11>`__ offers support for simulating the LVGL display and keyboard/mouse inputs in an X11 desktop window.
|
| The **X11** display/input `driver <https://github.com/lvgl/lvgl/src/drivers/x11>`__ 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**.
|
| 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.
|
The main purpose for this driver is for testing/debugging the LVGL application in a **Linux** simulation window.
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ Example
|
|||||||
|
|
||||||
.. code:: c
|
.. 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_H_RES 240
|
||||||
#define LCD_V_RES 320
|
#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.
|
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.
|
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 <https://github.com/lvgl/lvgl/src/dev/display/st7789/lv_st7789.c>`__.
|
See an actual example of sending a command list `here <https://github.com/lvgl/lvgl/src/drivers/display/st7789/lv_st7789.c>`__.
|
||||||
|
|||||||
@@ -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
|
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).
|
3-/4-line serial peripheral interface (SPI).
|
||||||
|
|
||||||
The ILI9341 LCD controller `driver <https://github.com/lvgl/lvgl/src/dev/display/ili9341>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
The ILI9341 LCD controller `driver <https://github.com/lvgl/lvgl/src/drivers/display/ili9341>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
||||||
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
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
because of the integrated power supply circuits necessary to drive liquid crystal, it is possible to make a
|
||||||
display system with fewer components.
|
display system with fewer components.
|
||||||
|
|
||||||
The ST7735 LCD controller `driver <https://github.com/lvgl/lvgl/src/dev/display/st7735>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
The ST7735 LCD controller `driver <https://github.com/lvgl/lvgl/src/drivers/display/st7735>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
||||||
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
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
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.
|
circuit necessary to drive liquid crystal; it is possible to make a display system with the fewest components.
|
||||||
|
|
||||||
The ST7789 LCD controller `driver <https://github.com/lvgl/lvgl/src/dev/display/st7789>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
The ST7789 LCD controller `driver <https://github.com/lvgl/lvgl/src/drivers/display/st7789>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
||||||
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
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
because of the integrated power supply circuit necessary to drive liquid crystal; it is possible to make a display
|
||||||
system with fewest components.
|
system with fewest components.
|
||||||
|
|
||||||
The ST7796 LCD controller `driver <https://github.com/lvgl/lvgl/src/dev/display/st7796>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
The ST7796 LCD controller `driver <https://github.com/lvgl/lvgl/src/drivers/display/st7796>`__ is a platform-agnostic driver, based on the `generic MIPI driver <https://github.com/lvgl/lvgl/doc/integration/drivers/display/gen_mipi.rst>`__.
|
||||||
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
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Windows Display/Inputs driver
|
|||||||
Overview
|
Overview
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
The **Windows** display/input `driver <https://github.com/lvgl/lvgl/src/dev/windows>`__ offers support for simulating the LVGL display and keyboard/mouse inputs in a Windows Win32 window.
|
The **Windows** display/input `driver <https://github.com/lvgl/lvgl/src/drivers/windows>`__ 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**.
|
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**.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
*Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html */
|
*Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html */
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|
||||||
|
#if LV_USE_TFT_ESPI
|
||||||
#include <TFT_eSPI.h>
|
#include <TFT_eSPI.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*To use the built-in examples and demos of LVGL uncomment the includes below respectively.
|
/*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`.
|
*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 <examples/lv_examples.h>
|
//#include <examples/lv_examples.h>
|
||||||
//#include <demos/lv_demos.h>
|
//#include <demos/lv_demos.h>
|
||||||
|
|
||||||
/*Change to your screen resolution*/
|
/*Set to your screen resolution*/
|
||||||
static const uint16_t screenWidth = 480;
|
#define TFT_HOR_RES 320
|
||||||
static const uint16_t screenHeight = 320;
|
#define TFT_VER_RES 240
|
||||||
|
|
||||||
static lv_disp_draw_buf_t draw_buf;
|
/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
|
||||||
static lv_color_t buf[ screenWidth * screenHeight / 10 ];
|
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))
|
||||||
|
|
||||||
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
|
|
||||||
|
|
||||||
#if LV_USE_LOG != 0
|
#if LV_USE_LOG != 0
|
||||||
/* Serial debugging */
|
|
||||||
void my_print( lv_log_level_t level, const char * buf )
|
void my_print( lv_log_level_t level, const char * buf )
|
||||||
{
|
{
|
||||||
LV_UNUSED(level);
|
LV_UNUSED(level);
|
||||||
|
Serial.println(buf);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Display flushing */
|
/* LVGL calls it when a rendered image needs to copied to the display*/
|
||||||
void my_disp_flush( lv_disp_t *disp, const lv_area_t *area, lv_color_t *color_p )
|
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 );
|
/*Copy `px map` to the `area`*/
|
||||||
uint32_t h = ( area->y2 - area->y1 + 1 );
|
|
||||||
|
|
||||||
tft.startWrite();
|
/*For example ("my_..." functions needs to be implemented by you)
|
||||||
tft.setAddrWindow( area->x1, area->y1, w, h );
|
uint32_t w = lv_area_get_width(area);
|
||||||
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
|
uint32_t h = lv_area_get_height(area);
|
||||||
tft.endWrite();
|
|
||||||
|
|
||||||
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*/
|
/*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->point.x = x;
|
||||||
{
|
data->point.y = y;
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin( 115200 ); /* prepare for possible serial debug */
|
|
||||||
|
|
||||||
String LVGL_Arduino = "Hello Arduino! ";
|
String LVGL_Arduino = "Hello Arduino! ";
|
||||||
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
|
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
|
||||||
|
|
||||||
|
Serial.begin( 115200 );
|
||||||
Serial.println( LVGL_Arduino );
|
Serial.println( LVGL_Arduino );
|
||||||
Serial.println( "I am LVGL_Arduino" );
|
|
||||||
|
|
||||||
lv_init();
|
lv_init();
|
||||||
|
|
||||||
|
/* register print function for debugging */
|
||||||
#if LV_USE_LOG != 0
|
#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
|
#endif
|
||||||
|
|
||||||
tft.begin(); /* TFT init */
|
uint8_t draw_buf[DRAW_BUF_SIZE];
|
||||||
tft.setRotation( 3 ); /* Landscape orientation, flipped */
|
lv_display_t * disp;
|
||||||
|
#if LV_USE_TFT_ESPI
|
||||||
/*Set the touchscreen calibration data,
|
/*TFT_eSPI can be enabled lv_conf.h to initialize the display in a simple way*/
|
||||||
the actual data for your display can be acquired using
|
disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, DRAW_BUF_SIZE);
|
||||||
the Generic -> Touch_calibrate example from the TFT_eSPI library*/
|
#else
|
||||||
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
|
/*Else create a display yourself*/
|
||||||
tft.setTouch( calData );
|
disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
|
||||||
|
lv_display_set_flush_cb(disp, my_disp_flush);
|
||||||
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / 10 );
|
lv_display_set_buffers(disp, draw_buf, NULL, DRAW_BUF_SIZE, LV_DISPLAY_RENDER_MODE_PARTIAL);
|
||||||
|
#endif
|
||||||
/*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 );
|
|
||||||
|
|
||||||
/*Initialize the (dummy) input device driver*/
|
/*Initialize the (dummy) input device driver*/
|
||||||
static lv_indev_t indev_drv;
|
lv_indev_t * indev = lv_indev_create();
|
||||||
lv_indev_drv_init( &indev_drv );
|
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER); /*Touchpad should have POINTER type*/
|
||||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
lv_indev_set_read_cb(indev, my_touchpad_read);
|
||||||
indev_drv.read_cb = my_touchpad_read;
|
|
||||||
lv_indev_drv_register( &indev_drv );
|
|
||||||
|
|
||||||
/* Create simple label */
|
/* Create a simple label
|
||||||
//lv_obj_t *label = lv_label_create( lv_scr_act() );
|
* ---------------------
|
||||||
//lv_label_set_text( label, LVGL_Arduino.c_str() );
|
lv_obj_t *label = lv_label_create( lv_scr_act() );
|
||||||
//lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
|
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
|
* Try an example. See all the examples
|
||||||
* source codes: https://github.com/lvgl/lvgl/tree/e7f88efa5853128bf871dde335c0ca8da9eb7731/examples */
|
* - Online: https://docs.lvgl.io/master/examples.html
|
||||||
//lv_example_btn_1();
|
* - Source codes: https://github.com/lvgl/lvgl/tree/master/examples
|
||||||
|
* ----------------------------------------------------------------
|
||||||
/*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_example_btn_1();
|
||||||
// lv_demo_benchmark();
|
|
||||||
// lv_demo_keypad_encoder();
|
* Or try out a demo. Don't forget to enable the demos in lv_conf.h. E.g. LV_USE_DEMOS_WIDGETS
|
||||||
// lv_demo_music();
|
* -------------------------------------------------------------------------------------------
|
||||||
// lv_demo_printer();
|
|
||||||
// lv_demo_stress();
|
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" );
|
Serial.println( "Setup done" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
lv_timer_handler(); /* let the GUI do its work */
|
lv_timer_handler(); /* let the UI do its work */
|
||||||
delay( 5 );
|
delay( 5 );
|
||||||
}
|
}
|
||||||
|
|||||||
23
lvgl.h
23
lvgl.h
@@ -113,29 +113,10 @@ extern "C" {
|
|||||||
|
|
||||||
#include "src/themes/lv_theme.h"
|
#include "src/themes/lv_theme.h"
|
||||||
|
|
||||||
|
#include "src/drivers/lv_drivers.h"
|
||||||
|
|
||||||
#include "src/lv_api_map.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"
|
#include "src/core/lv_global.h"
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "../../core/lv_refr.h"
|
#include "../../core/lv_refr.h"
|
||||||
#include "../../display/lv_display_private.h"
|
#include "../../display/lv_display_private.h"
|
||||||
#include "../../stdlib/lv_string.h"
|
#include "../../stdlib/lv_string.h"
|
||||||
#include "../../dev/sdl/lv_sdl_window.h"
|
#include "../../drivers/sdl/lv_sdl_window.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ extern "C" {
|
|||||||
#define LV_LCD_BIT_RGB_ORDER__RGB 0 /* RGB/BGR Order: RGB */
|
#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_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__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__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_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 */
|
#define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__LTOR 0 /* Column Address Order: Left to Right */
|
||||||
@@ -25,7 +25,7 @@ typedef struct {
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* 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
|
* 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
|
* 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);
|
LV_ASSERT_MALLOC(dsc);
|
||||||
if(dsc == NULL) return NULL;
|
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) {
|
if(disp == NULL) {
|
||||||
lv_free(dsc);
|
lv_free(dsc);
|
||||||
return NULL;
|
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 */
|
dsc->tft->setRotation(3); /* Landscape orientation, flipped */
|
||||||
lv_display_set_driver_data(disp, (void *)dsc);
|
lv_display_set_driver_data(disp, (void *)dsc);
|
||||||
lv_display_set_flush_cb(disp, flush_cb);
|
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;
|
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 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 w = (area->x2 - area->x1 + 1);
|
||||||
uint32_t h = (area->y2 - area->y1 + 1);
|
uint32_t h = (area->y2 - area->y1 + 1);
|
||||||
|
|
||||||
dsc->tft->startWrite();
|
dsc->tft->startWrite();
|
||||||
dsc->tft->setAddrWindow(area->x1, area->y1, w, h);
|
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();
|
dsc->tft->endWrite();
|
||||||
|
|
||||||
lv_disp_flush_ready(disp);
|
lv_display_flush_ready(disp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
59
src/drivers/lv_drivers.h
Normal file
59
src/drivers/lv_drivers.h
Normal file
@@ -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*/
|
||||||
@@ -128,7 +128,6 @@ lv_indev_t * lv_indev_create(void)
|
|||||||
indev->long_press_repeat_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME;
|
indev->long_press_repeat_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME;
|
||||||
indev->gesture_limit = LV_INDEV_DEF_GESTURE_LIMIT;
|
indev->gesture_limit = LV_INDEV_DEF_GESTURE_LIMIT;
|
||||||
indev->gesture_min_velocity = LV_INDEV_DEF_GESTURE_MIN_VELOCITY;
|
indev->gesture_min_velocity = LV_INDEV_DEF_GESTURE_MIN_VELOCITY;
|
||||||
|
|
||||||
return indev;
|
return indev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "draw/vg_lite/lv_draw_vg_lite.h"
|
#include "draw/vg_lite/lv_draw_vg_lite.h"
|
||||||
#endif
|
#endif
|
||||||
#if LV_USE_WINDOWS
|
#if LV_USE_WINDOWS
|
||||||
#include "dev/windows/lv_windows_context.h"
|
#include "drivers/windows/lv_windows_context.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
|
|||||||
Reference in New Issue
Block a user