mt2523 I2S的从模式是不是不能用
时间:10-02
整理:3721RD
点击:
MT2523 I2S的从模式是不是不能用,为什么设置为slave模式之后,SCK和WS引脚还有波形输出
- #if 1
- hal_GPIO_init(HAL_GPIO_11);
- hal_pinmux_set_function(HAL_GPIO_11, gpio_mode);
- hal_gpio_set_direction(HAL_GPIO_11, HAL_GPIO_DIRECTION_OUTPUT);
- // configure data in(DI) pin
- ret = hal_gpio_init(HAL_GPIO_12);
- hal_pinmux_set_function(HAL_GPIO_12, gpio_mode);
- ret = hal_gpio_set_direction(HAL_GPIO_12, HAL_GPIO_DIRECTION_INPUT);
- // configure word select(WS) pin
- ret = hal_gpio_init(HAL_GPIO_13);
- hal_pinmux_set_function(HAL_GPIO_13, gpio_mode);
- ret = hal_gpio_set_direction(HAL_GPIO_13, HAL_GPIO_DIRECTION_INPUT);
- // configure bit clock(BCLK) pin
- ret = hal_gpio_init(HAL_GPIO_14);
- hal_pinmux_set_function(HAL_GPIO_14, gpio_mode);
- ret = hal_gpio_set_direction(HAL_GPIO_14, HAL_GPIO_DIRECTION_INPUT);
- #endif
- static int32_t i2s_open(void)
- {
- uint32_t memory_size = 0;
- uint8_t *memory;
- hal_i2s_config_t i2s_config;
- hal_i2s_status_t result = HAL_I2S_STATUS_OK;
- LOG_I(WM8904,"ENTER\r\n");
- i2s_config.clock_mode = HAL_I2S_SLAVE;//HAL_I2S_SLAVE;HAL_I2S_MASTER
- // configure the RX settings
- i2s_config.i2s_in.sample_rate = HAL_I2S_SAMPLE_RATE_8K;
- i2s_config.i2s_in.channel_number = HAL_I2S_MONO;
- // configure the TX settings
- i2s_config.i2s_out.sample_rate = HAL_I2S_SAMPLE_RATE_8K;
- i2s_config.i2s_out.channel_number = HAL_I2S_MONO;
- // set the I2S to an external mode.
- result = hal_i2s_init(HAL_I2S_TYPE_EXTERNAL_MODE);
- if(HAL_I2S_STATUS_OK != result)
- {
- LOG_E(freeRTOS,"error result = %d \r\n",result);
- return -1;
- }
- result = hal_i2s_set_config(&i2s_config);
- if(HAL_I2S_STATUS_OK != result)
- {
- LOG_E(FreeRTOS,"error result = %d \r\n",result);
- return -2;
- }
-
- // get the amount of internal-use memory
- hal_i2s_get_memory_size(&memory_size);
-
- LOG_I(WM8904,"memory_size =%d\r\n",memory_size);
- /*memory_size = 640;
- memory = pvPortMalloc(memory_size * sizeof(uint8_t));
- if(NULL == memory)
- {
- LOG_E(freertos,"error result = %d \r\n",result);
- }*/
- memory = (uint8_t *)&i2s_memory_size[0];
- result = hal_i2s_set_memory(memory);
- if(HAL_I2S_STATUS_OK != result)
- {
- LOG_E(freertos,"error result = %d \r\n",result);
- }
- LOG_I(WM8904,"pass\r\n");
- hal_i2s_register_tx_callback(user_i2s_tx_callback, NULL);
- hal_i2s_register_rx_callback(user_i2s_rx_callback, NULL);
- LOG_I(WM8904,"pass\r\n");
- result = hal_i2s_enable_tx();
- if(HAL_I2S_STATUS_OK != result)
- {
- LOG_E(freertos,"there is an error \r\n");
- return result;
- }
-
- result = hal_i2s_enable_rx();
- if(HAL_I2S_STATUS_OK != result)
- {
- LOG_E(freertos,"there is an error \r\n");
- return result;
- }
- LOG_I(WM8904,"EXIT\r\n");
- return 1;
- }
这个表示看不懂
看不懂。只能默默的为小编祈祷下。
路过,看看
路过,看一看
路过!
spec里一般都有说明