initial commit

This commit is contained in:
Carter Essen committed 2026-11-09 17:35:03 -05:00
commit cff2a21efc
550 files changed
+154887

No files matched your search

+1
View File
@@ -0,0 +1 @@
High level drivers for display controllers, frame buffers, etc
@@ -0,0 +1,46 @@
/**
* @file lv_linux_drm.h
*
*/
#ifndef LV_LINUX_DRM_H
#define LV_LINUX_DRM_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../display/lv_display.h"
#if LV_USE_LINUX_DRM
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_display_t * lv_linux_drm_create(void);
void lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t connector_id);
/**********************
* MACROS
**********************/
#endif /* LV_USE_LINUX_DRM */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_LINUX_DRM_H */
@@ -0,0 +1,52 @@
/**
* @file lv_linux_fbdev.h
*
*/
#ifndef LV_LINUX_FBDEV_H
#define LV_LINUX_FBDEV_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../display/lv_display.h"
#if LV_USE_LINUX_FBDEV
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_display_t * lv_linux_fbdev_create(void);
void lv_linux_fbdev_set_file(lv_display_t * disp, const char * file);
/**
* Force the display to be refreshed on every change.
* Expected to be used with LV_DISPLAY_RENDER_MODE_DIRECT or LV_DISPLAY_RENDER_MODE_FULL.
*/
void lv_linux_fbdev_set_force_refresh(lv_display_t * disp, bool enabled);
/**********************
* MACROS
**********************/
#endif /* LV_USE_LINUX_FBDEV */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_LINUX_FBDEV_H */
@@ -0,0 +1,94 @@
/**
* @file lv_ili9341.h
*
* This driver is just a wrapper around the generic MIPI compatible LCD controller driver
*
*/
#ifndef LV_ILI9341_H
#define LV_ILI9341_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lcd/lv_lcd_generic_mipi.h"
#if LV_USE_ILI9341
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef lv_lcd_send_cmd_cb_t lv_ili9341_send_cmd_cb_t;
typedef lv_lcd_send_color_cb_t lv_ili9341_send_color_cb_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* 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);
/**
* Set gap, i.e., the offset of the (0,0) pixel in the VRAM
* @param disp display object
* @param x x offset
* @param y y offset
*/
void lv_ili9341_set_gap(lv_display_t * disp, uint16_t x, uint16_t y);
/**
* Set color inversion
* @param disp display object
* @param invert false: normal, true: invert
*/
void lv_ili9341_set_invert(lv_display_t * disp, bool invert);
/**
* Set gamma curve
* @param disp display object
* @param gamma gamma curve
*/
void lv_ili9341_set_gamma_curve(lv_display_t * disp, uint8_t gamma);
/**
* Send list of commands.
* @param disp display object
* @param cmd_list controller and panel-specific commands
*/
void lv_ili9341_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list);
/**********************
* OTHERS
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_ILI9341*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ILI9341_H*/
@@ -0,0 +1,242 @@
/**
* @file lv_lcd_generic_mipi.h
*
* Generic driver for controllers adhering to the MIPI DBI/DCS specification
*
* Works with:
*
* ST7735
* ST7789
* ST7796
* ILI9341
* ILI9488 (NOTE: in SPI mode ILI9488 only supports RGB666 mode, which is currently not supported)
*
* any probably many more
*
*/
#ifndef LV_LCD_GENERIC_MIPI_H
#define LV_LCD_GENERIC_MIPI_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../display/lv_display.h"
#if LV_USE_GENERIC_MIPI
/*********************
* DEFINES
*********************/
/* MIPI DCS (Display Command Set) v1.02.00 User Command Set */
#define LV_LCD_CMD_NOP 0x00 /* No Operation */
#define LV_LCD_CMD_SOFT_RESET 0x01 /* Software Reset */
#define LV_LCD_CMD_GET_POWER_MODE 0x0A /* Get the current power mode */
#define LV_LCD_CMD_GET_ADDRESS_MODE 0x0B /* Get the data order for transfers from the Host to the display module and from the frame memory to the display device */
#define LV_LCD_CMD_GET_PIXEL_FORMAT 0x0C /* Get the current pixel format */
#define LV_LCD_CMD_GET_DISPLAY_MODE 0x0D /* Get the current display mode from the peripheral */
#define LV_LCD_CMD_GET_SIGNAL_MODE 0x0E /* Get display module signaling mode */
#define LV_LCD_CMD_GET_DIAGNOSTIC_RESULT 0x0F /* Get Peripheral Self-Diagnostic Result */
#define LV_LCD_CMD_ENTER_SLEEP_MODE 0x10 /* Power for the display panel is off */
#define LV_LCD_CMD_EXIT_SLEEP_MODE 0x11 /* Power for the display panel is on */
#define LV_LCD_CMD_ENTER_PARTIAL_MODE 0x12 /* Part of the display area is used for image display */
#define LV_LCD_CMD_ENTER_NORMAL_MODE 0x13 /* The whole display area is used for image display */
#define LV_LCD_CMD_EXIT_INVERT_MODE 0x20 /* Displayed image colors are not inverted */
#define LV_LCD_CMD_ENTER_INVERT_MODE 0x21 /* Displayed image colors are inverted */
#define LV_LCD_CMD_SET_GAMMA_CURVE 0x26 /* Selects the gamma curve used by the display device */
#define LV_LCD_CMD_SET_DISPLAY_OFF 0x28 /* Blanks the display device */
#define LV_LCD_CMD_SET_DISPLAY_ON 0x29 /* Show the image on the display device */
#define LV_LCD_CMD_SET_COLUMN_ADDRESS 0x2A /* Set the column extent */
#define LV_LCD_CMD_SET_PAGE_ADDRESS 0x2B /* Set the page extent */
#define LV_LCD_CMD_WRITE_MEMORY_START 0x2C /* Transfer image data from the Host Processor to the peripheral starting at the location provided by set_column_address and set_page_address */
#define LV_LCD_CMD_READ_MEMORY_START 0x2E /* Transfer image data from the peripheral to the Host Processor interface starting at the location provided by set_column_address and set_page_address */
#define LV_LCD_CMD_SET_PARTIAL_ROWS 0x30 /* Defines the number of rows in the partial display area on the display device */
#define LV_LCD_CMD_SET_PARTIAL_COLUMNS 0x31 /* Defines the number of columns in the partial display area on the display device */
#define LV_LCD_CMD_SET_SCROLL_AREA 0x33 /* Defines the vertical scrolling and fixed area on display device */
#define LV_LCD_CMD_SET_TEAR_OFF 0x34 /* Synchronization information is not sent from the display module to the host processor */
#define LV_LCD_CMD_SET_TEAR_ON 0x35 /* Synchronization information is sent from the display module to the host processor at the start of VFP */
#define LV_LCD_CMD_SET_ADDRESS_MODE 0x36 /* Set the data order for transfers from the Host to the display module and from the frame memory to the display device */
#define LV_LCD_CMD_SET_SCROLL_START 0x37 /* Defines the vertical scrolling starting point */
#define LV_LCD_CMD_EXIT_IDLE_MODE 0x38 /* Full color depth is used on the display panel */
#define LV_LCD_CMD_ENTER_IDLE_MODE 0x39 /* Reduced color depth is used on the display panel */
#define LV_LCD_CMD_SET_PIXEL_FORMAT 0x3A /* Defines how many bits per pixel are used in the interface */
#define LV_LCD_CMD_WRITE_MEMORY_CONTINUE 0x3C /* Transfer image information from the Host Processor interface to the peripheral from the last written location */
#define LV_LCD_CMD_READ_MEMORY_CONTINUE 0x3E /* Read image data from the peripheral continuing after the last read_memory_continue or read_memory_start */
#define LV_LCD_CMD_SET_TEAR_SCANLINE 0x44 /* Synchronization information is sent from the display module to the host processor when the display device refresh reaches the provided scanline */
#define LV_LCD_CMD_GET_SCANLINE 0x45 /* Get the current scanline */
#define LV_LCD_CMD_READ_DDB_CONTINUE 0xA8 /* Continue reading the DDB from the last read location */
#define LV_LCD_CMD_READ_DDB_START 0xA1 /* Read the DDB from the provided location */
/* address mode flag masks */
#define LV_LCD_MASK_FLIP_VERTICAL (1 << 0) /* This bit flips the image shown on the display device top to bottom. No change is made to the frame memory */
#define LV_LCD_MASK_FLIP_HORIZONTAL (1 << 1) /* This bit flips the image shown on the display device left to right. No change is made to the frame memory */
#define LV_LCD_MASK_DATA_LATCH_DATA_ORDER (1 << 2) /* Display Data Latch Order */
#define LV_LCD_MASK_RGB_ORDER (1 << 3) /* RGB/BGR Order */
#define LV_LCD_MASK_LINE_ADDRESS_ORDER (1 << 4) /* Line Address Order */
#define LV_LCD_MASK_PAGE_COLUMN_ORDER (1 << 5) /* Page/Column Order */
#define LV_LCD_MASK_COLUMN_ADDRESS_ORDER (1 << 6) /* Column Address Order */
#define LV_LCD_MASK_PAGE_ADDRESS_ORDER (1 << 7) /* Page Address Order */
#define LV_LCD_BIT_FLIP_VERTICAL__NOT_FLIPPED 0
#define LV_LCD_BIT_FLIP_VERTICAL__FLIPPED LV_LCD_MASK_FLIP_VERTICAL /* This bit flips the image shown on the display device top to bottom. No change is made to the frame memory */
#define LV_LCD_BIT_FLIP_HORIZONTAL__NOT_FLIPPED 0
#define LV_LCD_BIT_FLIP_HORIZONTAL__FLIPPED LV_LCD_MASK_FLIP_HORIZONTAL /* This bit flips the image shown on the display device left to right. No change is made to the frame memory */
#define LV_LCD_BIT_DATA_LATCH_DATA_ORDER__LTOR 0 /* Display Data Latch Order: LCD Refresh Left to Right */
#define LV_LCD_BIT_DATA_LATCH_DATA_ORDER__RTOL LV_LCD_MASK_DATA_LATCH_DATA_ORDER /* Display Data Latch Order: LCD Refresh Right to Left */
#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 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 */
#define LV_LCD_BIT_COLUMN_ADDRESS_ORDER__RTOL LV_LCD_MASK_COLUMN_ADDRESS_ORDER /* Column Address Order: Right to Left */
#define LV_LCD_BIT_PAGE_ADDRESS_ORDER__TTOB 0 /* Page Address Order: Top to Bottom */
#define LV_LCD_BIT_PAGE_ADDRESS_ORDER__BTOT LV_LCD_MASK_PAGE_ADDRESS_ORDER /* Page Address Order: Bottom to Top */
/* predefined gamma curves */
#define LV_LCD_GAMMA_2_2 0x01 /* 2.2 */
#define LV_LCD_GAMMA_1_8 0x02 /* 1.8 */
#define LV_LCD_GAMMA_2_5 0x04 /* 2.5 */
#define LV_LCD_GAMMA_1_0 0x08 /* 1.0 */
/* common pixel formats */
#define LV_LCD_PIXEL_FORMAT_RGB565 0x55 /* bus: 16 bits, pixel: 16 bits */
#define LV_LCD_PIXEL_FORMAT_RGB666 0x66 /* bus: 18 bits, pixel: 18 bits */
/* flags for lv_lcd_xxx_create() */
#define LV_LCD_FLAG_NONE 0x00000000UL
#define LV_LCD_FLAG_MIRROR_X 0x00000001UL
#define LV_LCD_FLAG_MIRROR_Y 0x00000002UL
#define LV_LCD_FLAG_BGR 0x00000008UL
#define LV_LCD_FLAG_RGB666 0x00000010UL
/* command list */
#define LV_LCD_CMD_DELAY_MS 0xff
#define LV_LCD_CMD_EOF 0xff
/**********************
* TYPEDEFS
**********************/
/**
* Configuration flags for lv_lcd_xxx_create()
*
*/
typedef uint32_t lv_lcd_flag_t;
/**
* Prototype of a platform-dependent callback to transfer commands and data to the LCD controller.
* @param disp display object
* @param cmd command buffer (can handle 16 bit commands as well)
* @param cmd_size number of bytes of the command
* @param param parameter buffer
* @param param_size number of bytes of the parameters
*/
typedef void (*lv_lcd_send_cmd_cb_t)(lv_display_t * disp, const uint8_t * cmd, size_t cmd_size, const uint8_t * param,
size_t param_size);
/**
* Prototype of a platform-dependent callback to transfer pixel data to the LCD controller.
* @param disp display object
* @param cmd command buffer (can handle 16 bit commands as well)
* @param cmd_size number of bytes of the command
* @param param parameter buffer
* @param param_size number of bytes of the parameters
*/
typedef void (*lv_lcd_send_color_cb_t)(lv_display_t * disp, const uint8_t * cmd, size_t cmd_size, uint8_t * param,
size_t param_size);
/**
* Generic MIPI compatible LCD driver
*/
typedef struct {
lv_display_t * disp; /* the associated LVGL display object */
lv_lcd_send_cmd_cb_t send_cmd; /* platform-specific implementation to send a command to the LCD controller */
lv_lcd_send_color_cb_t send_color; /* platform-specific implementation to send pixel data to the LCD controller */
uint16_t x_gap; /* x offset of the (0,0) pixel in VRAM */
uint16_t y_gap; /* y offset of the (0,0) pixel in VRAM */
uint8_t madctl_reg; /* current value of MADCTL register */
uint8_t colmod_reg; /* current value of COLMOD register */
bool mirror_x;
bool mirror_y;
bool swap_xy;
} lv_lcd_generic_mipi_driver_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a MIPI DCS compatible LCD display
* @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_lcd_generic_mipi_create(uint32_t hor_res, uint32_t ver_res, lv_lcd_flag_t flags,
lv_lcd_send_cmd_cb_t send_cmd_cb, lv_lcd_send_color_cb_t send_color_cb);
/**
* Set gap, i.e., the offset of the (0,0) pixel in the VRAM
* @param disp display object
* @param x x offset
* @param y y offset
*/
void lv_lcd_generic_mipi_set_gap(lv_display_t * disp, uint16_t x, uint16_t y);
/**
* Set color inversion
* @param disp display object
* @param invert false: normal, true: invert
*/
void lv_lcd_generic_mipi_set_invert(lv_display_t * disp, bool invert);
/**
* Set address mode
* @param disp display object
* @param mirror_x horizontal mirror (false: normal, true: mirrored)
* @param mirror_y vertical mirror (false: normal, true: mirrored)
* @param swap_xy swap axes (false: normal, true: swap)
* @param bgr RGB/BGR order (false: RGB, true: BGR)
*/
void lv_lcd_generic_mipi_set_address_mode(lv_display_t * disp, bool mirror_x, bool mirror_y, bool swap_xy, bool bgr);
/**
* Set gamma curve
* @param disp display object
* @param gamma gamma curve
*/
void lv_lcd_generic_mipi_set_gamma_curve(lv_display_t * disp, uint8_t gamma);
/**
* Send list of commands.
* @param disp display object
* @param cmd_list controller and panel-specific commands
*/
void lv_lcd_generic_mipi_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list);
/**********************
* OTHERS
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_GENERIC_MIPI*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LCD_GENERIC_MIPI_H*/
@@ -0,0 +1,57 @@
/**
* @file lv_renesas_glcdc.h
*
*/
#ifndef LV_RENESAS_GLCDC_H
#define LV_RENESAS_GLCDC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../display/lv_display.h"
#if LV_USE_RENESAS_GLCDC
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a display using Renesas' GLCDC peripherial in DIRECT render mode
* @return pointer to the created display
*/
lv_display_t * lv_renesas_glcdc_direct_create(void);
/**
* Create a display using Renesas' GLCDC peripherial in PARTIAL render mode
* @param buf1 first buffer
* @param buf2 second buffer (can be `NULL`)
* @param buf_size buffer size in byte
* @return pointer to the created display
*/
lv_display_t * lv_renesas_glcdc_partial_create(void * buf1, void * buf2, size_t buf_size);
/**********************
* MACROS
**********************/
#endif /* LV_USE_RENESAS_GLCDC */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_RENESAS_GLCDC_H */
@@ -0,0 +1,93 @@
/**
* @file lv_st7735.h
*
* This driver is just a wrapper around the generic MIPI compatible LCD controller driver
*
*/
#ifndef LV_ST7735_H
#define LV_ST7735_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lcd/lv_lcd_generic_mipi.h"
#if LV_USE_ST7735
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef lv_lcd_send_cmd_cb_t lv_st7735_send_cmd_cb_t;
typedef lv_lcd_send_color_cb_t lv_st7735_send_color_cb_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* 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);
/**
* Set gap, i.e., the offset of the (0,0) pixel in the VRAM
* @param disp display object
* @param x x offset
* @param y y offset
*/
void lv_st7735_set_gap(lv_display_t * disp, uint16_t x, uint16_t y);
/**
* Set color inversion
* @param disp display object
* @param invert false: normal, true: invert
*/
void lv_st7735_set_invert(lv_display_t * disp, bool invert);
/**
* Set gamma curve
* @param disp display object
* @param gamma gamma curve
*/
void lv_st7735_set_gamma_curve(lv_display_t * disp, uint8_t gamma);
/**
* Send list of commands.
* @param disp display object
* @param cmd_list controller and panel-specific commands
*/
void lv_st7735_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list);
/**********************
* OTHERS
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_ST7735*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ST7735_H*/
@@ -0,0 +1,94 @@
/**
* @file lv_st7789.h
*
* This driver is just a wrapper around the generic MIPI compatible LCD controller driver
*
*/
#ifndef LV_ST7789_H
#define LV_ST7789_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lcd/lv_lcd_generic_mipi.h"
#if LV_USE_ST7789
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef lv_lcd_send_cmd_cb_t lv_st7789_send_cmd_cb_t;
typedef lv_lcd_send_color_cb_t lv_st7789_send_color_cb_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* 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);
/**
* Set gap, i.e., the offset of the (0,0) pixel in the VRAM
* @param disp display object
* @param x x offset
* @param y y offset
*/
void lv_st7789_set_gap(lv_display_t * disp, uint16_t x, uint16_t y);
/**
* Set color inversion
* @param disp display object
* @param invert false: normal, true: invert
*/
void lv_st7789_set_invert(lv_display_t * disp, bool invert);
/**
* Set gamma curve
* @param disp display object
* @param gamma gamma curve
*/
void lv_st7789_set_gamma_curve(lv_display_t * disp, uint8_t gamma);
/**
* Send list of commands.
* @param disp display object
* @param cmd_list controller and panel-specific commands
*/
void lv_st7789_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list);
/**********************
* OTHERS
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_ST7789*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ST7789_H*/
@@ -0,0 +1,93 @@
/**
* @file lv_st7796.h
*
* This driver is just a wrapper around the generic MIPI compatible LCD controller driver
*
*/
#ifndef LV_ST7796_H
#define LV_ST7796_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lcd/lv_lcd_generic_mipi.h"
#if LV_USE_ST7796
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef lv_lcd_send_cmd_cb_t lv_st7796_send_cmd_cb_t;
typedef lv_lcd_send_color_cb_t lv_st7796_send_color_cb_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* 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);
/**
* Set gap, i.e., the offset of the (0,0) pixel in the VRAM
* @param disp display object
* @param x x offset
* @param y y offset
*/
void lv_st7796_set_gap(lv_display_t * disp, uint16_t x, uint16_t y);
/**
* Set color inversion
* @param disp display object
* @param invert false: normal, true: invert
*/
void lv_st7796_set_invert(lv_display_t * disp, bool invert);
/**
* Set gamma curve
* @param disp display object
* @param gamma gamma curve
*/
void lv_st7796_set_gamma_curve(lv_display_t * disp, uint8_t gamma);
/**
* Send list of commands.
* @param disp display object
* @param cmd_list controller and panel-specific commands
*/
void lv_st7796_send_cmd_list(lv_display_t * disp, const uint8_t * cmd_list);
/**********************
* OTHERS
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_ST7796*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ST7796_H*/
@@ -0,0 +1,65 @@
/**
* @file lv_st_ltdc.h
*
*/
#ifndef LV_ST_LTDC_H
#define LV_ST_LTDC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#if LV_USE_ST_LTDC
#include "../../../display/lv_display.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a direct render mode display bound to a LTDC layer.
* @param fb_adr_1 The LTDC layer's framebuffer memory address.
* @param fb_adr_2 An additional framebuffer-sized buffer to use for double buffering, or `NULL`.
* @param layer_idx The LTDC layer number to bind the display to. Typically 0 or 1.
* @return The display.
*/
lv_display_t * lv_st_ltdc_create_direct(void * fb_adr_1, void * fb_adr_2, uint32_t layer_idx);
/**
* Create a partial render mode display bound to a LTDC layer. The layer's framebuffer is flushed to internally.
* Enable `LV_ST_LTDC_USE_DMA2D_FLUSH` for parallel flushing.
* @param render_buf_1 A render buffer.
* @param render_buf_2 An additional render buffer for double-buffering, or `NULL`.
* @param buf_size The size of the buffer(s) in bytes.
* @param layer_idx The LTDC layer number to bind the display to. Typically 0 or 1.
* @return The display.
*/
lv_display_t * lv_st_ltdc_create_partial(void * render_buf_1, void * render_buf_2, uint32_t buf_size,
uint32_t layer_idx);
/**********************
* MACROS
**********************/
#endif /*LV_USE_ST_LTDC*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_ST_LTDC_H*/
@@ -0,0 +1,110 @@
/**
* @file lv_tft_espi.cpp
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_tft_espi.h"
#if LV_USE_TFT_ESPI
#include <TFT_eSPI.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
TFT_eSPI * tft;
} lv_tft_espi_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map);
static void resolution_changed_event_cb(lv_event_t * e);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
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_tft_espi_t *)lv_malloc_zeroed(sizeof(lv_tft_espi_t));
LV_ASSERT_MALLOC(dsc);
if(dsc == NULL) return NULL;
lv_display_t * disp = lv_display_create(hor_res, ver_res);
if(disp == NULL) {
lv_free(dsc);
return NULL;
}
dsc->tft = new TFT_eSPI(hor_res, ver_res);
dsc->tft->begin(); /* TFT init */
dsc->tft->setRotation(0);
lv_display_set_driver_data(disp, (void *)dsc);
lv_display_set_flush_cb(disp, flush_cb);
lv_display_add_event_cb(disp, resolution_changed_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL);
lv_display_set_buffers(disp, (void *)buf, NULL, buf_size_bytes, LV_DISPLAY_RENDER_MODE_PARTIAL);
return disp;
}
/**********************
* STATIC FUNCTIONS
**********************/
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_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 *)px_map, w * h, true);
dsc->tft->endWrite();
lv_display_flush_ready(disp);
}
static void resolution_changed_event_cb(lv_event_t * e)
{
lv_display_t * disp = (lv_display_t *)lv_event_get_target(e);
lv_tft_espi_t * dsc = (lv_tft_espi_t *)lv_display_get_driver_data(disp);
int32_t hor_res = lv_display_get_horizontal_resolution(disp);
int32_t ver_res = lv_display_get_vertical_resolution(disp);
lv_display_rotation_t rot = lv_display_get_rotation(disp);
/* handle rotation */
switch(rot) {
case LV_DISPLAY_ROTATION_0:
dsc->tft->setRotation(0); /* Portrait orientation */
break;
case LV_DISPLAY_ROTATION_90:
dsc->tft->setRotation(1); /* Landscape orientation */
break;
case LV_DISPLAY_ROTATION_180:
dsc->tft->setRotation(2); /* Portrait orientation, flipped */
break;
case LV_DISPLAY_ROTATION_270:
dsc->tft->setRotation(3); /* Landscape orientation, flipped */
break;
}
}
#endif /*LV_USE_TFT_ESPI*/
@@ -0,0 +1,43 @@
/**
* @file lv_tft_espi.h
*
*/
#ifndef LV_TFT_ESPI_H
#define LV_TFT_ESPI_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../display/lv_display.h"
#if LV_USE_TFT_ESPI
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_display_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes);
/**********************
* MACROS
**********************/
#endif /* LV_USE_TFT_ESPI */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_TFT_ESPI_H */
+64
View File
@@ -0,0 +1,64 @@
/**
* @file lv_evdev.h
*
*/
#ifndef LV_EVDEV_H
#define LV_EVDEV_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../indev/lv_indev.h"
#if LV_USE_EVDEV
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create evdev input device.
* @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD
* @param dev_path device path, e.g., /dev/input/event0
* @return pointer to input device or NULL if opening failed
*/
lv_indev_t * lv_evdev_create(lv_indev_type_t indev_type, const char * dev_path);
/**
* Set whether coordinates of pointer device should be swapped. Defaults to
* false.
* @param indev evdev input device
* @param swap_axes whether to swap x and y axes
*/
void lv_evdev_set_swap_axes(lv_indev_t * indev, bool swap_axes);
/**
* Configure a coordinate transformation for pointer devices. Applied after
* axis swap, if any. Defaults to apply no transformation.
* @param indev evdev input device
* @param min_x pointer coordinate mapped to min x of display
* @param min_y pointer coordinate mapped to min y of display
* @param max_x pointer coordinate mapped to max x of display
* @param max_y pointer coordinate mapped to max y of display
*/
void lv_evdev_set_calibration(lv_indev_t * indev, int min_x, int min_y, int max_x, int max_y);
/**
* Remove evdev input device.
* @param indev evdev input device to close and free
*/
void lv_evdev_delete(lv_indev_t * indev);
#endif /*LV_USE_EVDEV*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_EVDEV_H*/
@@ -0,0 +1,108 @@
/**
* @file lv_glfw_window.h
*
*/
#ifndef LV_GLFW_WINDOW_H
#define LV_GLFW_WINDOW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include "../../misc/lv_types.h"
#include "../../display/lv_display.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a GLFW window with no textures and initialize OpenGL
* @param hor_res width in pixels of the window
* @param ver_res height in pixels of the window
* @param use_mouse_indev send pointer indev input to LVGL display textures
* @return the new GLFW window handle
*/
lv_glfw_window_t * lv_glfw_window_create(int32_t hor_res, int32_t ver_res, bool use_mouse_indev);
/**
* Delete a GLFW window. If it is the last one, the process will exit
* @param window GLFW window to delete
*/
void lv_glfw_window_delete(lv_glfw_window_t * window);
/**
* Add a texture to the GLFW window. It can be an LVGL display texture, or any OpenGL texture
* @param window GLFW window
* @param texture_id OpenGL texture ID
* @param w width in pixels of the texture
* @param h height in pixels of the texture
* @return the new texture handle
*/
lv_glfw_texture_t * lv_glfw_window_add_texture(lv_glfw_window_t * window, unsigned int texture_id, int32_t w,
int32_t h);
/**
* Remove a texture from its GLFW window and delete it
* @param texture handle of a GLFW window texture
*/
void lv_glfw_texture_remove(lv_glfw_texture_t * texture);
/**
* Set the x position of a texture within its GLFW window
* @param texture handle of a GLFW window texture
* @param x new x position of the texture
*/
void lv_glfw_texture_set_x(lv_glfw_texture_t * texture, int32_t x);
/**
* Set the y position of a texture within its GLFW window
* @param texture handle of a GLFW window texture
* @param y new y position of the texture
*/
void lv_glfw_texture_set_y(lv_glfw_texture_t * texture, int32_t y);
/**
* Set the opacity of a texture in a GLFW window
* @param texture handle of a GLFW window texture
* @param opa new opacity of the texture
*/
void lv_glfw_texture_set_opa(lv_glfw_texture_t * texture, lv_opa_t opa);
/**
* Get the mouse indev associated with a texture in a GLFW window, if it exists
* @param texture handle of a GLFW window texture
* @return the indev or `NULL`
* @note there will only be an indev if the texture is based on an
* LVGL display texture and the window was created with
* `use_mouse_indev` as `true`
*/
lv_indev_t * lv_glfw_texture_get_mouse_indev(lv_glfw_texture_t * texture);
/**********************
* MACROS
**********************/
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_GLFW_WINDOW_H */
@@ -0,0 +1,70 @@
/**
* @file lv_glfw_window_private.h
*
*/
#ifndef LV_GLFW_WINDOW_PRIVATE_H
#define LV_GLFW_WINDOW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_glfw_window.h"
#if LV_USE_OPENGLES
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "../../misc/lv_area.h"
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_glfw_window_t {
GLFWwindow * window;
int32_t hor_res;
int32_t ver_res;
lv_ll_t textures;
lv_point_t mouse_last_point;
lv_indev_state_t mouse_last_state;
uint8_t use_indev : 1;
uint8_t closing : 1;
};
struct _lv_glfw_texture_t {
lv_glfw_window_t * window;
unsigned int texture_id;
lv_area_t area;
lv_opa_t opa;
lv_indev_t * indev;
lv_point_t indev_last_point;
lv_indev_state_t indev_last_state;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /*LV_USE_OPENGLES*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_GLFW_WINDOW_PRIVATE_H*/
@@ -0,0 +1,40 @@
/**
* @file lv_opengles_debug.h
*
*/
#ifndef LV_OPENGLES_DEBUG_H
#define LV_OPENGLES_DEBUG_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include <stdbool.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
void GLClearError(void);
void GLLogCall(const char * function, const char * file, int line);
#if LV_USE_OPENGLES_DEBUG
#define GL_CALL(x) do {\
GLClearError();\
x;\
GLLogCall(#x, __FILE__, __LINE__);\
} while(0)
#else
#define GL_CALL(x) x
#endif
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_OPENGLES_DEBUG_H */
@@ -0,0 +1,92 @@
/**
* @file lv_opengles_driver.h
*
*/
#ifndef LV_OPENGLES_DRIVER_H
#define LV_OPENGLES_DRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include "../../misc/lv_area.h"
#include "../../misc/lv_color.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize OpenGL
* @note it is not necessary to call this if you use `lv_glfw_window_create`
*/
void lv_opengles_init(void);
/**
* Deinitialize OpenGL
* @note it is not necessary to call this if you use `lv_glfw_window_create`
*/
void lv_opengles_deinit(void);
/**
* Render a texture
* @param texture OpenGL texture ID
* @param texture_area the area in the window to render the texture in
* @param opa opacity to blend the texture with existing contents
* @param disp_w width of the window/framebuffer being rendered to
* @param disp_h height of the window/framebuffer being rendered to
*/
void lv_opengles_render_texture(unsigned int texture, const lv_area_t * texture_area, lv_opa_t opa, int32_t disp_w,
int32_t disp_h, const lv_area_t * texture_clip_area, bool flip);
/**
* Render a fill
* @param color the color of the fill
* @param area the area in the window to render the fill
* @param opa opacity to blend the fill with existing contents
* @param disp_w width of the window/framebuffer being rendered to
* @param disp_h height of the window/framebuffer being rendered to
*/
void lv_opengles_render_fill(lv_color_t color, const lv_area_t * area, lv_opa_t opa, int32_t disp_w, int32_t disp_h);
/**
* Clear the window/display
*/
void lv_opengles_render_clear(void);
/**
* Set the OpenGL viewport
* @param x x position of the viewport
* @param y y position of the viewport
* @param w width of the viewport
* @param h height of the viewport
*/
void lv_opengles_viewport(int32_t x, int32_t y, int32_t w, int32_t h);
/**********************
* MACROS
**********************/
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_OPENGLES_DRIVER_H */
@@ -0,0 +1,66 @@
/**
* @file lv_opengles_texture.h
*
*/
#ifndef LV_OPENGLES_TEXTURE_H
#define LV_OPENGLES_TEXTURE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if LV_USE_OPENGLES
#include "../../display/lv_display.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a display that flushes to an OpenGL texture
* @param w width in pixels of the texture
* @param h height in pixels of the texture
* @return the new display
*/
lv_display_t * lv_opengles_texture_create(int32_t w, int32_t h);
/**
* Get the OpenGL texture ID of the display
* @param disp display
* @return texture ID
*/
unsigned int lv_opengles_texture_get_texture_id(lv_display_t * disp);
/**
* Get the display of an OpenGL texture if it is associated with one
* @param texture_id OpenGL texture ID
* @return display or `NULL` if there no display with that texture ID
*/
lv_display_t * lv_opengles_texture_get_from_texture_id(unsigned int texture_id);
/**********************
* MACROS
**********************/
#endif /* LV_USE_OPENGLES */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_OPENGLES_TEXTURE_H*/
@@ -0,0 +1,101 @@
/**
* @file lv_libinput.h
*
*/
#ifndef LV_LIBINPUT_H
#define LV_LIBINPUT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../indev/lv_indev.h"
#if LV_USE_LIBINPUT
#include <poll.h>
#include <pthread.h>
#if LV_LIBINPUT_XKB
#include "lv_xkb.h"
#endif /* LV_LIBINPUT_XKB */
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_LIBINPUT_CAPABILITY_NONE = 0,
LV_LIBINPUT_CAPABILITY_KEYBOARD = 1U << 0,
LV_LIBINPUT_CAPABILITY_POINTER = 1U << 1,
LV_LIBINPUT_CAPABILITY_TOUCH = 1U << 2
} lv_libinput_capability;
struct libinput_device;
#define LV_LIBINPUT_MAX_EVENTS 32
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Determine the capabilities of a specific libinput device.
* @param device the libinput device to query
* @return the supported input capabilities
*/
lv_libinput_capability lv_libinput_query_capability(struct libinput_device * device);
/**
* Find connected input device with specific capabilities
* @param capabilities required device capabilities
* @param force_rescan erase the device cache (if any) and rescan the file system for available devices
* @return device node path (e.g. /dev/input/event0) for the first matching device or NULL if no device was found.
* The pointer is safe to use until the next forceful device search.
*/
char * lv_libinput_find_dev(lv_libinput_capability capabilities, bool force_rescan);
/**
* Find connected input devices with specific capabilities
* @param capabilities required device capabilities
* @param devices pre-allocated array to store the found device node paths (e.g. /dev/input/event0). The pointers are
* safe to use until the next forceful device search.
* @param count maximum number of devices to find (the devices array should be at least this long)
* @param force_rescan erase the device cache (if any) and rescan the file system for available devices
* @return number of devices that were found
*/
size_t lv_libinput_find_devs(lv_libinput_capability capabilities, char ** found, size_t count, bool force_rescan);
/**
* Create a new libinput input device
* @param type LV_INDEV_TYPE_POINTER or LV_INDEV_TYPE_KEYPAD
* @param dev_path device path, e.g. /dev/input/event0
* @return pointer to input device or NULL if opening failed
*/
lv_indev_t * lv_libinput_create(lv_indev_type_t indev_type, const char * dev_path);
/**
* Delete a libinput input device
* @param indev pointer to input device
*/
void lv_libinput_delete(lv_indev_t * indev);
/**********************
* MACROS
**********************/
#endif /* LV_USE_LIBINPUT */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_LIBINPUT_H */
@@ -0,0 +1,83 @@
/**
* @file lv_libinput_private.h
*
*/
#ifndef LV_LIBINPUT_PRIVATE_H
#define LV_LIBINPUT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_libinput.h"
#if LV_USE_LIBINPUT
#if LV_LIBINPUT_XKB
#include "lv_xkb_private.h"
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_libinput_event_t {
lv_indev_state_t pressed;
int key_val;
lv_point_t point;
};
struct _lv_libinput_t {
int fd;
struct pollfd fds[1];
/* The points array is implemented as a circular LIFO queue */
lv_libinput_event_t points[LV_LIBINPUT_MAX_EVENTS]; /* Event buffer */
lv_libinput_event_t slots[2]; /* Realtime state of up to 2 fingers to handle multitouch */
/* Pointer devices work a bit differently in libinput which requires us to store their last known state */
lv_point_t pointer_position;
bool pointer_button_down;
int start; /* Index of start of event queue */
int end; /* Index of end of queue*/
lv_libinput_event_t last_event; /* Report when no new events
* to keep indev state consistent
*/
bool deinit; /* Tell worker thread to quit */
pthread_mutex_t event_lock;
pthread_t worker_thread;
struct libinput * libinput_context;
struct libinput_device * libinput_device;
#if LV_LIBINPUT_XKB
lv_xkb_t xkb;
#endif /* LV_LIBINPUT_XKB */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_LIBINPUT */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_LIBINPUT_PRIVATE_H*/
+64
View File
@@ -0,0 +1,64 @@
/**
* @file lv_xkb.h
*
*/
#ifndef LV_XKB_H
#define LV_XKB_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB
#include "../../misc/lv_types.h"
#include <stdbool.h>
#include <xkbcommon/xkbcommon.h>
/*********************
* DEFINES
*********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialise an XKB descriptor.
* @return true if the initialisation was successful
*/
bool lv_xkb_init(lv_xkb_t * dsc, struct xkb_rule_names names);
/**
* De-initialise an XKB descriptor.
* @param dsc Pointer to descriptor
*/
void lv_xkb_deinit(lv_xkb_t * dsc);
/**
* Process an evdev scancode using a specific XKB descriptor.
* @param state XKB descriptor to use
* @param scancode evdev scancode to process
* @param down true if the key was pressed, false if it was releases
* @return the (first) UTF-8 character produced by the event or 0 if no output was produced
*/
uint32_t lv_xkb_process_key(lv_xkb_t * dsc, uint32_t scancode, bool down);
/**********************
* MACROS
**********************/
#endif /* LV_LIBINPUT_XKB */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB */
@@ -0,0 +1,53 @@
/**
* @file lv_xkb_private.h
*
*/
#ifndef LV_XKB_PRIVATE_H
#define LV_XKB_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_xkb.h"
#if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_xkb_t {
struct xkb_keymap * keymap;
struct xkb_state * state;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_XKB_PRIVATE_H*/
+77
View File
@@ -0,0 +1,77 @@
/**
* @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 "display/lcd/lv_lcd_generic_mipi.h"
#include "display/ili9341/lv_ili9341.h"
#include "display/st7735/lv_st7735.h"
#include "display/st7789/lv_st7789.h"
#include "display/st7796/lv_st7796.h"
#include "display/renesas_glcdc/lv_renesas_glcdc.h"
#include "display/st_ltdc/lv_st_ltdc.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 "libinput/lv_libinput.h"
#include "windows/lv_windows_input.h"
#include "windows/lv_windows_display.h"
#include "glfw/lv_glfw_window.h"
#include "glfw/lv_opengles_texture.h"
#include "glfw/lv_opengles_driver.h"
#include "qnx/lv_qnx.h"
#include "wayland/lv_wayland.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRIVERS_H*/
@@ -0,0 +1,41 @@
/**
* @file lv_nuttx_cache.h
*
*/
#ifndef LV_NUTTX_CACHE_H
#define LV_NUTTX_CACHE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_nuttx_cache_init(void);
void lv_nuttx_cache_deinit(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_NUTTX_CACHE_H*/
@@ -0,0 +1,112 @@
/**
* @file lv_nuttx_entry.h
*
*/
/*********************
* INCLUDES
*********************/
#ifndef LV_NUTTX_ENTRY_H
#define LV_NUTTX_ENTRY_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_NUTTX
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
const char * fb_path;
const char * input_path;
const char * utouch_path;
} lv_nuttx_dsc_t;
typedef struct {
lv_display_t * disp;
lv_indev_t * indev;
lv_indev_t * utouch_indev;
} lv_nuttx_result_t;
typedef struct _lv_nuttx_ctx_t {
void * image_cache;
} lv_nuttx_ctx_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the lv_nuttx_dsc_t structure with default values for the NuttX port of LVGL.
* @param dsc Pointer to the lv_nuttx_dsc_t structure to be initialized.
*/
void lv_nuttx_dsc_init(lv_nuttx_dsc_t * dsc);
/**
* Initialize the LVGL display driver for NuttX using the provided configuration information.
* @param dsc Pointer to the lv_nuttx_dsc_t structure containing the configuration information for the display driver.
* @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
*/
void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
/**
* Deinitialize the LVGL display driver for NuttX.
* @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
*/
void lv_nuttx_deinit(lv_nuttx_result_t * result);
#if LV_USE_NUTTX_CUSTOM_INIT
/**
* Initialize the LVGL display driver for NuttX using the provided custom configuration information.
* @param dsc Pointer to the lv_nuttx_dsc_t structure containing the custom configuration for the display driver.
* @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
*/
void lv_nuttx_init_custom(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result);
/**
* Deinitialize the LVGL display driver for NuttX using the provided custom configuration information.
* @param result Pointer to the lv_nuttx_result_t structure containing display and input device handler.
*/
void lv_nuttx_deinit_custom(lv_nuttx_result_t * result);
#endif /* LV_USE_NUTTX_CUSTOM_INIT */
/**
* Call `lv_timer_handler()` (LVGL's super loop) in an endless loop.
* If LV_USE_NUTTX_LIBUV is enabled an UV timer will be created,
* else `lv_timer_handler()` will be called in a loop with some sleep.
* @param result pointer to a variable initialized by `lv_nuttx_init()` or `lv_nuttx_init_custom()`
*/
void lv_nuttx_run(lv_nuttx_result_t * result);
/**
* Get the idle percentage of the system.
* @return The idle percentage of the system.
*/
uint32_t lv_nuttx_get_idle(void);
/**********************
* MACROS
**********************/
#endif /* LV_USE_NUTTX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_NUTTX_ENTRY_H */
@@ -0,0 +1,55 @@
/**
* @file lv_nuttx_fbdev.h
*
*/
#ifndef LV_NUTTX_FBDEV_H
#define LV_NUTTX_FBDEV_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#if LV_USE_NUTTX
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a new display with NuttX backend.
*/
lv_display_t * lv_nuttx_fbdev_create(void);
/**
* Initialize display with specified framebuffer device
* @param disp pointer to display with NuttX backend
* @param file the name of framebuffer device
*/
int lv_nuttx_fbdev_set_file(lv_display_t * disp, const char * file);
/**********************
* MACROS
**********************/
#endif /* LV_USE_NUTTX */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_NUTTX_FBDEV_H */
@@ -0,0 +1,44 @@
/**
* @file lv_nuttx_image_cache.h
*
*/
#ifndef LV_NUTTX_IMAGE_CACHE_H
#define LV_NUTTX_IMAGE_CACHE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include LV_STDBOOL_INCLUDE
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_nuttx_image_cache_init(bool use_independent_image_heap);
void lv_nuttx_image_cache_deinit(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_NUTTX_IMAGE_CACHE_H*/
@@ -0,0 +1,49 @@
/**
* @file lv_nuttx_lcd.h
*
*/
#ifndef LV_NUTTX_LCD_H
#define LV_NUTTX_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#if LV_USE_NUTTX
#if LV_USE_NUTTX_LCD
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_display_t * lv_nuttx_lcd_create(const char * dev_path);
/**********************
* MACROS
**********************/
#endif /* LV_USE_NUTTX_LCD */
#endif /* LV_USE_NUTTX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_NUTTX_LCD_H */
@@ -0,0 +1,66 @@
/**
* @file lv_nuttx_libuv.h
*
*/
#ifndef LV_NUTTX_LIBUV_H
#define LV_NUTTX_LIBUV_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_NUTTX
#if LV_USE_NUTTX_LIBUV
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
void * loop;
lv_display_t * disp;
lv_indev_t * indev;
} lv_nuttx_uv_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the uv_loop using the provided configuration information.
* @param uv_info Pointer to the lv_nuttx_uv_t structure to be initialized.
*/
void * lv_nuttx_uv_init(lv_nuttx_uv_t * uv_info);
/**
* Deinitialize the uv_loop configuration for NuttX porting layer.
* @param data Pointer to user data.
*/
void lv_nuttx_uv_deinit(void ** data);
/**********************
* MACROS
**********************/
#endif /*LV_USE_NUTTX_LIBUV*/
#endif /*LV_USE_NUTTX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_NUTTX_LIBUV_H*/
@@ -0,0 +1,39 @@
/**
* @file lv_nuttx_profiler.h
*
*/
#ifndef LV_NUTTX_PROFILER_H
#define LV_NUTTX_PROFILER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_nuttx_profiler_init(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_NUTTX_PROFILER_H*/
@@ -0,0 +1,57 @@
/**
* @file lv_nuttx_touchscreen.h
*
*/
/*********************
* INCLUDES
*********************/
#ifndef LV_NUTTX_TOUCHSCREEN_H
#define LV_NUTTX_TOUCHSCREEN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../indev/lv_indev.h"
#if LV_USE_NUTTX
#if LV_USE_NUTTX_TOUCHSCREEN
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize indev with specified input device.
* @param dev_path path of input device
*/
lv_indev_t * lv_nuttx_touchscreen_create(const char * dev_path);
/**********************
* MACROS
**********************/
#endif /* LV_USE_NUTTX_TOUCHSCREEN */
#endif /* LV_USE_NUTTX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_NUTTX_TOUCHSCREEN_H */
+86
View File
@@ -0,0 +1,86 @@
/**
* @file lv_qnx.h
* @brief LVGL driver for the QNX Screen compositing window manager
*/
#ifndef LV_QNX_H
#define LV_QNX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_QNX
#include <stdbool.h>
#include <screen/screen.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a window to use as a display for LVGL.
* @param hor_res The horizontal resolution (size) of the window
* @param ver_res The vertical resolution (size) of the window
* @return A pointer to a new display object if successful, NULL otherwise
*/
lv_display_t * lv_qnx_window_create(int32_t hor_res, int32_t ver_res);
/**
* Set the title of the window identified by the given display.
* @param disp The display object for the window
* @param title The new title to set
*/
void lv_qnx_window_set_title(lv_display_t * disp, const char * title);
/**
* Create a pointer input device for the display.
* Only one pointer object is currently supported.
* @param disp The display object associated with the device
* @return true if successful, false otherwise
*/
bool lv_qnx_add_pointer_device(lv_display_t * disp);
/**
* Create a keyboard input device for the display.
* Only one keyboard object is currently supported.
* @param disp The display object associated with the device
* @return true if successful, false otherwise
*/
bool lv_qnx_add_keyboard_device(lv_display_t * disp);
/**
* Runs the event loop for the display.
* The function only returns in response to a close event.
* @param disp The display for the event loop
* @return Exit code
*/
int lv_qnx_event_loop(lv_display_t * disp);
/**********************
* MACROS
**********************/
#endif /* LV_DRV_QNX */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_QNX_H */
@@ -0,0 +1,46 @@
/**
* @file lv_sdl_keyboard.h
*
*/
#ifndef LV_SDL_KEYBOARD_H
#define LV_SDL_KEYBOARD_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_sdl_window.h"
#if LV_USE_SDL
/*********************
* DEFINES
*********************/
#ifndef KEYBOARD_BUFFER_SIZE
#define KEYBOARD_BUFFER_SIZE 32
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_indev_t * lv_sdl_keyboard_create(void);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SDL*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_SDL_KEYBOARD_H */
@@ -0,0 +1,43 @@
/**
* @file lv_sdl_mouse.h
*
*/
#ifndef LV_SDL_MOUSE_H
#define LV_SDL_MOUSE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_sdl_window.h"
#if LV_USE_SDL
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_indev_t * lv_sdl_mouse_create(void);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SDL*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_SDL_MOUSE_H */
@@ -0,0 +1,43 @@
/**
* @file lv_sdl_mousewheel.h
*
*/
#ifndef LV_SDL_MOUSEWHEEL_H
#define LV_SDL_MOUSEWHEEL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_sdl_window.h"
#if LV_USE_SDL && LV_SDL_MOUSEWHEEL_MODE == LV_SDL_MOUSEWHEEL_MODE_ENCODER
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_indev_t * lv_sdl_mousewheel_create(void);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SDL*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_DEV_SDL_MOUSEWHEEL_H */
@@ -0,0 +1,49 @@
/**
* @file lv_sdl_private.h
*
*/
#ifndef LV_SDL_PRIVATE_H
#define LV_SDL_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../misc/lv_types.h"
#if LV_USE_SDL
#include LV_SDL_INCLUDE_PATH
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_sdl_keyboard_handler(SDL_Event * event);
void lv_sdl_mouse_handler(SDL_Event * event);
void lv_sdl_mousewheel_handler(SDL_Event * event);
lv_display_t * lv_sdl_get_disp_from_win_id(uint32_t win_id);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SDL*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_SDL_PRIVATE_H */
@@ -0,0 +1,62 @@
/**
* @file lv_sdl_window.h
*
*/
#ifndef LV_SDL_WINDOW_H
#define LV_SDL_WINDOW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_SDL
/*********************
* DEFINES
*********************/
/* Possible values of LV_SDL_MOUSEWHEEL_MODE */
#define LV_SDL_MOUSEWHEEL_MODE_ENCODER 0 /* The mousewheel emulates an encoder input device*/
#define LV_SDL_MOUSEWHEEL_MODE_CROWN 1 /* The mousewheel emulates a smart watch crown*/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res);
void lv_sdl_window_set_resizeable(lv_display_t * disp, bool value);
void lv_sdl_window_set_zoom(lv_display_t * disp, uint8_t zoom);
uint8_t lv_sdl_window_get_zoom(lv_display_t * disp);
void lv_sdl_window_set_title(lv_display_t * disp, const char * title);
void * lv_sdl_window_get_renderer(lv_display_t * disp);
void lv_sdl_quit(void);
/**********************
* MACROS
**********************/
#endif /* LV_DRV_SDL */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_SDL_WINDOW_H */
@@ -0,0 +1,142 @@
/*******************************************************************
*
* @file lv_wayland.h - Public functions of the LVGL Wayland client
*
* Based on the original file from the repository.
*
* Porting to LVGL 9.1
* 2024 EDGEMTech Ltd.
*
* See LICENCE.txt for details
*
* Author(s): EDGEMTech Ltd, Erik Tagirov ([email protected])
*
******************************************************************/
#ifndef LV_WAYLAND_H
#define LV_WAYLAND_H
#ifndef _WIN32
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WAYLAND
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef bool (*lv_wayland_display_close_f_t)(lv_display_t * disp);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Retrieves the file descriptor of the wayland socket
*/
int lv_wayland_get_fd(void);
/**
* Creates a window
* @param hor_res The width of the window in pixels
* @param ver_res The height of the window in pixels
* @param title The title of the window
* @param close_cb The callback that will be execute when the user closes the window
* @return The LVGL display associated to the window
*/
lv_display_t * lv_wayland_window_create(uint32_t hor_res, uint32_t ver_res, char * title,
lv_wayland_display_close_f_t close_cb);
/**
* Closes the window programmatically
* @param disp Reference to the LVGL display associated to the window
*/
void lv_wayland_window_close(lv_display_t * disp);
/**
* Check if the window is open
* @param disp Reference to the LVGL display associated to the window
* @return true: The window is open
*/
bool lv_wayland_window_is_open(lv_display_t * disp);
/**
* Sets the fullscreen state of the window
* @param disp Reference to the LVGL display associated to the window
* @param fullscreen If true the window enters fullscreen
*/
void lv_wayland_window_set_fullscreen(lv_display_t * disp, bool fullscreen);
/**
* Sets the maximized state of the window
* @param disp Reference to the LVGL display associated to the window
* @param fullscreen If true the window is maximized
*/
void lv_wayland_window_set_maximized(lv_display_t * disp, bool maximize);
/**
* Obtains the input device of the mouse pointer
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_pointer(lv_display_t * disp);
/**
* Obtains the input device of the encoder
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_pointeraxis(lv_display_t * disp);
/**
* Obtains the input device of the keyboard
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_keyboard(lv_display_t * disp);
/**
* Obtains the input device of the touch screen
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_touchscreen(lv_display_t * disp);
/**
* Wrapper around lv_timer_handler
* @note Must be called in the application run loop instead of the
* regular lv_timer_handler provided by LVGL
* @return true: if the cycle was completed, false if the application
* went to sleep because the last frame wasn't completed
*/
bool lv_wayland_timer_handler(void);
/**********************
* MACROS
**********************/
#endif /* LV_USE_WAYLAND */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _WIN32 */
#endif /* WAYLAND_H */
@@ -0,0 +1,105 @@
/**
* @file lv_wayland_smm.h
*
*/
#ifndef LV_WAYLAND_SMM_H
#define LV_WAYLAND_SMM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include LV_STDDEF_INCLUDE
#include LV_STDBOOL_INCLUDE
#if LV_USE_WAYLAND
/*********************
* DEFINES
*********************/
#define SMM_FD_NAME "lvgl-wayland"
#define SMM_POOL_TAGS (1)
#define SMM_BUFFER_TAGS (2)
#define SMM_GROUP_TAGS (1)
/**********************
* TYPEDEFS
**********************/
typedef void smm_pool_t;
typedef void smm_buffer_t;
typedef void smm_group_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
struct smm_events {
void * ctx;
bool (*new_pool)(void * ctx, smm_pool_t * pool);
void (*expand_pool)(void * ctx, smm_pool_t * pool);
void (*free_pool)(void * ctx, smm_pool_t * pool);
bool (*new_buffer)(void * ctx, smm_buffer_t * buf);
bool (*init_buffer)(void * ctx, smm_buffer_t * buf);
void (*free_buffer)(void * ctx, smm_buffer_t * buf);
};
struct smm_pool_properties {
void * tag[SMM_POOL_TAGS];
size_t size;
int fd;
};
struct smm_buffer_properties {
void * tag[SMM_BUFFER_TAGS];
smm_group_t * const group;
smm_pool_t * const pool;
size_t offset;
};
struct smm_group_properties {
void * tag[SMM_GROUP_TAGS];
};
void smm_init(struct smm_events * evs);
void smm_setctx(void * ctx);
void smm_deinit(void);
smm_group_t * smm_create(void);
void smm_resize(smm_group_t * grp, size_t sz);
void smm_destroy(smm_group_t * grp);
smm_buffer_t * smm_acquire(smm_group_t * grp);
void * smm_map(smm_buffer_t * buf);
void smm_release(smm_buffer_t * buf);
smm_buffer_t * smm_latest(smm_group_t * grp);
smm_buffer_t * smm_next(smm_buffer_t * buf);
/**********************
* MACROS
**********************/
#define SMM_POOL_PROPERTIES(p) ((const struct smm_pool_properties *)(p))
#define SMM_BUFFER_PROPERTIES(b) ((const struct smm_buffer_properties *)(b))
#define SMM_GROUP_PROPERTIES(g) ((const struct smm_group_properties *)(g))
#define SMM_TAG(o, n, v) \
do { \
void **smm_tag = (void **)((char *)o + (n * sizeof(void *))); \
*smm_tag = (v); \
} while(0)
#endif /* LV_USE_WAYLAND */
#endif /* _WIN32 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_WAYLAND_SMM_H */
@@ -0,0 +1,134 @@
/**
* @file lv_windows_context.h
*
*/
#ifndef LV_WINDOWS_CONTEXT_H
#define LV_WINDOWS_CONTEXT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WINDOWS
#if LV_USE_OS != LV_OS_WINDOWS
#error [lv_windows] LV_OS_WINDOWS is required. Enable it in lv_conf.h (LV_USE_OS LV_OS_WINDOWS)
#endif
#include <windows.h>
#ifndef CREATE_WAITABLE_TIMER_MANUAL_RESET
#define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x00000001
#endif
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct _lv_windows_pointer_context_t {
lv_indev_state_t state;
lv_point_t point;
lv_indev_t * indev;
} lv_windows_pointer_context_t;
typedef struct _lv_windows_keypad_queue_item_t {
uint32_t key;
lv_indev_state_t state;
} lv_windows_keypad_queue_item_t;
typedef struct _lv_windows_keypad_context_t {
lv_ll_t queue;
uint16_t utf16_high_surrogate;
uint16_t utf16_low_surrogate;
lv_indev_t * indev;
} lv_windows_keypad_context_t;
typedef struct _lv_windows_encoder_context_t {
lv_indev_state_t state;
int16_t enc_diff;
lv_indev_t * indev;
} lv_windows_encoder_context_t;
typedef struct _lv_windows_window_context_t {
lv_display_t * display_device_object;
lv_timer_t * display_timer_object;
int32_t window_dpi;
int32_t zoom_level;
bool allow_dpi_override;
bool simulator_mode;
bool display_resolution_changed;
lv_point_t requested_display_resolution;
HDC display_framebuffer_context_handle;
uint32_t * display_framebuffer_base;
size_t display_framebuffer_size;
lv_windows_pointer_context_t pointer;
lv_windows_keypad_context_t keypad;
lv_windows_encoder_context_t encoder;
} lv_windows_window_context_t;
typedef struct _lv_windows_create_display_data_t {
const wchar_t * title;
int32_t hor_res;
int32_t ver_res;
int32_t zoom_level;
bool allow_dpi_override;
bool simulator_mode;
HANDLE mutex;
lv_display_t * display;
} lv_windows_create_display_data_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Initialize the LVGL Windows backend.
* @remark This is a private API which is used for LVGL Windows backend
* implementation. LVGL users shouldn't use that because the
* LVGL has already used it in lv_init.
*/
void lv_windows_platform_init(void);
/**
* @brief Get the window context from specific LVGL display window.
* @param window_handle The window handle of specific LVGL display window.
* @return The window context from specific LVGL display window.
* @remark This is a private API which is used for LVGL Windows backend
* implementation. LVGL users shouldn't use that because the
* maintainer doesn't promise the application binary interface
* compatibility for this API.
*/
lv_windows_window_context_t * lv_windows_get_window_context(
HWND window_handle);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_CONTEXT_H*/
@@ -0,0 +1,127 @@
/**
* @file lv_windows_display.h
*
*/
#ifndef LV_WINDOWS_DISPLAY_H
#define LV_WINDOWS_DISPLAY_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WINDOWS
#include <windows.h>
/*********************
* DEFINES
*********************/
#define LV_WINDOWS_ZOOM_BASE_LEVEL 100
#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Create a LVGL display object.
* @param title The window title of LVGL display.
* @param hor_res The horizontal resolution value of LVGL display.
* @param ver_res The vertical resolution value of LVGL display.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @param allow_dpi_override Allow DPI override if true, or follow the
* Windows DPI scaling setting dynamically.
* @param simulator_mode Create simulator mode display if true, or create
* application mode display.
* @return The created LVGL display object.
*/
lv_display_t * lv_windows_create_display(
const wchar_t * title,
int32_t hor_res,
int32_t ver_res,
int32_t zoom_level,
bool allow_dpi_override,
bool simulator_mode);
/**
* @brief Get the window handle from specific LVGL display object.
* @param display The specific LVGL display object.
* @return The window handle from specific LVGL display object.
*/
HWND lv_windows_get_display_window_handle(lv_display_t * display);
/**
* @brief Get logical pixel value from physical pixel value taken account
* with zoom level.
* @param physical The physical pixel value taken account with zoom level.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @return The logical pixel value.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level);
/**
* @brief Get physical pixel value taken account with zoom level from
* logical pixel value.
* @param logical The logical pixel value.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @return The physical pixel value taken account with zoom level.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level);
/**
* @brief Get logical pixel value from physical pixel value taken account
* with DPI scaling.
* @param physical The physical pixel value taken account with DPI scaling.
* @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
* @return The logical pixel value.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi);
/**
* @brief Get physical pixel value taken account with DPI scaling from
* logical pixel value.
* @param logical The logical pixel value.
* @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
* @return The physical pixel value taken account with DPI scaling.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_DISPLAY_H*/
@@ -0,0 +1,83 @@
/**
* @file lv_windows_input.h
*
*/
#ifndef LV_WINDOWS_INPUT_H
#define LV_WINDOWS_INPUT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WINDOWS
#include <windows.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Get the window handle from specific LVGL input device object.
* @param indev The specific LVGL input device object.
* @return The window handle from specific LVGL input device object.
*/
HWND lv_windows_get_indev_window_handle(lv_indev_t * indev);
/**
* @brief Open a LVGL pointer input device object for the specific LVGL
* display object, or create it if the LVGL pointer input device
* object is not created or removed before.
* @param display The specific LVGL display object.
* @return The LVGL pointer input device object for the specific LVGL
* display object.
*/
lv_indev_t * lv_windows_acquire_pointer_indev(lv_display_t * display);
/**
* @brief Open a LVGL keypad input device object for the specific LVGL
* display object, or create it if the LVGL keypad input device
* object is not created or removed before.
* @param display The specific LVGL display object.
* @return The LVGL keypad input device object for the specific LVGL
* display object.
*/
lv_indev_t * lv_windows_acquire_keypad_indev(lv_display_t * display);
/**
* @brief Open a LVGL encoder input device object for the specific LVGL
* display object, or create it if the LVGL encoder input device
* object is not created or removed before.
* @param display The specific LVGL display object.
* @return The LVGL encoder input device object for the specific LVGL
* display object.
*/
lv_indev_t * lv_windows_acquire_encoder_indev(lv_display_t * display);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_INPUT_H*/
@@ -0,0 +1,65 @@
/**
* @file lv_windows_input_private.h
*
*/
#ifndef LV_WINDOWS_INPUT_PRIVATE_H
#define LV_WINDOWS_INPUT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#if LV_USE_WINDOWS
#include <stdbool.h>
#include <windows.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
bool lv_windows_pointer_device_window_message_handler(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT * plResult);
bool lv_windows_keypad_device_window_message_handler(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT * plResult);
bool lv_windows_encoder_device_window_message_handler(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT * plResult);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_INPUT_PRIVATE_H*/
+81
View File
@@ -0,0 +1,81 @@
/**
* @file lv_x11.h
*
*/
#ifndef LV_X11_H
#define LV_X11_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_X11
/*********************
* DEFINES
*********************/
/** Header of private display driver user data - for internal use only */
typedef struct {
struct _XDisplay * display; /**< X11 display object */
struct _x11_inp_data * inp_data; /**< input user data object */
} _x11_user_hdr_t;
/** optional window close callback function type
* @see lv_x11_window_set_close_cb
*/
typedef void(*lv_x11_close_cb)(void * user_data);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* create and add keyboard, mouse and scrollwheel objects and connect them to x11 display.
*
* This is a convenience method handling the typical input initialisation of an X11 window:
* - create keyboard (lv_x11_keyboard_create)
* - create mouse (with scrollwheel, lv_x11_mouse_create lv_x11_mousewheel_create)
*
* @param[in] disp the created X11 display object from @ref lv_x11_window_create
* @param[in] mouse_img optional image description for the mouse cursor (NULL for no/invisible mouse cursor)
*/
void lv_x11_inputs_create(lv_display_t * disp, lv_image_dsc_t const * mouse_img);
/**
* create the X11 display
*
* The minimal initialisation for initializing the X11 display driver with keyboard/mouse support:
* @code
* lv_display_t* disp = lv_x11_window_create("My Window Title", window_width, window_width);
* lv_x11_inputs_create(disp, NULL);
* @endcode
* or with mouse cursor icon:
* @code
* lv_image_dsc_t mouse_symbol = {.....};
* lv_display_t* disp = lv_x11_window_create("My Window Title", window_width, window_width);
* lv_x11_inputs_create(disp, &mouse_symbol);
* @endcode
*
* @param[in] title title of the created X11 window
* @param[in] hor_res horizontal resolution (=width) of the X11 window
* @param[in] ver_res vertical resolution (=height) of the X11 window
* @return pointer to the display object
*/
lv_display_t * lv_x11_window_create(char const * title, int32_t hor_res, int32_t ver_res);
#endif /* LV_USE_X11 */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LV_X11_H */