/* Init LEUART. 
Notice that pins used by the LEUART module must be properly configured by the user explicitly, in order for the LEUART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.) */
void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef *init)
/* Init LEUART. 
Notice that pins used by the LEUART module must be properly configured by the user explicitly, in order for the LEUART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.) */
void LEUART_Init(LEUART_TypeDef *leuart, LEUART_Init_TypeDef *init)
{
  EFM_ASSERT(LEUART_REF_VALID(leuart));
  LEUART_Sync(leuart, LEUART_SYNCBUSY_CMD);
  leuart->CMD = LEUART_CMD_RXDIS | LEUART_CMD_TXDIS;
  LEUART_FreezeEnable(leuart, true);
  leuart->CTRL = (leuart->CTRL & ~(_LEUART_CTRL_PARITY_MASK |
                                   _LEUART_CTRL_STOPBITS_MASK)) |
                 (uint32_t)(init->databits) |
                 (uint32_t)(init->parity) |
                 (uint32_t)(init->stopbits);
  LEUART_BaudrateSet(leuart, init->refFreq, init->baudrate);
  leuart->CMD = (uint32_t)(init->enable);
  LEUART_FreezeEnable(leuart, false);
}