Files
snapclient/components/audio_board/esp32_c3_lyra/board_pins_config.c
Karl Osterseher db0f9732b2 upgrade to IDF v5.1.1
custom board driver ma120x0 is broken
esp dsp is now IDF managed component
mdns is now IDF managed component

Signed-off-by: Karl Osterseher <karli_o@gmx.at>
2024-01-08 22:49:11 +01:00

108 lines
3.4 KiB
C

/*
* ESPRESSIF MIT License
*
* Copyright (c) 2022 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD>
*
* Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in
* which case, it is free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#include <string.h>
#include "audio_error.h"
#include "audio_mem.h"
#include "board.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "soc/soc_caps.h"
static const char *TAG = "ESP32_C3_Lyra";
esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) {
AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL);
if (port == I2C_NUM_0) {
i2c_config->sda_io_num = GPIO_NUM_9;
i2c_config->scl_io_num = GPIO_NUM_8;
} else {
i2c_config->sda_io_num = -1;
i2c_config->scl_io_num = -1;
ESP_LOGE(TAG, "i2c port %d is not supported", port);
return ESP_FAIL;
}
return ESP_OK;
}
esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) {
AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL);
i2s_config->bck_io_num = -1;
i2s_config->ws_io_num = -1;
i2s_config->data_out_num = PDM_TX_GPIO;
i2s_config->data_in_num = -1;
return ESP_OK;
}
esp_err_t get_spi_pins(
spi_bus_config_t *spi_config,
spi_device_interface_config_t *spi_device_interface_config) {
AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL);
AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL);
spi_config->mosi_io_num = -1;
spi_config->miso_io_num = -1;
spi_config->sclk_io_num = -1;
spi_config->quadwp_io_num = -1;
spi_config->quadhd_io_num = -1;
spi_device_interface_config->spics_io_num = -1;
ESP_LOGW(TAG, "SPI interface is not supported");
return ESP_OK;
}
// sdcard
int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; }
int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; }
int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; }
// input-output pins
int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; }
// adc button id
int8_t get_input_rec_id(void) { return -1; }
int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; }
int8_t get_input_set_id(void) { return BUTTON_SET_ID; }
int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; }
int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; }
int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; }
// led pins
int8_t get_ws2812_led_gpio(void) { return WS2812_LED_GPIO_PIN; }
int8_t get_es8311_mclk_src(void) { return -1; }