有些库函数没有SPI_RxFIFOThresholdConfig函数,完整函数如下:
/**
* [url=home.php?mod=space&uid=247401]@brief[/url] Configures the FIFO reception threshold forthe selected SPI.
* @param SPIx: where x can be 1 or 2 to select the SPIperipheral.
* [url=home.php?mod=space&uid=536309]@NOTE[/url] SPI2 is not available for STM32F031 devices.
* @param SPI_RxFIFOThreshold: specifies the FIFOreception threshold.
* This parameter can be one of thefollowing values:
* [url=home.php?mod=space&uid=2817080]@ARG[/url] SPI_RxFIFOThreshold_HF: RXNEevent is generated if the FIFO
* levelis greater or equal to 1/2.
* @arg SPI_RxFIFOThreshold_QF: RXNEevent is generated if the FIFO
* levelis greater or equal to 1/4.
* @retval None
*/
voidSPI_RxFIFOThresholdConfig(SPI_TypeDef* SPIx, uint16_t SPI_RxFIFOThreshold)
{
/* Check the parameters */
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_RX_FIFO_THRESHOLD(SPI_RxFIFOThreshold));
/* Clear FRXTH bit */
SPIx->CR2 &=(uint16_t)~((uint16_t)SPI_CR2_FRXTH);
/* Set new FRXTH bit value*/
SPIx->CR2 |= SPI_RxFIFOThreshold;
}
|