stm32/common: Implemented oversampling control support for the F2/F4 parts
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
03a884bcca
commit
94411df91f
@@ -89,6 +89,16 @@ specific memorymap.h header before including this header file.*/
|
|||||||
/* OVER8: Oversampling mode */
|
/* OVER8: Oversampling mode */
|
||||||
#define USART_CR1_OVER8 (1 << 15)
|
#define USART_CR1_OVER8 (1 << 15)
|
||||||
|
|
||||||
|
/* CR1_OVER8 values */
|
||||||
|
/****************************************************************************/
|
||||||
|
/** @defgroup usart_cr1_oversampling USART Oversampling Mode Selection
|
||||||
|
@ingroup STM32F_usart_defines
|
||||||
|
|
||||||
|
@{*/
|
||||||
|
#define USART_OVERSAMPLING_8 USART_CR1_OVER8
|
||||||
|
#define USART_OVERSAMPLING_16 0U
|
||||||
|
/**@}*/
|
||||||
|
|
||||||
/* --- USART_CR3 values ---------------------------------------------------- */
|
/* --- USART_CR3 values ---------------------------------------------------- */
|
||||||
|
|
||||||
/* ONEBIT: One sample bit method enable */
|
/* ONEBIT: One sample bit method enable */
|
||||||
@@ -96,6 +106,12 @@ specific memorymap.h header before including this header file.*/
|
|||||||
|
|
||||||
#define USART_BRR_UPPER_MASK (0x0000fff0U)
|
#define USART_BRR_UPPER_MASK (0x0000fff0U)
|
||||||
#define USART_BRR_LOWER_MASK (0x0000000fU)
|
#define USART_BRR_LOWER_MASK (0x0000000fU)
|
||||||
|
|
||||||
|
BEGIN_DECLS
|
||||||
|
|
||||||
|
void usart_set_oversampling(uint32_t usart, uint32_t mode);
|
||||||
|
|
||||||
|
END_DECLS
|
||||||
#endif
|
#endif
|
||||||
/** @cond */
|
/** @cond */
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -110,5 +110,14 @@ bool usart_get_flag(uint32_t usart, uint32_t flag)
|
|||||||
return ((USART_SR(usart) & flag) != 0);
|
return ((USART_SR(usart) & flag) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIBOPENCM3_USART_COMMON_F24_H
|
||||||
|
void usart_set_oversampling(uint32_t usart, uint32_t mode)
|
||||||
|
{
|
||||||
|
if (mode)
|
||||||
|
USART_CR1(usart) |= USART_CR1_OVER8;
|
||||||
|
else
|
||||||
|
USART_CR1(usart) &= ~USART_CR1_OVER8;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|||||||
Reference in New Issue
Block a user