新手求教。
最近在做一个将基于Silicon的EFM32的程序移植到基于KEIL5的STM32F1的板子上。
下面是其中一部分EFM32的程序,想要将其转换成STM32的程序
其中关于TXDATA RXDATA USART_STATOS_TXBL这三个代码我不太明白如何修改
望各位不吝赐教。
不胜感激!
/***************************************************************************//**
* @brief
* Perform one 8 bit frame SPI transfer.
*
* @note
* This function will stall if the transmit buffer is full. When a transmit
* buffer becomes available, data is written and the function will wait until
* the data is fully transmitted. The SPI return value is then read out and
* returned.
*
* @param[in] usart
* Pointer to USART peripheral register block.
*
* @param[in] data
* Data to transmit.
*
* @return
* Data received.
******************************************************************************/
uint8_t USART_SpiTransfer(USART_TypeDef *usart, uint8_t data)
{
while (!(usart->STATUS & USART_STATUS_TXBL))
;
usart->TXDATA = (uint32_t)data;
while (!(usart->STATUS & USART_STATUS_TXC))
;
return (uint8_t)usart->RXDATA;
} |