/ * @brief * Init USART0 for asynchronous IrDA mode. * * @details * This function will configure basic settings in order to operate in * asynchronous IrDA mode. * * Special control setup not covered by this function must be done after * using this function by direct modification of the CTRL and IRCTRL * registers. * * Notice that pins used by the USART/UART module must be
| 646 | * |
| 647 | ******************************************************************************/ |
| 648 | void USART_InitIrDA(const USART_InitIrDA_TypeDef *init) |
| 649 | { |
| 650 | /* Init USART0 as async device */ |
| 651 | USART_InitAsync(USART0, &(init->async)); |
| 652 | |
| 653 | /* Set IrDA modulation to RZI (return-to-zero-inverted) */ |
| 654 | USART0->CTRL |= USART_CTRL_TXINV; |
| 655 | |
| 656 | /* Invert Rx signal before demodulator if enabled */ |
| 657 | if (init->irRxInv) |
| 658 | { |
| 659 | USART0->CTRL |= USART_CTRL_RXINV; |
| 660 | } |
| 661 | |
| 662 | /* Configure IrDA */ |
| 663 | USART0->IRCTRL |= (uint32_t)init->irPw | |
| 664 | (uint32_t)init->irPrsSel | |
| 665 | ((uint32_t)init->irFilt << _USART_IRCTRL_IRFILT_SHIFT) | |
| 666 | ((uint32_t)init->irPrsEn << _USART_IRCTRL_IRPRSEN_SHIFT); |
| 667 | |
| 668 | /* Enable IrDA */ |
| 669 | USART0->IRCTRL |= USART_IRCTRL_IREN; |
| 670 | } |
| 671 | |
| 672 | |
| 673 | #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_TINY_FAMILY) |
nothing calls this directly
no test coverage detected