mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-22 09:01:08 +00:00
i2s: Introduced a brand new driver
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "test_i80_board.h"
|
||||
|
||||
#if SOC_I2S_LCD_I80_VARIANT
|
||||
#include "driver/i2s.h"
|
||||
#include "driver/i2s_controller.h"
|
||||
|
||||
TEST_CASE("i80_and_i2s_driver_co-existence", "[lcd][i2s]")
|
||||
{
|
||||
@@ -42,17 +42,19 @@ TEST_CASE("i80_and_i2s_driver_co-existence", "[lcd][i2s]")
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_i80_bus(&bus_config, &i80_bus));
|
||||
|
||||
i2s_config_t i2s_config = {
|
||||
.mode = I2S_MODE_MASTER | I2S_MODE_TX,
|
||||
.sample_rate = 36000,
|
||||
.bits_per_sample = 16,
|
||||
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
|
||||
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
|
||||
.dma_desc_num = 6,
|
||||
.dma_frame_num = 60,
|
||||
|
||||
i2s_chan_handle_t tx_handle = NULL;
|
||||
i2s_gpio_config_t i2s_pin = {
|
||||
.mclk = I2S_GPIO_UNUSED,
|
||||
.bclk = I2S_GPIO_UNUSED,
|
||||
.ws = I2S_GPIO_UNUSED,
|
||||
.dout = I2S_GPIO_UNUSED,
|
||||
.din = I2S_GPIO_UNUSED
|
||||
};
|
||||
i2s_chan_config_t chan_cfg = I2S_CHANNEL_CONFIG(I2S_ROLE_MASTER, I2S_COMM_MODE_STD, &i2s_pin);
|
||||
chan_cfg.id = 0;
|
||||
// I2S driver won't be installed as the same I2S port has been used by LCD
|
||||
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_STATE, i2s_driver_install(0, &i2s_config, 0, NULL));
|
||||
TEST_ASSERT_EQUAL(ESP_ERR_NOT_FOUND, i2s_new_channel(&chan_cfg, &tx_handle, NULL));
|
||||
TEST_ESP_OK(esp_lcd_del_i80_bus(i80_bus));
|
||||
}
|
||||
#endif // SOC_I2S_LCD_I80_VARIANT
|
||||
@@ -459,3 +461,43 @@ TEST_CASE("lcd_panel_with_i80_interface_(st7789, 8bits)", "[lcd]")
|
||||
free(img);
|
||||
#undef TEST_IMG_SIZE
|
||||
}
|
||||
|
||||
#if SOC_I2S_LCD_I80_VARIANT
|
||||
#include "driver/i2s_controller.h"
|
||||
|
||||
TEST_CASE("i80 and i2s driver coexistance", "[lcd][i2s]")
|
||||
{
|
||||
esp_lcd_i80_bus_handle_t i80_bus = NULL;
|
||||
esp_lcd_i80_bus_config_t bus_config = {
|
||||
.dc_gpio_num = TEST_LCD_DC_GPIO,
|
||||
.wr_gpio_num = TEST_LCD_PCLK_GPIO,
|
||||
.data_gpio_nums = {
|
||||
TEST_LCD_DATA0_GPIO,
|
||||
TEST_LCD_DATA1_GPIO,
|
||||
TEST_LCD_DATA2_GPIO,
|
||||
TEST_LCD_DATA3_GPIO,
|
||||
TEST_LCD_DATA4_GPIO,
|
||||
TEST_LCD_DATA5_GPIO,
|
||||
TEST_LCD_DATA6_GPIO,
|
||||
TEST_LCD_DATA7_GPIO,
|
||||
},
|
||||
.bus_width = 8,
|
||||
.max_transfer_bytes = 20,
|
||||
};
|
||||
TEST_ESP_OK(esp_lcd_new_i80_bus(&bus_config, &i80_bus));
|
||||
|
||||
i2s_gpio_config_t i2s_pin = {
|
||||
.mclk = 0,
|
||||
.bclk = 15,
|
||||
.ws = 25,
|
||||
.dout = 21,
|
||||
.din = 22
|
||||
};
|
||||
i2s_chan_config_t chan_cfg = I2S_CHANNEL_CONFIG(I2S_ROLE_MASTER, I2S_COMM_MODE_STD, &i2s_pin);
|
||||
chan_cfg.id = I2S_NUM_0;
|
||||
i2s_chan_handle_t tx_handle;
|
||||
// I2S driver won't be installed as the same I2S port has been used by LCD
|
||||
TEST_ASSERT_EQUAL(ESP_ERR_NOT_FOUND, i2s_new_channel(&chan_cfg, &tx_handle, NULL));
|
||||
TEST_ESP_OK(esp_lcd_del_i80_bus(i80_bus));
|
||||
}
|
||||
#endif // SOC_I2S_LCD_I80_VARIANT
|
||||
|
Reference in New Issue
Block a user