下面代码中,RXP标志位只置位了1次,数组中只有一个数据
void BSP_SPI1_SendData(uint16_t data)
{
NSS_L();
if(LL_SPI_IsActiveFlag_TXP(SPI1))
{
LL_SPI_TransmitData16(SPI1,data);
}
for(int i = 0; i < 2; i++)
{
LL_SPI_TransmitData16(SPI1,0x0000);
if(LL_SPI_IsActiveFlag_RXP(SPI1))
{
SPI_Str.Rx.buffer[i] = LL_SPI_ReceiveData16(SPI1);
}
}
while(LL_SPI_IsActiveFlag_TXC(SPI1) == RESET);
LL_SPI_ClearFlag_TXTF(SPI1);
// LL_SPI_Disable(SPI1);
NSS_H();
}
|