定义一个变量
uint8_t
SPI3_RecData=0;
main.c中,
#include "bsp.h"
main函数中:
SPI3_RecData =
SPI_ENCODER_SendByte(0x55);
Bsp.c中:
uint8_t SPI_ENCODER_SendByte(uint8_t byte)
{
while (SPI_I2S_GetFlagStatus(SPI3, SPI_I2S_FLAG_TXE) == RESET);
/* Send byte through the SPI3 peripheral */
SPI_I2S_SendData(SPI3, byte);
/* Wait to receive a byte */
while (SPI_I2S_GetFlagStatus(SPI3, SPI_I2S_FLAG_RXNE) == RESET);
/* Return the byte read from the SPI bus */
return SPI_I2S_ReceiveData(SPI3);
}
在bsp.h中
uint8_t SPI_ENCODER_SendByte(uint8_t byte);
Warning[Pe550]: variable "SPI3_RecData" was set but never used。
|