initial commit
This commit is contained in:
commit
cff2a21efc
550 files changed
+154887
No files matched your search
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file lv_draw_pxp.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2022-2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_PXP_H
|
||||
#define LV_DRAW_PXP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "../../sw/lv_draw_sw_private.h"
|
||||
#include "../../../misc/lv_area_private.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef lv_draw_sw_unit_t lv_draw_pxp_unit_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_pxp_init(void);
|
||||
|
||||
void lv_draw_pxp_deinit(void);
|
||||
|
||||
void lv_draw_pxp_rotate(const void * src_buf, void * dest_buf, int32_t src_width, int32_t src_height,
|
||||
int32_t src_stride, int32_t dest_stride, lv_display_rotation_t rotation,
|
||||
lv_color_format_t cf);
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
void lv_draw_buf_pxp_init_handlers(void);
|
||||
|
||||
void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_PXP_H*/
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @file lv_pxp_cfg.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2020-2023 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_PXP_CFG_H
|
||||
#define LV_PXP_CFG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "fsl_cache.h"
|
||||
#include "fsl_pxp.h"
|
||||
|
||||
#include "../../../misc/lv_log.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** PXP module instance to use*/
|
||||
#define PXP_ID PXP
|
||||
|
||||
/** PXP interrupt line ID*/
|
||||
#define PXP_IRQ_ID PXP_IRQn
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* NXP PXP device configuration.
|
||||
*/
|
||||
typedef struct {
|
||||
/** Callback for PXP interrupt initialization*/
|
||||
void (*pxp_interrupt_init)(void);
|
||||
|
||||
/** Callback for PXP interrupt de-initialization*/
|
||||
void (*pxp_interrupt_deinit)(void);
|
||||
|
||||
/** Callback for PXP start*/
|
||||
void (*pxp_run)(void);
|
||||
|
||||
/** Callback for waiting of PXP completion*/
|
||||
void (*pxp_wait)(void);
|
||||
} pxp_cfg_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Reset and initialize PXP device. This function should be called as a part
|
||||
* of display init sequence.
|
||||
*/
|
||||
void lv_pxp_init(void);
|
||||
|
||||
/**
|
||||
* Disable PXP device. Should be called during display deinit sequence.
|
||||
*/
|
||||
void lv_pxp_deinit(void);
|
||||
|
||||
/**
|
||||
* Reset PXP device.
|
||||
*/
|
||||
void lv_pxp_reset(void);
|
||||
|
||||
/**
|
||||
* Clear cache and start PXP.
|
||||
*/
|
||||
void lv_pxp_run(void);
|
||||
|
||||
/**
|
||||
* Wait for PXP completion.
|
||||
*/
|
||||
void lv_pxp_wait(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PXP_CFG_H*/
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @file lv_pxp_osa.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2020, 2022-2023 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_PXP_OSA_H
|
||||
#define LV_PXP_OSA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "lv_pxp_cfg.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* PXP device interrupt handler. Used to check PXP task completion status.
|
||||
*/
|
||||
void PXP_IRQHandler(void);
|
||||
|
||||
/**
|
||||
* Get the PXP default configuration.
|
||||
*/
|
||||
pxp_cfg_t * pxp_get_default_cfg(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PXP_OSA_H*/
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @file lv_pxp_utils.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2023-2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_PXP_UTILS_H
|
||||
#define LV_PXP_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_PXP
|
||||
#if LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP
|
||||
#include "fsl_pxp.h"
|
||||
#include "../../../misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_USE_PXP_ASSERT
|
||||
#define PXP_ASSERT(expr) LV_ASSERT(expr)
|
||||
#else
|
||||
#define PXP_ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#define PXP_ASSERT_MSG(expr, msg) \
|
||||
do { \
|
||||
if(!(expr)) { \
|
||||
LV_LOG_ERROR(msg); \
|
||||
PXP_ASSERT(false); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
pxp_output_pixel_format_t pxp_get_out_px_format(lv_color_format_t cf);
|
||||
|
||||
pxp_as_pixel_format_t pxp_get_as_px_format(lv_color_format_t cf);
|
||||
|
||||
#if LV_USE_DRAW_PXP
|
||||
pxp_ps_pixel_format_t pxp_get_ps_px_format(lv_color_format_t cf);
|
||||
|
||||
bool pxp_buf_aligned(const void * buf, uint32_t stride);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_PXP*/
|
||||
#endif /*LV_USE_DRAW_PXP || LV_USE_ROTATE_PXP*/
|
||||
#endif /*LV_USE_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_PXP_UTILS_H*/
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
* @file lv_draw_vglite.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2023-2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_H
|
||||
#define LV_DRAW_VGLITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
#include "../../lv_draw_private.h"
|
||||
#include "../../sw/lv_draw_sw_private.h"
|
||||
#include "../../../misc/lv_area_private.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_vglite_unit {
|
||||
lv_draw_sw_unit_t;
|
||||
#if LV_USE_VGLITE_DRAW_ASYNC
|
||||
volatile bool wait_for_finish;
|
||||
#endif
|
||||
} lv_draw_vglite_unit_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_buf_vglite_init_handlers(void);
|
||||
|
||||
void lv_draw_vglite_init(void);
|
||||
|
||||
void lv_draw_vglite_deinit(void);
|
||||
|
||||
void lv_draw_vglite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vglite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vglite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vglite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vglite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vglite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords);
|
||||
|
||||
void lv_draw_vglite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc);
|
||||
|
||||
void lv_draw_vglite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_DRAW_VGLITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_H*/
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @file lv_vglite_buf.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2023 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_VGLITE_BUF_H
|
||||
#define LV_VGLITE_BUF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
#include "vg_lite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get vglite destination buffer pointer.
|
||||
*
|
||||
* @retval The vglite destination buffer
|
||||
*
|
||||
*/
|
||||
vg_lite_buffer_t * vglite_get_dest_buf(void);
|
||||
|
||||
/**
|
||||
* Get vglite source buffer pointer.
|
||||
*
|
||||
* @retval The vglite source buffer
|
||||
*
|
||||
*/
|
||||
vg_lite_buffer_t * vglite_get_src_buf(void);
|
||||
|
||||
/**
|
||||
* Set vglite destination buffer address only.
|
||||
*
|
||||
* @param[in] buf Destination buffer address (does not require alignment for VG_LITE_LINEAR mode)
|
||||
*
|
||||
*/
|
||||
void vglite_set_dest_buf_ptr(void * buf);
|
||||
|
||||
/**
|
||||
* Set vglite source buffer address only.
|
||||
*
|
||||
* @param[in] buf Source buffer address
|
||||
*
|
||||
*/
|
||||
void vglite_set_src_buf_ptr(const void * buf);
|
||||
|
||||
/**
|
||||
* Set vglite destination buffer.
|
||||
*
|
||||
* @param[in] buf Destination buffer address
|
||||
* @param[in] width Destination buffer width
|
||||
* @param[in] height Destination buffer height
|
||||
* @param[in] stride Destination buffer stride in bytes
|
||||
* @param[in] cf Destination buffer color format
|
||||
*
|
||||
*/
|
||||
void vglite_set_dest_buf(const void * buf, uint32_t width, uint32_t height, uint32_t stride,
|
||||
lv_color_format_t cf);
|
||||
|
||||
/**
|
||||
* Set vglite source buffer.
|
||||
*
|
||||
* @param[in] buf Source buffer address
|
||||
* @param[in] width Source buffer width
|
||||
* @param[in] height Source buffer height
|
||||
* @param[in] stride Source buffer stride in bytes
|
||||
* @param[in] cf Source buffer color format
|
||||
*
|
||||
*/
|
||||
void vglite_set_src_buf(const void * buf, uint32_t width, uint32_t height, uint32_t stride,
|
||||
lv_color_format_t cf);
|
||||
|
||||
/**
|
||||
* Set vglite buffer.
|
||||
*
|
||||
* @param[in] vgbuf Address of the VGLite buffer object
|
||||
* @param[in] buf Address of the memory for the VGLite buffer
|
||||
* @param[in] width Buffer width
|
||||
* @param[in] height Buffer height
|
||||
* @param[in] stride Buffer stride in bytes
|
||||
* @param[in] cf Buffer color format
|
||||
*
|
||||
*/
|
||||
void vglite_set_buf(vg_lite_buffer_t * vgbuf, void * buf,
|
||||
uint32_t width, uint32_t height, uint32_t stride,
|
||||
lv_color_format_t cf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VGLITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VGLITE_BUF_H*/
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file lv_vglite_matrix.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2023 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_VGLITE_MATRIX_H
|
||||
#define LV_VGLITE_MATRIX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
#include "vg_lite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
vg_lite_matrix_t * vglite_get_matrix(void);
|
||||
|
||||
/**
|
||||
* Creates matrix that translates to origin of given destination area.
|
||||
*
|
||||
* @param[in] dest_area Area with relative coordinates of destination buffer
|
||||
*
|
||||
*/
|
||||
void vglite_set_translation_matrix(const lv_area_t * dest_area);
|
||||
|
||||
/**
|
||||
* Creates matrix that translates to origin of given destination area with transformation (scale or rotate).
|
||||
*
|
||||
* @param[in] dest_area Area with relative coordinates of destination buffer
|
||||
* @param[in] dsc Image descriptor
|
||||
*
|
||||
*/
|
||||
void vglite_set_transformation_matrix(const lv_area_t * dest_area, const lv_draw_image_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VGLITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VGLITE_MATRIX_H*/
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @file lv_vglite_path.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2023 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_VGLITE_PATH_H
|
||||
#define LV_VGLITE_PATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/* The optimal Bezier control point offset for radial unit
|
||||
* see: https://spencermortensen.com/articles/bezier-circle/
|
||||
**/
|
||||
#define BEZIER_OPTIM_CIRCLE 0.551915024494f
|
||||
|
||||
/* Draw lines for control points of Bezier curves */
|
||||
#define BEZIER_DBG_CONTROL_POINTS 0
|
||||
|
||||
/* Path data sizes for different elements */
|
||||
#define CUBIC_PATH_DATA_SIZE 7 /* 1 opcode, 6 arguments */
|
||||
#define LINE_PATH_DATA_SIZE 3 /* 1 opcode, 2 arguments */
|
||||
#define MOVE_PATH_DATA_SIZE 3 /* 1 opcode, 2 arguments */
|
||||
#define END_PATH_DATA_SIZE 1 /* 1 opcode, 0 arguments */
|
||||
/* Maximum possible rectangle path size
|
||||
* is in the rounded rectangle case:
|
||||
* - 1 move for the path start
|
||||
* - 4 cubics for the corners
|
||||
* - 4 lines for the sides
|
||||
* - 1 end for the path end */
|
||||
#define RECT_PATH_DATA_MAX_SIZE (1 * MOVE_PATH_DATA_SIZE + 4 * CUBIC_PATH_DATA_SIZE + 4 * LINE_PATH_DATA_SIZE + 1 * END_PATH_DATA_SIZE)
|
||||
|
||||
/* Maximum possible arc path size
|
||||
* is in the rounded arc case:
|
||||
* - 1 move for the path start
|
||||
* - 16 cubics for the arc (5 inner, 5 outer) and corners (3 per corner)
|
||||
* - 1 end for the path end */
|
||||
#define ARC_PATH_DATA_MAX_SIZE (1 * MOVE_PATH_DATA_SIZE + 16 * CUBIC_PATH_DATA_SIZE + 1 * END_PATH_DATA_SIZE)
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Generates path data for rectangle drawing.
|
||||
*
|
||||
* @param[in/out] path The path data to initialize
|
||||
* @param[in/out] path_size The resulting size of the created path data
|
||||
* @param[in] dsc The style descriptor for the rectangle to be drawn
|
||||
* @param[in] coords The coordinates of the rectangle to be drawn
|
||||
*
|
||||
*/
|
||||
void vglite_create_rect_path_data(int32_t * path_data, uint32_t * path_data_size,
|
||||
int32_t radius,
|
||||
const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_DRAW_VGLITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VGLITE_PATH_H*/
|
||||
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* @file lv_vglite_utils.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2022-2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef LV_VGLITE_UTILS_H
|
||||
#define LV_VGLITE_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_DRAW_VGLITE
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
#include "vg_lite.h"
|
||||
#include "vg_lite_options.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define ENUM_TO_STRING(e) \
|
||||
case (e): \
|
||||
return #e
|
||||
|
||||
#if LV_USE_VGLITE_ASSERT
|
||||
#define VGLITE_ASSERT(expr) LV_ASSERT(expr)
|
||||
#else
|
||||
#define VGLITE_ASSERT(expr)
|
||||
#endif
|
||||
|
||||
#define VGLITE_ASSERT_MSG(expr, msg) \
|
||||
do { \
|
||||
if(!(expr)) { \
|
||||
LV_LOG_ERROR(msg); \
|
||||
VGLITE_ASSERT(false); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define VGLITE_CHECK_ERROR(function) \
|
||||
do { \
|
||||
vg_lite_error_t error = function; \
|
||||
if(error != VG_LITE_SUCCESS) { \
|
||||
LV_LOG_ERROR("Execute '" #function "' error(%d): %s", \
|
||||
(int)error, vglite_error_to_string(error)); \
|
||||
VGLITE_ASSERT(false); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set the clipping box.
|
||||
*
|
||||
* @param[in] clip_area Clip area with relative coordinates of destination buffer
|
||||
*
|
||||
*/
|
||||
static inline void vglite_set_scissor(const lv_area_t * clip_area);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
const char * vglite_error_to_string(vg_lite_error_t error);
|
||||
|
||||
#if LV_USE_VGLITE_DRAW_ASYNC
|
||||
/**
|
||||
* Get VG-Lite command buffer flushed status.
|
||||
*
|
||||
*/
|
||||
bool vglite_cmd_buf_is_flushed(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Flush command to VG-Lite.
|
||||
*
|
||||
*/
|
||||
void vglite_run(void);
|
||||
|
||||
/**
|
||||
* Wait for VG-Lite finish.
|
||||
*
|
||||
*/
|
||||
#if LV_USE_VGLITE_DRAW_ASYNC
|
||||
void vglite_wait_for_finish(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get vglite color. Premultiplies (if not hw already) and swizzles the given
|
||||
* LVGL 32bit color to obtain vglite color.
|
||||
*
|
||||
* @param[in] lv_col32 The initial LVGL 32bit color
|
||||
* @param[in] gradient True for gradient color
|
||||
*
|
||||
* @retval The vglite 32-bit color value:
|
||||
*
|
||||
*/
|
||||
vg_lite_color_t vglite_get_color(lv_color32_t lv_col32, bool gradient);
|
||||
|
||||
/**
|
||||
* Get vglite blend mode.
|
||||
*
|
||||
* @param[in] lv_blend_mode The LVGL blend mode
|
||||
*
|
||||
* @retval The vglite blend mode
|
||||
*
|
||||
*/
|
||||
vg_lite_blend_t vglite_get_blend_mode(lv_blend_mode_t lv_blend_mode);
|
||||
|
||||
/**
|
||||
* Get vglite buffer format.
|
||||
*
|
||||
* @param[in] cf Color format
|
||||
*
|
||||
* @retval The vglite buffer format
|
||||
*
|
||||
*/
|
||||
vg_lite_buffer_format_t vglite_get_buf_format(lv_color_format_t cf);
|
||||
|
||||
/**
|
||||
* Get vglite stride alignment.
|
||||
*
|
||||
* @param[in] cf Color format
|
||||
*
|
||||
* @retval Alignment requirement in bytes
|
||||
*
|
||||
*/
|
||||
uint8_t vglite_get_stride_alignment(lv_color_format_t cf);
|
||||
|
||||
/**
|
||||
* Check source start address and stride alignment.
|
||||
*
|
||||
* @param[in] buf Buffer address
|
||||
* @param[in] stride Stride of buffer in bytes
|
||||
* @param[in] cf Color format - to calculate the expected alignment
|
||||
*
|
||||
* @retval true Alignment OK
|
||||
*
|
||||
*/
|
||||
bool vglite_src_buf_aligned(const void * buf, uint32_t stride, lv_color_format_t cf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline void vglite_set_scissor(const lv_area_t * clip_area)
|
||||
{
|
||||
vg_lite_set_scissor(clip_area->x1, clip_area->y1, clip_area->x2 + 1, clip_area->y2 + 1);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_VGLITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_VGLITE_UTILS_H*/
|
||||
Reference in new issue
Block a user