improved SPI write for display speed
This commit is contained in:
parent
c6258b5ac5
commit
557491c0c9
|
@ -1276,6 +1276,7 @@ uint16_t LCD_IO_ReadData(uint16_t LCDReg){
|
||||||
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size)
|
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size)
|
||||||
{
|
{
|
||||||
uint32_t counter = 0;
|
uint32_t counter = 0;
|
||||||
|
HAL_StatusTypeDef status = HAL_OK;
|
||||||
|
|
||||||
/* Reset LCD control line CS */
|
/* Reset LCD control line CS */
|
||||||
LCD_CS_LOW();
|
LCD_CS_LOW();
|
||||||
|
@ -1291,6 +1292,15 @@ void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size)
|
||||||
}
|
}
|
||||||
else
|
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 */
|
/* Several data should be sent in a raw */
|
||||||
/* Direct SPI accesses for optimization */
|
/* Direct SPI accesses for optimization */
|
||||||
for (counter = Size; counter != 0; counter--)
|
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 */
|
/* Wait until the bus is ready before releasing Chip select */
|
||||||
while(((hspi1.Instance->SR) & SPI_FLAG_BSY) != RESET)
|
while(((hspi1.Instance->SR) & SPI_FLAG_BSY) != RESET)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deselect : Chip Select high */
|
/* Deselect : Chip Select high */
|
||||||
|
|
Loading…
Reference in New Issue