mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 04:37:55 +08:00
feat(EVE): allow disabling write buffering (#9072)
Co-authored-by: André Costa <andre_miguel_costa@hotmail.com>
This commit is contained in:
@@ -544,7 +544,7 @@ menu "LVGL configuration"
|
||||
depends on LV_USE_DRAW_EVE
|
||||
|
||||
config LV_DRAW_EVE_WRITE_BUFFER_SIZE
|
||||
int "Max bytes to buffer for each SPI transmission"
|
||||
int "Max bytes to buffer for each SPI transmission or 0 to disable buffering"
|
||||
default 2048
|
||||
depends on LV_USE_DRAW_EVE
|
||||
|
||||
|
||||
+3
-1
@@ -395,7 +395,9 @@
|
||||
/* EVE_GEN value: 2, 3, or 4 */
|
||||
#define LV_DRAW_EVE_EVE_GENERATION 4
|
||||
|
||||
/* the maximum number of bytes to buffer before a single SPI transmission */
|
||||
/* The maximum number of bytes to buffer before a single SPI transmission.
|
||||
* Set it to 0 to disable write buffering.
|
||||
*/
|
||||
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE 2048
|
||||
#endif
|
||||
|
||||
|
||||
@@ -33,6 +33,13 @@ extern "C" {
|
||||
#include "../../font/lv_font_fmt_txt.h"
|
||||
#include "../lv_draw_arc.h"
|
||||
|
||||
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE != 0 && LV_DRAW_EVE_WRITE_BUFFER_SIZE < 4
|
||||
#warning LV_DRAW_EVE_WRITE_BUFFER_SIZE cannot be less than 4. Using 0 (buffering disabled).
|
||||
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL 0
|
||||
#else
|
||||
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL LV_DRAW_EVE_WRITE_BUFFER_SIZE
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@@ -60,8 +67,10 @@ struct _lv_draw_eve_unit_t {
|
||||
lv_draw_eve_ramg_t ramg;
|
||||
lv_draw_eve_parameters_t params;
|
||||
lv_draw_eve_operation_cb_t op_cb;
|
||||
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL
|
||||
uint32_t lv_eve_write_buf_len;
|
||||
uint8_t lv_eve_write_buf[LV_DRAW_EVE_WRITE_BUFFER_SIZE];
|
||||
uint8_t lv_eve_write_buf[LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL];
|
||||
#endif
|
||||
};
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -39,10 +39,14 @@ static inline void EVE_pdn_clear(void)
|
||||
|
||||
static inline void spi_transmit(uint8_t data)
|
||||
{
|
||||
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL
|
||||
if(lv_eve_write_buf_len == sizeof(lv_eve_write_buf)) {
|
||||
lv_eve_target_flush_write_buf();
|
||||
}
|
||||
lv_eve_write_buf[lv_eve_write_buf_len++] = data;
|
||||
#else
|
||||
lv_draw_eve_unit_g->op_cb(lv_draw_eve_unit_g->disp, LV_DRAW_EVE_OPERATION_SPI_SEND, &data, sizeof(data));
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void spi_transmit_32(uint32_t data)
|
||||
@@ -50,6 +54,7 @@ static inline void spi_transmit_32(uint32_t data)
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
data = lv_swap_bytes_32(data);
|
||||
#endif
|
||||
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL
|
||||
if(lv_eve_write_buf_len + 4 > sizeof(lv_eve_write_buf)) {
|
||||
lv_eve_target_flush_write_buf();
|
||||
}
|
||||
@@ -58,6 +63,9 @@ static inline void spi_transmit_32(uint32_t data)
|
||||
lv_eve_write_buf[lv_eve_write_buf_len++] = buf4[1];
|
||||
lv_eve_write_buf[lv_eve_write_buf_len++] = buf4[2];
|
||||
lv_eve_write_buf[lv_eve_write_buf_len++] = buf4[3];
|
||||
#else
|
||||
lv_draw_eve_unit_g->op_cb(lv_draw_eve_unit_g->disp, LV_DRAW_EVE_OPERATION_SPI_SEND, &data, sizeof(data));
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void lv_eve_target_spi_transmit_buf(const void * data, uint32_t size)
|
||||
@@ -68,11 +76,13 @@ static inline void lv_eve_target_spi_transmit_buf(const void * data, uint32_t si
|
||||
|
||||
static inline void lv_eve_target_flush_write_buf(void)
|
||||
{
|
||||
#if LV_DRAW_EVE_WRITE_BUFFER_SIZE_INTERNAL
|
||||
if(lv_eve_write_buf_len == 0) {
|
||||
return;
|
||||
}
|
||||
lv_draw_eve_unit_g->op_cb(lv_draw_eve_unit_g->disp, LV_DRAW_EVE_OPERATION_SPI_SEND, lv_eve_write_buf, lv_eve_write_buf_len);
|
||||
lv_eve_write_buf_len = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void spi_transmit_burst(uint32_t data)
|
||||
|
||||
@@ -1122,7 +1122,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* the maximum number of bytes to buffer before a single SPI transmission */
|
||||
/* The maximum number of bytes to buffer before a single SPI transmission.
|
||||
* Set it to 0 to disable write buffering.
|
||||
*/
|
||||
#ifndef LV_DRAW_EVE_WRITE_BUFFER_SIZE
|
||||
#ifdef CONFIG_LV_DRAW_EVE_WRITE_BUFFER_SIZE
|
||||
#define LV_DRAW_EVE_WRITE_BUFFER_SIZE CONFIG_LV_DRAW_EVE_WRITE_BUFFER_SIZE
|
||||
|
||||
Reference in New Issue
Block a user