MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / USART_BaudrateGet

Function USART_BaudrateGet

bsp/efm32/Libraries/emlib/src/em_usart.c:362–381  ·  view source on GitHub ↗

/ * @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. ******************************************************************************/

Source from the content-addressed store, hash-verified

360 * Current baudrate.
361 ******************************************************************************/
362uint32_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/***************************************************************************//**

Callers

nothing calls this directly

Calls 2

CMU_ClockFreqGetFunction · 0.85
USART_BaudrateCalcFunction · 0.85

Tested by

no test coverage detected