LVGL fix byte order for DMA and non-DMA (#11897)

Co-authored-by: Stephan Hadinger <stephan.hadinger@gmail.com>
This commit is contained in:
s-hadinger 2021-04-26 14:33:20 +02:00 committed by GitHub
parent 589ccb0f2f
commit 7cb30b07da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 7 deletions

View File

@ -1064,6 +1064,8 @@ void uDisplay::pushColors(uint16_t *data, uint16_t len, boolean first) {
if (lvgl_param.use_dma) {
pushPixelsDMA(data, len );
} else {
// reversed order for DMA, so non-DMA needs to get back to normal order
for (uint32_t i = 0; i < len; i++) (data[i] = data[i] << 8 | data[i] >> 8);
uspi->writePixels(data, len * 2);
}
#endif
@ -1923,11 +1925,6 @@ void uDisplay::pushPixelsDMA(uint16_t* image, uint32_t len) {
dmaWait();
/*
if(_swapBytes) {
for (uint32_t i = 0; i < len; i++) (image[i] = image[i] << 8 | image[i] >> 8);
}*/
esp_err_t ret;
memset(&trans, 0, sizeof(spi_transaction_t));

View File

@ -37,7 +37,7 @@
* Useful if the display has a 8 bit interface (e.g. SPI)*/
// #define LV_COLOR_16_SWAP 1
// #if defined(ADAFRUIT_PYPORTAL)
// #define LV_COLOR_16_SWAP 1
#define LV_COLOR_16_SWAP 1 // needed for DMA transfer
// #else
// #define LV_COLOR_16_SWAP 0
// #endif

View File

@ -168,7 +168,7 @@ void lv_flush_callback(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *c
lv_disp_flush_ready(disp);
if (pixels_len >= 10000) {
if (pixels_len >= 10000 && (!display->lvgl_param.use_dma)) {
AddLog(LOG_LEVEL_DEBUG, D_LOG_LVGL "Refreshed %d pixels in %d ms (%i pix/ms)", pixels_len, chrono_time,
chrono_time > 0 ? pixels_len / chrono_time : -1);
}