Проблема с использованием библиотеки I2S с Adafruit Feather Huzzah ESP8266

У меня очень неприятная проблема, потому что она кажется простой и тривиальной. Я пытаюсь использовать коммутационную плату Adafruit «Adafruit I2S MEMS Microphone Breakout» с «Adafruit Feather Huzzah ESP8266» с Arduino IDE 1.8.15. Я установил плату esp8266 и могу загружать простые скетчи. Но я хочу использовать микрофон, упомянутый выше, чтобы увидеть вывод на последовательном мониторе Arduino IDE (например, здесь https://www.youtube.com/watch?v=m8LwPNXqK9o).

1.) Но скетч уже вылетает, если я пытаюсь включить "#include <driver / I2S.h>" с "нет такого файла или каталога". Я не смог найти в Интернете ответ, где должна быть папка с драйверами, должна ли там быть библиотека и как это исправить в целом. 2.) Если я просто сделаю include типа "#include <I2S.h>", IDE не найдет типы переменных, которые ей следует знать.

1.) Эскиз:

      #include <driver/I2S.h>
#define I2S_WS 5
#define I2S_SD 4
#define I2S_SCK 14

#define I2S_PORT I2S_NUM_0

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

void i2s_install(){
  
static const int i2s_num = 0; // i2s port number

 const i2s_config_t i2s_config = {
    .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX),
    .sample_rate = 44100,
    .bits_per_sample = i2s_bits_per_sample(16),
    .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
    .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S | I2S_COMM_FORMAT_I2S_MSB),
    .intr_alloc_flags = 0, // default interrupt priority
    .dma_buf_count = 8,
    .dma_buf_len = 64,
    .use_apll = false
  };
  
  i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
}

void i2s_setpin(){
 const i2s_pin_config_t pin_config = {
      .bck_io_num = I2S_SCK,
      .ws_io_num = I2S_WS,
      .data_out_num = -1,
      .data_in_num = I2S_SD
  };
  
  i2s_set_pin(I2S_PORT, &pin_config);
}

Ошибка:

      Arduino: 1.8.15 (Windows 10), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

neuerVersuch_i2smic:1:10: fatal error: driver/I2S.h: No such file or directory

    1 | #include <driver/I2S.h>

      |          ^~~~~~~~~~~~~~

compilation terminated.

exit status 1

driver/I2S.h: No such file or directory

2.)

Эскиз:

      #include <I2S.h>
#define I2S_WS 5
#define I2S_SD 4
#define I2S_SCK 14

#define I2S_PORT I2S_NUM_0

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

void i2s_install(){
  
static const int i2s_num = 0; // i2s port number

 const i2s_config_t i2s_config = {
    .mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX),
    .sample_rate = 44100,
    .bits_per_sample = i2s_bits_per_sample(16),
    .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
    .communication_format = i2s_comm_format_t(I2S_COMM_FORMAT_STAND_I2S | I2S_COMM_FORMAT_I2S_MSB),
    .intr_alloc_flags = 0, // default interrupt priority
    .dma_buf_count = 8,
    .dma_buf_len = 64,
    .use_apll = false
  };
  
  i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);
}

void i2s_setpin(){
 const i2s_pin_config_t pin_config = {
      .bck_io_num = I2S_SCK,
      .ws_io_num = I2S_WS,
      .data_out_num = -1,
      .data_in_num = I2S_SD
  };
  
  i2s_set_pin(I2S_PORT, &pin_config);
}

Ошибка:

      Arduino: 1.8.15 (Windows 10), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

D:\Dateien\Uni\Semesterprojekte\04 Talk to me\huzzah testing\neuerVersuch_i2smic\neuerVersuch_i2smic.ino: In function 'void i2s_install()':

neuerVersuch_i2smic:22:8: error: 'i2s_config_t' does not name a type

   22 |  const i2s_config_t i2s_config = {

      |        ^~~~~~~~~~~~

neuerVersuch_i2smic:6:18: error: 'I2S_NUM_0' was not declared in this scope

    6 | #define I2S_PORT I2S_NUM_0

      |                  ^~~~~~~~~

D:\Dateien\Uni\Semesterprojekte\04 Talk to me\huzzah testing\neuerVersuch_i2smic\neuerVersuch_i2smic.ino:34:22: note: in expansion of macro 'I2S_PORT'

   34 |   i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);

      |                      ^~~~~~~~

neuerVersuch_i2smic:34:33: error: 'i2s_config' was not declared in this scope

   34 |   i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);

      |                                 ^~~~~~~~~~

neuerVersuch_i2smic:34:3: error: 'i2s_driver_install' was not declared in this scope

   34 |   i2s_driver_install(I2S_PORT, &i2s_config, 0, NULL);

      |   ^~~~~~~~~~~~~~~~~~

D:\Dateien\Uni\Semesterprojekte\04 Talk to me\huzzah testing\neuerVersuch_i2smic\neuerVersuch_i2smic.ino: In function 'void i2s_setpin()':

neuerVersuch_i2smic:38:8: error: 'i2s_pin_config_t' does not name a type

   38 |  const i2s_pin_config_t pin_config = {

      |        ^~~~~~~~~~~~~~~~

neuerVersuch_i2smic:6:18: error: 'I2S_NUM_0' was not declared in this scope

    6 | #define I2S_PORT I2S_NUM_0

      |                  ^~~~~~~~~

D:\Dateien\Uni\Semesterprojekte\04 Talk to me\huzzah testing\neuerVersuch_i2smic\neuerVersuch_i2smic.ino:45:15: note: in expansion of macro 'I2S_PORT'

   45 |   i2s_set_pin(I2S_PORT, &pin_config);

      |               ^~~~~~~~

neuerVersuch_i2smic:45:26: error: 'pin_config' was not declared in this scope

   45 |   i2s_set_pin(I2S_PORT, &pin_config);

      |                          ^~~~~~~~~~

neuerVersuch_i2smic:45:3: error: 'i2s_set_pin' was not declared in this scope; did you mean 'i2s_setpin'?

   45 |   i2s_set_pin(I2S_PORT, &pin_config);

      |   ^~~~~~~~~~~

      |   i2s_setpin

exit status 1

'i2s_config_t' does not name a type

0 ответов

Другие вопросы по тегам