* º¯ÊýÃû£ºSPI1_ReadWrite
* ÃèÊö £ºSPI1¶Áдһ×Ö½ÚÊý¾Ý
* ÊäÈë £º
* Êä³ö £º
* ·µ»Ø £º
*/
unsigned char SPI1_ReadWrite(unsigned char writedat)
{
/* Loop while DR register in not emplty */
while(SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_TXE) == RESET);
/* Send byte through the SPI1 peripheral */
SPI_I2S_SendData(SPI1, writedat);
/* Wait to receive a byte */
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
/* Return the byte read from the SPI bus */
return SPI_I2S_ReceiveData(SPI1);
}
* ÃèÊö £ºSPI1¶Áдһ×Ö½ÚÊý¾Ý
* ÊäÈë £º
* Êä³ö £º
* ·µ»Ø £º
*/
unsigned char SPI1_ReadWrite(unsigned char writedat)
{
/* Loop while DR register in not emplty */
while(SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_TXE) == RESET);
/* Send byte through the SPI1 peripheral */
SPI_I2S_SendData(SPI1, writedat);
/* Wait to receive a byte */
while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
/* Return the byte read from the SPI bus */
return SPI_I2S_ReceiveData(SPI1);
}