/ * @brief * Init USART for I2S mode. * * @details * This function will configure basic settings in order to operate in I2S * mode. * * Special control setup not covered by this function must be done after * using this function by direct modification of the CTRL and I2SCTRL * registers. * * Notice that pins used by the USART module must be properly configured * by the u
| 701 | * |
| 702 | ******************************************************************************/ |
| 703 | void USART_InitI2s(USART_TypeDef *usart, USART_InitI2s_TypeDef *init) |
| 704 | { |
| 705 | USART_Enable_TypeDef enable; |
| 706 | |
| 707 | /* Make sure the module exists on the selected chip */ |
| 708 | EFM_ASSERT(USART_I2S_VALID(usart)); |
| 709 | |
| 710 | /* Override the enable setting. */ |
| 711 | enable = init->sync.enable; |
| 712 | init->sync.enable = usartDisable; |
| 713 | |
| 714 | /* Init USART as a sync device. */ |
| 715 | USART_InitSync(usart, &init->sync); |
| 716 | |
| 717 | /* Configure and enable I2CCTRL register acording to selected mode. */ |
| 718 | usart->I2SCTRL = ((uint32_t)init->format) | |
| 719 | ((uint32_t)init->justify) | |
| 720 | (init->delay ? USART_I2SCTRL_DELAY : 0) | |
| 721 | (init->dmaSplit ? USART_I2SCTRL_DMASPLIT : 0) | |
| 722 | (init->mono ? USART_I2SCTRL_MONO : 0) | |
| 723 | (USART_I2SCTRL_EN); |
| 724 | |
| 725 | if (enable != usartDisable) |
| 726 | { |
| 727 | USART_Enable(usart, enable); |
| 728 | } |
| 729 | } |
| 730 | |
| 731 | |
| 732 | /***************************************************************************//** |
nothing calls this directly
no test coverage detected