/ * @brief * Get current baudrate for USART/UART. * * @details * This function returns the actual baudrate (not considering oscillator * inaccuracies) used by a USART/UART peripheral. * * @param[in] usart * Pointer to USART/UART peripheral register block. * * @return * Current baudrate. ******************************************************************************/
| 360 | * Current baudrate. |
| 361 | ******************************************************************************/ |
| 362 | uint32_t USART_BaudrateGet(USART_TypeDef *usart) |
| 363 | { |
| 364 | uint32_t freq; |
| 365 | USART_OVS_TypeDef ovs; |
| 366 | bool syncmode; |
| 367 | |
| 368 | if (usart->CTRL & USART_CTRL_SYNC) |
| 369 | { |
| 370 | syncmode = true; |
| 371 | } |
| 372 | else |
| 373 | { |
| 374 | syncmode = false; |
| 375 | } |
| 376 | |
| 377 | /* HFPERCLK used to clock all USART/UART peripheral modules */ |
| 378 | freq = CMU_ClockFreqGet(cmuClock_HFPER); |
| 379 | ovs = (USART_OVS_TypeDef)(usart->CTRL & _USART_CTRL_OVS_MASK); |
| 380 | return USART_BaudrateCalc(freq, usart->CLKDIV, syncmode, ovs); |
| 381 | } |
| 382 | |
| 383 | |
| 384 | /***************************************************************************//** |
nothing calls this directly
no test coverage detected