/ * @brief * Init USART/UART for normal asynchronous mode. * * @details * This function will configure basic settings in order to operate in normal * asynchronous mode. * * Special control setup not covered by this function must be done after * using this function by direct modification of the CTRL register. * * Notice that pins used by the USART/UART module must be properly
| 525 | * Pointer to initialization structure used to configure basic async setup. |
| 526 | ******************************************************************************/ |
| 527 | void USART_InitAsync(USART_TypeDef *usart, const USART_InitAsync_TypeDef *init) |
| 528 | { |
| 529 | /* Make sure the module exists on the selected chip */ |
| 530 | EFM_ASSERT(USART_REF_VALID(usart)||UART_REF_VALID(usart)); |
| 531 | |
| 532 | /* Init USART registers to HW reset state. */ |
| 533 | USART_Reset(usart); |
| 534 | |
| 535 | #if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_TINY_FAMILY) |
| 536 | /* Disable majority vote if specified. */ |
| 537 | if (init->mvdis) |
| 538 | { |
| 539 | usart->CTRL |= USART_CTRL_MVDIS; |
| 540 | } |
| 541 | |
| 542 | /* Configure PRS input mode. */ |
| 543 | if (init->prsRxEnable) |
| 544 | { |
| 545 | usart->INPUT = (uint32_t)init->prsRxCh | USART_INPUT_RXPRS; |
| 546 | } |
| 547 | #endif |
| 548 | |
| 549 | /* Configure databits, stopbits and parity */ |
| 550 | usart->FRAME = (uint32_t)(init->databits) | |
| 551 | (uint32_t)(init->stopbits) | |
| 552 | (uint32_t)(init->parity); |
| 553 | |
| 554 | /* Configure baudrate */ |
| 555 | USART_BaudrateAsyncSet(usart, init->refFreq, init->baudrate, init->oversampling); |
| 556 | |
| 557 | /* Finally enable (as specified) */ |
| 558 | usart->CMD = (uint32_t)(init->enable); |
| 559 | } |
| 560 | |
| 561 | |
| 562 | /***************************************************************************//** |
no test coverage detected