Jelajahi Sumber

Initial commit

Joey 1 bulan lalu
melakukan
90d4d66979
11 mengubah file dengan 8165 tambahan dan 0 penghapusan
  1. 4 0
      CMakeLists.txt
  2. 110 0
      dependencies.lock
  3. 16 0
      main/CMakeLists.txt
  4. 49 0
      main/LED_Control/LED.c
  5. 29 0
      main/LED_Control/LED.h
  6. 154 0
      main/Mic_Control/Mic.c
  7. 206 0
      main/Mic_Control/Mic.h
  8. 20 0
      main/idf_component.yml
  9. 32 0
      main/main.c
  10. 4078 0
      sdkconfig
  11. 3467 0
      sdkconfig.old

+ 4 - 0
CMakeLists.txt

@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.5)
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+project(2wayTochie)

+ 110 - 0
dependencies.lock

@@ -0,0 +1,110 @@
+dependencies:
+  espressif/cjson:
+    component_hash: e788323270d90738662d66fffa910bfe1fba019bba087f01557e70c40485b469
+    dependencies:
+    - name: idf
+      require: private
+      version: '>=5.0'
+    source:
+      registry_url: https://components.espressif.com
+      type: service
+    version: 1.7.19~2
+  espressif/dl_fft:
+    component_hash: ced3cf28cc70452b7859c06f4e5059215167254a2047e34c893d6f501ccd6ea2
+    dependencies:
+    - name: idf
+      require: private
+      version: '>=5.0'
+    source:
+      registry_url: https://components.espressif.com
+      type: service
+    version: 0.4.0
+  espressif/esp-dsp:
+    component_hash: 12e44db246517a627bc0fe2b255b8335410c0215c98bfba2df5a8e3edea839ef
+    dependencies:
+    - name: idf
+      require: private
+      version: '>=4.2'
+    source:
+      registry_url: https://components.espressif.com
+      type: service
+    version: 1.8.0
+  espressif/esp-sr:
+    component_hash: aa58d6a13a49600314a50a27240ccbd17e407f608216a3086d4868e0da2e8053
+    dependencies:
+    - name: espressif/cjson
+      registry_url: https://components.espressif.com
+      require: private
+      version: ^1.7.19
+    - name: espressif/dl_fft
+      registry_url: https://components.espressif.com
+      require: private
+      version: '>=0.2.0'
+    - name: espressif/esp-dsp
+      registry_url: https://components.espressif.com
+      require: private
+      version: 1.8.0
+    - name: idf
+      require: private
+      version: '>=5.0'
+    source:
+      registry_url: https://components.espressif.com/
+      type: service
+    version: 2.4.6
+  espressif/esp_codec_dev:
+    component_hash: 896c67360ae1f8dedaf8a53dfe48c015317fa455f061a5165307892296990028
+    dependencies:
+    - name: idf
+      require: private
+      version: '>=4.0'
+    source:
+      registry_url: https://components.espressif.com/
+      type: service
+    version: 1.5.10
+  espressif/esp_io_expander:
+    component_hash: 7b7f91270172e46ca4597e3874f48d8412e280e8c295559f5922ec38656e3e5f
+    dependencies:
+    - name: idf
+      require: private
+      version: '>=4.4.2'
+    source:
+      registry_url: https://components.espressif.com
+      type: service
+    version: 1.2.1
+  espressif/esp_io_expander_tca95xx_16bit:
+    component_hash: a9608ba5753ae2a72e79fccd376fc4283343c0306d23505fbf8a46fafdbde2a2
+    dependencies:
+    - name: espressif/esp_io_expander
+      registry_url: https://components.espressif.com
+      require: public
+      version: ^1.2.0
+    - name: idf
+      require: private
+      version: '>=5.2'
+    source:
+      registry_url: https://components.espressif.com/
+      type: service
+    version: 2.0.2
+  espressif/led_strip:
+    component_hash: 28621486f77229aaf81c71f5e15d6fbf36c2949cf11094e07090593e659e7639
+    dependencies:
+    - name: idf
+      require: private
+      version: '>=5.0'
+    source:
+      registry_url: https://components.espressif.com/
+      type: service
+    version: 3.0.3
+  idf:
+    source:
+      type: idf
+    version: 6.0.1
+direct_dependencies:
+- espressif/esp-sr
+- espressif/esp_codec_dev
+- espressif/esp_io_expander_tca95xx_16bit
+- espressif/led_strip
+- idf
+manifest_hash: a58dc6659aa9caf489c683aba957d132d306c1ab08355693a7c978a24c2a6a87
+target: esp32s3
+version: 3.0.0

