官方代码如下:
00432 uint8_t sFLASH_SendByte(uint8_t byte)
00433 {
00434 /*!< Loop while DR register in not emplty */
00435 while (SPI_I2S_GetFlagStatus(sFLASH_SPI, SPI_I2S_FLAG_TXE) == RESET);
00436
00437 /*!< Send byte through the SPI1 peripheral */
00438 SPI_I2S_SendData(sFLASH_SPI, byte);
00439
00440 /*!< Wait to receive a byte */
00441 while (SPI_I2S_GetFlagStatus(sFLASH_SPI, SPI_I2S_FLAG_RXNE) == RESET);
00442
00443 /*!< Return the byte read from the SPI bus */
00444 return SPI_I2S_ReceiveData(sFLASH_SPI);
请问下,那是不是我想接收,一定要先发送个数据?不管主从模式,都可以用这个函数吗? |