From ceef7a5f9104c1d71a6e19e013f6502a6544899b Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 25 Oct 2024 11:03:34 +0800 Subject: [PATCH] fix(mipi_dsi): error logic in reading short packet --- components/hal/mipi_dsi_hal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/hal/mipi_dsi_hal.c b/components/hal/mipi_dsi_hal.c index 7ef078c2c6..84eac4fdb7 100644 --- a/components/hal/mipi_dsi_hal.c +++ b/components/hal/mipi_dsi_hal.c @@ -206,10 +206,10 @@ void mipi_dsi_hal_host_gen_read_short_packet(mipi_dsi_hal_context_t *hal, uint8_ while (!mipi_dsi_host_ll_gen_is_read_fifo_empty(hal->host)) { temp = mipi_dsi_host_ll_gen_read_payload_fifo(hal->host); for (int i = 0; i < 4; i++) { - if ((counter + i) < buffer_size) { - receive_buffer[counter + i] = (temp >> (8 * i)) & 0xFF; + if (counter < buffer_size) { + receive_buffer[counter] = (temp >> (8 * i)) & 0xFF; + counter++; } - counter++; } } }