+ 16 - 0
main/CMakeLists.txt

@@ -0,0 +1,16 @@
+set(SOURCES
+    "./main.c" 
+    "./Mic_Control/Mic.c"
+    "./LED_Control/LED.c"
+)
+
+set(INCLUDE_DIRS 
+    "."
+    "./Mic_Control"
+    "./LED_Control"
+)
+
+idf_component_register(
+    SRCS ${SOURCES}
+    INCLUDE_DIRS ${INCLUDE_DIRS}
+)

+ 49 - 0
main/LED_Control/LED.c

@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h" 
+#include "driver/gpio.h" 
+#include "esp_log.h" 
+#include "led_strip.h"
+#include "sdkconfig.h"
+
+static const char *TAG = "LED_Control";
+
+led_strip_handle_t configure_led(void)
+{
+    led_strip_config_t strip_config = {
+        .strip_gpio_num = 38, 
+        .max_leds = 1,      
+    };
+
+    // LED strip backend configuration: RMT
+    led_strip_rmt_config_t rmt_config = {
+        .clk_src = RMT_CLK_SRC_DEFAULT,        
+        .resolution_hz = (10 * 1000 * 1000), 
+    };
+
+    led_strip_handle_t led_strip;
+    ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip));
+    ESP_LOGI(TAG, "Created LED strip object with RMT backend");
+    return led_strip;
+}
+
+void LED_init(void)
+{
+led_strip_handle_t led_strip = configure_led();
+    bool led_on_off = false;
+
+    ESP_LOGI(TAG, "Start blinking LED strip");
+    while (1) {
+        if (led_on_off) {
+            ESP_ERROR_CHECK(led_strip_set_pixel(led_strip, 0, 5, 5, 5));
+            ESP_ERROR_CHECK(led_strip_refresh(led_strip));
+            ESP_LOGI(TAG, "LED ON!");
+        } else {
+            ESP_ERROR_CHECK(led_strip_clear(led_strip));
+            ESP_LOGI(TAG, "LED OFF!");
+        }
+
+        led_on_off = !led_on_off;
+        vTaskDelay(pdMS_TO_TICKS(500));
+    }
+}

+ 29 - 0
main/LED_Control/LED.h

@@ -0,0 +1,29 @@
+#pragma once
+
+#include "driver/gpio.h"
+#include "driver/i2s_std.h"
+#include "driver/i2s_tdm.h"
+#include "driver/i2c_master.h"
+
+#include "soc/soc_caps.h"
+#include "esp_idf_version.h"
+
+#include "esp_codec_dev.h"
+#include "esp_codec_dev_defaults.h"
+#include "esp_codec_dev_os.h"
+#include "sdkconfig.h"
+
+#include <stdio.h>
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h" 
+
+#include "esp_log.h" 
+#include "led_strip.h"
+
+
+
+#include "led_strip.h"
+
+led_strip_handle_t configure_led(void);
+
+void LED_init(void);

+ 154 - 0
main/Mic_Control/Mic.c

