/* Init USART0 for asynchronous IrDA mode. 
Notice that pins used by the USART/UART module must be properly configured by the user explicitly, in order for the USART/UART 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 USART_InitIrDA(const USART_InitIrDA_TypeDef *init)
/* Init USART0 for asynchronous IrDA mode. 
Notice that pins used by the USART/UART module must be properly configured by the user explicitly, in order for the USART/UART 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 USART_InitIrDA(const USART_InitIrDA_TypeDef *init)
{
  USART_InitAsync(USART0, &(init->async));
  USART0->CTRL |= USART_CTRL_TXINV;
  if (init->irRxInv)
  {
    USART0->CTRL |= USART_CTRL_RXINV;
  }
  USART0->IRCTRL |= (uint32_t)init->irPw |
                    (uint32_t)init->irPrsSel |
                    ((uint32_t)init->irFilt << _USART_IRCTRL_IRFILT_SHIFT) |
                    ((uint32_t)init->irPrsEn << _USART_IRCTRL_IRPRSEN_SHIFT);
  USART0->IRCTRL |= USART_IRCTRL_IREN;
}