|
@@ -217,13 +217,13 @@ void myRadio_gpio_init(RADIO_GPIO_CALLBACK cb)
|
|
|
}
|
|
|
uint8_t myRadioSpi_rwByte(uint8_t byteToWrite)
|
|
|
{
|
|
|
- uint8_t i, temp;
|
|
|
- temp = 0;
|
|
|
+ uint16_t i = 0;
|
|
|
+ uint8_t temp = 0;
|
|
|
#if defined(SPI_HARD)
|
|
|
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET) //检查指定的SPI标志位设置与否:发送缓存空标志位
|
|
|
{
|
|
|
i++;
|
|
|
- if(i > 200)return 0;
|
|
|
+ if(i > 2000)return 0;
|
|
|
}
|
|
|
SPI_I2S_SendData(SPI1, byteToWrite); //通过外设SPIx发送一个数据
|
|
|
i=0;
|
|
@@ -231,7 +231,7 @@ uint8_t myRadioSpi_rwByte(uint8_t byteToWrite)
|
|
|
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET)//检查指定的SPI标志位设置与否:接受缓存非空标志位
|
|
|
{
|
|
|
i++;
|
|
|
- if(i > 200)return 0;
|
|
|
+ if(i > 2000)return 0;
|
|
|
}
|
|
|
/*!< Return the byte read from the SPI bus */
|
|
|
temp = SPI_I2S_ReceiveData(SPI1);
|
|
@@ -268,23 +268,23 @@ uint8_t myRadioSpi_rwByte(uint8_t byteToWrite)
|
|
|
|
|
|
void myRadioSpi_wBuffer(uint8_t* pData, uint8_t len)
|
|
|
{
|
|
|
- uint8_t i;
|
|
|
-
|
|
|
- for(i = 0; i < len; i++)
|
|
|
- {
|
|
|
- myRadioSpi_rwByte(*pData);
|
|
|
- pData ++;
|
|
|
- }
|
|
|
+ uint8_t i;
|
|
|
+
|
|
|
+ for(i = 0; i < len; i++)
|
|
|
+ {
|
|
|
+ myRadioSpi_rwByte(*pData);
|
|
|
+ pData ++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void myRadioSpi_rBuffer(uint8_t* pData, uint8_t len)
|
|
|
{
|
|
|
- uint8_t i;
|
|
|
-
|
|
|
- for(i = 0; i < len; i++)
|
|
|
- {
|
|
|
- *pData = myRadioSpi_rwByte(0xFF);
|
|
|
- pData ++;
|
|
|
- }
|
|
|
+ uint8_t i;
|
|
|
+
|
|
|
+ for(i = 0; i < len; i++)
|
|
|
+ {
|
|
|
+ *pData = myRadioSpi_rwByte(0xFF);
|
|
|
+ pData ++;
|
|
|
+ }
|
|
|
}
|
|
|
|