@@ -0,0 +1,154 @@
+#include "Mic.h"
+
+#include <stdbool.h>
+#include "esp_err.h"
+#include "freertos/FreeRTOS.h"
+#include "freertos/semphr.h"
+#include "string.h"
+#include "driver/gpio.h"
+#include "esp_err.h"
+#include "esp_log.h"
+#include "esp_rom_sys.h"
+#include "esp_check.h"
+#include "esp_vfs_fat.h"
+#include "sdmmc_cmd.h"
+#include "driver/i2s_std.h"
+#include "driver/i2s_types.h"
+#include "driver/i2s_pdm.h"
+#include "driver/i2s_tdm.h"
+
+#include <sys/unistd.h>
+#include <sys/stat.h>
+#include "dirent.h"
+#include "driver/sdmmc_host.h"
+#include <errno.h>
+
+#if ((SOC_SDMMC_HOST_SUPPORTED) && (FUNC_SDMMC_EN))
+#include "driver/sdmmc_host.h"
+#endif /* ((SOC_SDMMC_HOST_SUPPORTED) && (FUNC_SDMMC_EN)) */
+
+
+#define ADC_I2S_CHANNEL 4
+
+static sdmmc_card_t *card;
+static const char *TAG = "board";
+static int s_play_sample_rate = 16000;
+static int s_play_channel_format = 1;
+static int s_bits_per_chan = 16;
+
+#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
+static i2s_chan_handle_t            tx_handle = NULL;        // I2S tx channel handler
+static i2s_chan_handle_t            rx_handle = NULL;        // I2S rx channel handler
+#endif
+static audio_codec_data_if_t *record_data_if  = NULL;
+static audio_codec_ctrl_if_t *record_ctrl_if  = NULL;
+static audio_codec_if_t *record_codec_if      = NULL;
+static esp_codec_dev_handle_t record_dev      = NULL;
+
+static audio_codec_data_if_t *play_data_if    = NULL;
+static audio_codec_ctrl_if_t *play_ctrl_if    = NULL;
+static audio_codec_gpio_if_t *play_gpio_if    = NULL;
+static audio_codec_if_t *play_codec_if        = NULL;
+static esp_codec_dev_handle_t play_dev        = NULL;
+static i2c_master_bus_handle_t i2c_bus_handle = NULL;
+static uint32_t SDCard_Size  = 0;
+
+
+esp_codec_dev_handle_t esp_ret_play_dev(void)
+{
+    return play_dev;
+}
+
+i2c_master_bus_handle_t esp_ret_i2c_handle(void)
+{
+    return i2c_bus_handle;
+}
+
+uint32_t Get_SD_Size(void)
+{
+    return SDCard_Size;
+}
+
+ esp_err_t i2c_master_init(void)
+{
+    const i2c_master_bus_config_t bus_config = {
+        .i2c_port = I2C_NUM,
+        .sda_io_num = GPIO_I2C_SDA,
+        .scl_io_num = GPIO_I2C_SCL,
+        .clk_source = I2C_CLK_SRC_DEFAULT,
+    };
+
+    esp_err_t ret = i2c_new_master_bus(&bus_config, &i2c_bus_handle);
+    if (ret != ESP_OK) {
+        ESP_LOGE(TAG, "Failed to initialize I2C bus: %s", esp_err_to_name(ret));
+        return ret;
+    }
+
+    ESP_LOGI(TAG, "I2C bus initialized successfully");
+    return ESP_OK;  // 返回 ESP_OK 表示成功
+}
+
+esp_err_t bsp_codec_adc_init(int sample_rate)
+{
+    esp_err_t ret_val = ESP_OK;
+
+    // Do initialize of related interface: data_if, ctrl_if and gpio_if
+    audio_codec_i2s_cfg_t i2s_cfg = {
+        .port = I2S_NUM_1,
+#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
+        .rx_handle = rx_handle,
+        .tx_handle = NULL,
+#endif
+    };
+    //record_data_if = audio_codec_new_i2s_data(&i2s_cfg);
+
+    audio_codec_i2c_cfg_t i2c_cfg = {.addr = ES7210_CODEC_DEFAULT_ADDR,.bus_handle = i2c_bus_handle};
+    //record_ctrl_if = audio_codec_new_i2c_ctrl(&i2c_cfg);
+    // New input codec interface
+    es7210_codec_cfg_t es7210_cfg = {
+        .ctrl_if = record_ctrl_if,
+        .mic_selected = ES7210_SEL_MIC1 | ES7210_SEL_MIC2 | ES7210_SEL_MIC3 | ES7210_SEL_MIC4,
+    };  
+    //record_codec_if = es7210_codec_new(&es7210_cfg);
+    // New input codec device
+    esp_codec_dev_cfg_t dev_cfg = {
+        .codec_if = record_codec_if,
+        .data_if = record_data_if,
+        .dev_type = ESP_CODEC_DEV_TYPE_IN,
+    };
+    record_dev = esp_codec_dev_new(&dev_cfg);
+
+    esp_codec_dev_sample_info_t fs = {
+        .sample_rate = 16000,
+        .channel = 2,
+        .bits_per_sample = 32,
+    };
+    esp_codec_dev_open(record_dev, &fs);
+    // esp_codec_dev_set_in_gain(record_dev, RECORD_VOLUME);
+    esp_codec_dev_set_in_channel_gain(record_dev, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(0), RECORD_VOLUME);
+    esp_codec_dev_set_in_channel_gain(record_dev, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(1), RECORD_VOLUME);
+    esp_codec_dev_set_in_channel_gain(record_dev, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(2), RECORD_VOLUME);
+    esp_codec_dev_set_in_channel_gain(record_dev, ESP_CODEC_DEV_MAKE_CHANNEL_MASK(3), RECORD_VOLUME);
+
+    return ret_val;
+}
+esp_err_t esp_get_mic_level(int16_t *buffer, int buffer_len)
+{
+    esp_err_t ret = ESP_OK;
+    size_t bytes_read;
+    int audio_chunksize = buffer_len / (sizeof(int16_t) * ADC_I2S_CHANNEL);
+
+    ret = esp_codec_dev_read(record_dev, (void *)buffer, buffer_len);
+    
+    int64_t sum = 0;
+    for(int i = 0; i < buffer_len/sizeof(int16_t); i++) {
+        sum += abs(buffer[i]);
+    }
+    ESP_LOGI("MIC", "Level=%lld", sum/(buffer_len/sizeof(int16_t)));
+
+
+    
+    return ret;
+}
+
+

