高级会员

- 积分
- 906
- 金钱
- 906
- 注册时间
- 2016-3-26
- 在线时间
- 116 小时
|
1金钱
因为SPI_FLASH是8位的数据格式,然后串口的发送函数要求入口参数数据是16位的。显示格式不一致的问题,这怎么解决?
串口发送函数:
uint16_t USART_ReceiveData(USART_TypeDef* USARTx)
{
/* Check the parameters */
assert_param(IS_USART_ALL_PERIPH(USARTx));
/* Receive Data */
return (uint16_t)(USARTx->DR & (uint16_t)0x01FF);
}
SPI_FLASH读取函数:
void W25X80_Read(u8* pBuffer,u32 ReadAddr,u16 NumByteToRead)
{
u16 i;
W25X80_CS=0;
SPI2_ReadWriteByte(W25X_ReadData);
SPI2_ReadWriteByte((u8)((ReadAddr)>>16));
SPI2_ReadWriteByte((u8)((ReadAddr)>>8));
SPI2_ReadWriteByte((u8)ReadAddr);
for(i=0;i<NumByteToRead;i++)
{
pBuffer=SPI2_ReadWriteByte(0XFF);
}
W25X80_CS=1;
}
|
|