SPI_flash 程序的写FLASH有疑问。谁能帮我解释一下。

[复制链接]
397|0
 楼主| 冷冻链 发表于 2019-11-27 12:36 | 显示全部楼层 |阅读模式
u8 SPI_FLASH_SendByte(u8 byte)
{
  /* 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, byte);
  /* 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);
}

while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);//等待接受寄存器非空

写个字节后,如果FLASH没给数据那岂不是一直在等了????
您需要登录后才可以回帖 登录 | 注册

本版积分规则

397

主题

397

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部