+ 206 - 0
main/Mic_Control/Mic.h

@@ -0,0 +1,206 @@
+#pragma once
+
+#include "driver/gpio.h"
+#include "driver/i2s_std.h"
+#include "driver/i2s_tdm.h"
+#include "driver/i2c_master.h"
+
+#include "soc/soc_caps.h"
+#include "esp_idf_version.h"
+
+#include "esp_codec_dev.h"
+#include "esp_codec_dev_defaults.h"
+#include "esp_codec_dev_os.h"
+#include "sdkconfig.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_FILE_NAME_SIZE 100  // Define maximum file name size
+#define MAX_PATH_SIZE 512      // Define a larger size for the full path
+
+/**
+ * @brief ESP32-S3-CAM-OVxxxx I2C GPIO defineation
+ * 
+ */
+#define I2C_NUM         (0)
+#define GPIO_I2C_SCL    (GPIO_NUM_10)
+#define GPIO_I2C_SDA    (GPIO_NUM_11)
+
+/**
+ * @brief ESP32-S3-CAM-OVxxxx SDMMC GPIO defination
+ * 
+ * @note Only avaliable when PMOD connected
+ */
+#define FUNC_SDMMC_EN   (1)
+#define SDMMC_BUS_WIDTH (1)
+#define GPIO_SDMMC_CLK  (GPIO_NUM_40)
+#define GPIO_SDMMC_CMD  (GPIO_NUM_42)
+#define GPIO_SDMMC_D0   (GPIO_NUM_41)
+#define GPIO_SDMMC_D1   (GPIO_NUM_NC)
+#define GPIO_SDMMC_D2   (GPIO_NUM_NC)
+#define GPIO_SDMMC_D3   (GPIO_NUM_NC)
+#define GPIO_SDMMC_DET  (GPIO_NUM_NC)
+
+/**
+ * @brief ESP32-S3-CAM-OVxxxx SDSPI GPIO definationv
+ * 
+ */
+#define FUNC_SDSPI_EN       (0)
+#define SDSPI_HOST          (SPI2_HOST)
+#define GPIO_SDSPI_CS       (GPIO_NUM_NC)
+#define GPIO_SDSPI_SCLK     (GPIO_NUM_NC)
+#define GPIO_SDSPI_MISO     (GPIO_NUM_NC)
+#define GPIO_SDSPI_MOSI     (GPIO_NUM_NC)
+
+/**
+ * @brief ESP32-S3-CAM-OVxxxx I2S GPIO defination
+ * 
+ */
+#define FUNC_I2S_EN         (1)
+#define GPIO_I2S_LRCK       (GPIO_NUM_14)
+#define GPIO_I2S_MCLK       (GPIO_NUM_12)
+#define GPIO_I2S_SCLK       (GPIO_NUM_13)
+#define GPIO_I2S_SDIN       (GPIO_NUM_15)
+#define GPIO_I2S_DOUT       (GPIO_NUM_16)
+
+/**
+ * @brief ESP32-S3-CAM-OVxxxx I2S GPIO defination
+ * 
+ */
+#define FUNC_I2S0_EN         (0)
+#define GPIO_I2S0_LRCK       (GPIO_NUM_NC)
+#define GPIO_I2S0_MCLK       (GPIO_NUM_NC)
+#define GPIO_I2S0_SCLK       (GPIO_NUM_NC)
+#define GPIO_I2S0_SDIN       (GPIO_NUM_NC)
+#define GPIO_I2S0_DOUT       (GPIO_NUM_NC)
+
+/**
+ * @brief record configurations
+ *
+ */
+#define RECORD_VOLUME   (30.0)
+
+/**
+ * @brief player configurations
+ *
+ */
+#define PLAYER_VOLUME   (60)
+
+/**
+ * @brief ESP32-S3-HMI-DevKit power control IO
+ * 
+ * @note Some power control pins might not be listed yet
+ * 
+ */
+//#define FUNC_PWR_CTRL       (1)
+#define GPIO_PWR_CTRL       (-1)
+#define GPIO_PWR_ON_LEVEL   (1)
+
+#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
+
+#define I2S_CONFIG_DEFAULT(sample_rate, channel_fmt, bits_per_chan) { \
+        .clk_cfg  = I2S_STD_CLK_DEFAULT_CONFIG(16000), \
+        .slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(32, I2S_SLOT_MODE_STEREO), \
+        .gpio_cfg = { \
+            .mclk = GPIO_I2S_MCLK, \
+            .bclk = GPIO_I2S_SCLK, \
+            .ws   = GPIO_I2S_LRCK, \
+            .dout = GPIO_I2S_DOUT, \
+            .din  = GPIO_I2S_SDIN, \
+        }, \
+    }
+
+#else
+
+#define I2S_CONFIG_DEFAULT(sample_rate, channel_fmt, bits_per_chan) { \
+    .mode                   = I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX, \
+    .sample_rate            = 16000, \
+    .bits_per_sample        = I2S_BITS_PER_SAMPLE_32BIT, \
+    .channel_format         = I2S_CHANNEL_FMT_RIGHT_LEFT, \
+    .communication_format   = I2S_COMM_FORMAT_STAND_I2S, \
+    .intr_alloc_flags       = ESP_INTR_FLAG_LEVEL1, \
+    .dma_buf_count          = 6, \
+    .dma_buf_len            = 160, \
+    .use_apll               = false, \
+    .tx_desc_auto_clear     = true, \
+    .fixed_mclk             = 0, \
+    .mclk_multiple          = I2S_MCLK_MULTIPLE_DEFAULT, \
+    .bits_per_chan          = I2S_BITS_PER_CHAN_32BIT, \
+}
+
+#endif
+
+
+/* LCD settings */
+#define EXAMPLE_LCD_SPI_NUM         (SPI3_HOST)
+#define EXAMPLE_LCD_PIXEL_CLK_HZ    (80 * 1000 * 1000)
+#define EXAMPLE_LCD_CMD_BITS        (8)
+#define EXAMPLE_LCD_PARAM_BITS      (8)
+#define EXAMPLE_LCD_BITS_PER_PIXEL  (16)
+#define EXAMPLE_LCD_DRAW_BUFF_DOUBLE (1)
+#define EXAMPLE_LCD_DRAW_BUFF_HEIGHT (50)
+#define EXAMPLE_LCD_BL_ON_LEVEL     (1)
+#define Backlight_MAX           100   
+#define DEFAULT_BACKLIGHT       80 
+
+/* LCD pins */
+#define EXAMPLE_LCD_GPIO_SCLK       (GPIO_NUM_5)
+#define EXAMPLE_LCD_GPIO_MOSI       (GPIO_NUM_1)
+#define EXAMPLE_LCD_GPIO_RST        (GPIO_NUM_NC)
+#define EXAMPLE_LCD_GPIO_DC         (GPIO_NUM_3)
+#define EXAMPLE_LCD_GPIO_CS         (GPIO_NUM_6)
+#define EXAMPLE_LCD_GPIO_BL         (GPIO_NUM_NC)
+
+/* LCD touch pins */
+#define EXAMPLE_TOUCH_GPIO_RST      (GPIO_NUM_NC)
+
+#ifdef CONFIG_WAVESHARE_1_47INCH_TOUCH_LCD
+#define EXAMPLE_LCD_H_RES   (172)
+#define EXAMPLE_LCD_V_RES   (320)
+#define EXAMPLE_TOUCH_GPIO_INT      (GPIO_NUM_9)
+#elif defined(CONFIG_WAVESHARE_2INCH_TOUCH_LCD)
+#define EXAMPLE_LCD_H_RES   (240)
+#define EXAMPLE_LCD_V_RES   (320)
+#define EXAMPLE_TOUCH_GPIO_INT      (GPIO_NUM_9)
+#elif defined(CONFIG_WAVESHARE_2_8INCH_TOUCH_LCD)
+#define EXAMPLE_LCD_H_RES   (240)
+#define EXAMPLE_LCD_V_RES   (320)
+#define EXAMPLE_TOUCH_GPIO_INT      (GPIO_NUM_NC)
+#elif defined(CONFIG_WAVESHARE_3_5INCH_TOUCH_LCD)
+#define EXAMPLE_LCD_H_RES   (320)
+#define EXAMPLE_LCD_V_RES   (480)
+#define EXAMPLE_TOUCH_GPIO_INT      (GPIO_NUM_9)
+#endif
+
+// GPIO assignment
+#define LED_STRIP_GPIO_PIN  38
+#define LED_STRIP_LED_COUNT 7
+
+
+esp_err_t esp_board_init(uint32_t sample_rate, int channel_format, int bits_per_chan);
+
+esp_err_t esp_sdcard_init(char *mount_point, size_t max_files);
+esp_err_t esp_sdcard_deinit(char *mount_point);
+
+esp_err_t esp_audio_play(const int16_t* data, int length, uint32_t ticks_to_wait);
+
+esp_err_t esp_get_feed_data(bool is_get_raw_channel, int16_t *buffer, int buffer_len);
+esp_err_t esp_get_mic_level(int16_t *buffer, int buffer_len);
+
+int esp_get_feed_channel(void);
+char* esp_get_input_format(void);
+esp_err_t esp_audio_set_play_vol(int volume);
+esp_err_t esp_audio_get_play_vol(int *volume);
+
+i2c_master_bus_handle_t esp_ret_i2c_handle(void);
+esp_codec_dev_handle_t esp_ret_play_dev();
+uint32_t Get_SD_Size(void);
+uint16_t Folder_retrieval(const char* directory, const char* fileExtension, char File_Name[][MAX_FILE_NAME_SIZE], uint16_t maxFiles) ;
+ esp_err_t i2c_master_init(void);
+esp_err_t bsp_codec_adc_init(int sample_rate);
+
+#ifdef __cplusplus
+}
+#endif

