void SpiFlash_WaitReady(void) { uint8_t ReturnValue; do { ReturnValue = SpiFlash_ReadStatusReg(); ReturnValue = ReturnValue & 1; } while(ReturnValue!=0); // check the BUSY bit }
/** * @brief Wait SPI flash ready. * @param spi is the base address of SPI module. * @return None. * @note Before calling this function, the transaction length (data width) must be configured as 8 bits. */ void SpiFlash_WaitReady(SPI_T *spi) { while((SpiFlash_ReadStatusReg(spi)) & 1); /* check the BUSY status bit */ }