-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2S.h: No such file or directory [fixed] #26
Comments
I ran the command:
How do I fix this? |
Any solution with this? I got same error on windows10 |
Follow the readme: I think you might have not add the "ESP32 board package" yet. |
[email protected] is fine,but [email protected] or [email protected] doesn't work;because i2s library is changed into esp_i2s; |
I solved it by following the steps, as well as installing the latest Arduino-cli @1.0.1 |
Here is an update for anyone who wants to migrate their project to the latest platform |
change firmware.ino from i2s.h to esp_i2s.h, or stay on [email protected] 😄 |
1 similar comment
change firmware.ino from i2s.h to esp_i2s.h, or stay on [email protected] 😄 |
Here's the diff to get it to compile with index ca000b02..454ce97c 100644
--- a/OpenGlass/firmware/firmware.ino
+++ b/OpenGlass/firmware/firmware.ino
@@ -1,5 +1,5 @@
#define CAMERA_MODEL_XIAO_ESP32S3
-#include <I2S.h>
+#include <ESP_I2S.h>
#include <BLE2902.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
@@ -9,6 +9,10 @@
#include "camera_pins.h"
#include "mulaw.h"
+I2SClass I2S;
+
+
+
// Audio
// Uncomment to switch the codec
@@ -287,28 +291,28 @@ static size_t compressed_buffer_size = recording_buffer_size + 3; /* header */
#endif
#endif
-static uint8_t *s_recording_buffer = nullptr;
+static char *s_recording_buffer = nullptr;
static uint8_t *s_compressed_frame = nullptr;
static uint8_t *s_compressed_frame_2 = nullptr;
void configure_microphone() {
// start I2S at 16 kHz with 16-bits per sample
- I2S.setAllPins(-1, 42, 41, -1, -1);
- if (!I2S.begin(PDM_MONO_MODE, SAMPLE_RATE, SAMPLE_BITS)) {
+ I2S.setPins(-1, 42, 41, -1, -1);
+ if (!I2S.begin(I2S_MODE_STD, SAMPLE_RATE, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_MONO)) {
Serial.println("Failed to initialize I2S!");
while (1); // do nothing
}
// Allocate buffers
- s_recording_buffer = (uint8_t *) ps_calloc(recording_buffer_size, sizeof(uint8_t));
+ s_recording_buffer = (char*) ps_calloc(recording_buffer_size, sizeof(uint8_t));
s_compressed_frame = (uint8_t *) ps_calloc(compressed_buffer_size, sizeof(uint8_t));
s_compressed_frame_2 = (uint8_t *) ps_calloc(compressed_buffer_size, sizeof(uint8_t));
}
size_t read_microphone() {
size_t bytes_recorded = 0;
- esp_i2s::i2s_read(esp_i2s::I2S_NUM_0, s_recording_buffer, recording_buffer_size, &bytes_recorded, portMAX_DELAY);
+ bytes_recorded = I2S.readBytes(s_recording_buffer, recording_buffer_size);
return bytes_recorded;
} |
System: MacOS Silicon
If anyone got the error "I2S.h: No such file or directory", just install the esp32 version 2.0.17 to fix it.
"Navigate to Tools > Board > Boards Manager..., type the keyword esp32 in the search box, select the latest version of esp32, and install it."
It seems the latest version do not have this header file or the header file has changed to other name?
The text was updated successfully, but these errors were encountered: