/* Get current baudrate for USART/UART. 
This function returns the actual baudrate (not considering oscillator inaccuracies) used by a USART/UART peripheral. */
uint32_t USART_BaudrateGet(USART_TypeDef *usart)
/* Get current baudrate for USART/UART. 
This function returns the actual baudrate (not considering oscillator inaccuracies) used by a USART/UART peripheral. */
uint32_t USART_BaudrateGet(USART_TypeDef *usart)
{
  uint32_t          freq;
  USART_OVS_TypeDef ovs;
  bool              syncmode;
  if (usart->CTRL & USART_CTRL_SYNC)
  {
    syncmode = true;
  }
  else
  {
    syncmode = false;
  }
  freq = CMU_ClockFreqGet(cmuClock_HFPER);
  ovs  = (USART_OVS_TypeDef)(usart->CTRL & _USART_CTRL_OVS_MASK);
  return USART_BaudrateCalc(freq, usart->CLKDIV, syncmode, ovs);
}