stm32/usart: Implemented a function to get the current parity setting for a USART
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
48a8355874
commit
188671389d
@@ -104,6 +104,7 @@ uint32_t usart_get_databits(uint32_t usart);
|
|||||||
void usart_set_stopbits(uint32_t usart, uint32_t stopbits);
|
void usart_set_stopbits(uint32_t usart, uint32_t stopbits);
|
||||||
uint32_t usart_get_stopbits(uint32_t usart);
|
uint32_t usart_get_stopbits(uint32_t usart);
|
||||||
void usart_set_parity(uint32_t usart, uint32_t parity);
|
void usart_set_parity(uint32_t usart, uint32_t parity);
|
||||||
|
uint32_t usart_get_parity(uint32_t usart);
|
||||||
void usart_set_mode(uint32_t usart, uint32_t mode);
|
void usart_set_mode(uint32_t usart, uint32_t mode);
|
||||||
void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol);
|
void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol);
|
||||||
void usart_enable(uint32_t usart);
|
void usart_enable(uint32_t usart);
|
||||||
|
|||||||
@@ -170,6 +170,22 @@ void usart_set_parity(uint32_t usart, uint32_t parity)
|
|||||||
USART_CR1(usart) = reg32;
|
USART_CR1(usart) = reg32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/** @brief USART Get Parity.
|
||||||
|
|
||||||
|
The stop bits are specified as 0.5, 1, 1.5 or 2.
|
||||||
|
|
||||||
|
@param[in] usart unsigned 32 bit. USART block register address base @ref
|
||||||
|
usart_reg_base
|
||||||
|
@returns unsigned 32 bit Parity @ref usart_cr2_stopbits.
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint32_t usart_get_parity(uint32_t usart)
|
||||||
|
{
|
||||||
|
const uint32_t reg32 = USART_CR1(usart);
|
||||||
|
return reg32 & USART_PARITY_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @brief USART Set Rx/Tx Mode.
|
/** @brief USART Set Rx/Tx Mode.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user