diff --git a/mlx90640/stm32_hx8347d_lcd.c b/mlx90640/stm32_hx8347d_lcd.c index 97af836..7c9a418 100644 --- a/mlx90640/stm32_hx8347d_lcd.c +++ b/mlx90640/stm32_hx8347d_lcd.c @@ -1276,6 +1276,7 @@ uint16_t LCD_IO_ReadData(uint16_t LCDReg){ void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size) { uint32_t counter = 0; + HAL_StatusTypeDef status = HAL_OK; /* Reset LCD control line CS */ LCD_CS_LOW(); @@ -1291,6 +1292,15 @@ void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size) } else { + while (Size >0) { + uint16_t chunk_size = Size > 65535 ? 65535 : Size; + HAL_SPI_Transmit(&hspi1, pData, chunk_size, HAL_MAX_DELAY); + + pData += chunk_size; + Size -= chunk_size; + /* Check the communication status */ + } +#if 0 /* Several data should be sent in a raw */ /* Direct SPI accesses for optimization */ for (counter = Size; counter != 0; counter--) @@ -1312,7 +1322,8 @@ void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size) /* Wait until the bus is ready before releasing Chip select */ while(((hspi1.Instance->SR) & SPI_FLAG_BSY) != RESET) { - } + } +#endif } /* Deselect : Chip Select high */