+ 20 - 0
main/idf_component.yml

@@ -0,0 +1,20 @@
+## IDF Component Manager Manifest File
+dependencies:
+  ## Required IDF version
+  idf:
+    version: '>=4.1.0'
+  # # Put list of dependencies here
+  # # For components maintained by Espressif:
+  # component: "~1.0.0"
+  # # For 3rd party components:
+  # username/component: ">=1.0.0,<2.0.0"
+  # username2/component2:
+  #   version: "~1.0.0"
+  #   # For transient dependencies `public` flag can be set.
+  #   # `public` flag doesn't have an effect dependencies of the `main` component.
+  #   # All dependencies of `main` are public by default.
+  #   public: true
+  espressif/led_strip: ^3.0.3
+  espressif/esp-sr: ^2.1.5
+  espressif/esp_io_expander_tca95xx_16bit: ^2.0.1
+  espressif/esp_codec_dev: ^1.5.1

+ 32 - 0
main/main.c

@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h" 
+#include "driver/gpio.h" 
+#include "esp_log.h" 
+#include "led_strip.h"
+#include "sdkconfig.h"
+#include "Mic.h"
+#include "LED.h"
+
+static const char *TAG = "main";
+
+
+
+void app_main(void)
+{
+    i2c_master_init();
+    bsp_codec_adc_init(16000);
+    int16_t *my_buffer = heap_caps_malloc(8192,MALLOC_CAP_SPIRAM);
+
+//    int16_t my_buffer[8192];
+//ESP_ERROR_CHECK(esp_board_init(16000, 2, 16));
+//configure_led();
+
+//LED_init();
+while(1){
+esp_get_mic_level(my_buffer, 8192);
+    vTaskDelay(pdMS_TO_TICKS(50));
+
+
+}
+}

File diff ditekan karena terlalu besar
+ 4078 - 0
sdkconfig


File diff ditekan karena terlalu besar
+ 3467 - 0
sdkconfig.old