| 
 
| /** * @brief  使能或失能USART的.---Enables or disables the USART's 8x oversampling mode.
 * @param  USARTx:  ---Select the USART or the UART peripheral.
 *         这个参数可以是下面的值之一 : USART1, USART2, USART3, UART4 or UART5.
 *         This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
 * @param  NewState: new state of the USART one bit sampling methode.
 *        This parameter can be: ENABLE or DISABLE.
 * @note
 *     This function has to be called before calling USART_Init()
 *     function in order to have correct baudrate Divider value.
 * @retval None
 */
 void USART_OverSampling8Cmd(USART_TypeDef* USARTx, FunctionalState NewState)
 {
 /* Check the parameters */
 assert_param(IS_USART_ALL_PERIPH(USARTx));
 assert_param(IS_FUNCTIONAL_STATE(NewState));
 
 if (NewState != DISABLE)
 {
 /* Enable the 8x Oversampling mode by setting the OVER8 bit in the CR1 register */
 USARTx->CR1 |= CR1_OVER8_Set;
 }
 else
 {
 /* Disable the 8x Oversampling mode by clearing the OVER8 bit in the CR1 register */
 USARTx->CR1 &= CR1_OVER8_Reset;
 }
 }
 /**
 * @brief  Enables or disables the USART's one bit sampling methode.
 * @param  USARTx: Select the USART or the UART peripheral.
 *
 *   This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5.
 * @param  NewState: new state of the USART one bit sampling methode.
 *   This parameter can be: ENABLE or DISABLE.
 * @retval None
 */
 void USART_OneBitMethodCmd(USART_TypeDef* USARTx, FunctionalState NewState)
 {
 /* Check the parameters */
 assert_param(IS_USART_ALL_PERIPH(USARTx));
 assert_param(IS_FUNCTIONAL_STATE(NewState));
 
 if (NewState != DISABLE)
 {
 /* Enable the one bit method by setting the ONEBITE bit in the CR3 register */
 USARTx->CR3 |= CR3_ONEBITE_Set;
 }
 else
 {
 /* Disable tthe one bit method by clearing the ONEBITE bit in the CR3 register */
 USARTx->CR3 &= CR3_ONEBITE_Reset;
 }
 }
 | 
 |