Я не могу включить, если я пытаюсь сделать это в библиотеке, но он работает нормально, если я делаю это в main.cpp
здесь вывод дерева (структура папок)
.
├── include
│ └── README
├── lib
│ ├── Microphone
│ │ ├── Microphone.cpp
│ │ └── Microphone.h
│ └── README
├── platformio.ini
├── src
│ └── main.cpp
└── test
└── README
здесь main.cpp
#include <Arduino.h>
#include "Microphone.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
здесь lib/Microphone.h
#include <i2s.h>
здесь lib/Microphone.cpp
#include "Microphone.h"
здесь platformio.ini
[env:d1_mini_lite]
platform = espressif8266
board = d1_mini_lite
framework = arduino
и это ошибка, которую я получаю при сборке
Processing d1_mini_lite (platform: espressif8266; board: d1_mini_lite; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini_lite.html
PLATFORM: Espressif 8266 2.2.2 > WeMos D1 mini Lite
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES: toolchain-xtensa 2.40802.190218 (4.8.2), tool-esptool 1.413.0 (4.13), tool-esptoolpy 1.20600.0 (2.6.0), framework-arduinoespressif8266 2.20502.0 (2.5.2)
LDF: Library Dependency Finder -> http://bit .ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Microphone>
Compiling .pio\build\d1_mini_lite\src\main.cpp.o
Generating LD script .pio\build\d1_mini_lite\ld\local.eagle.app.v6.common.ld
Compiling .pio\build\d1_mini_lite\libcaf\Microphone\Microphone.cpp.o
Archiving .pio\build\d1_mini_lite\libFrameworkArduinoVariant.a
Compiling .pio\build\d1_mini_lite\FrameworkArduino\Esp-frag.cpp.o
In file included from lib\Microphone\Microphone.h:1:0,
from lib\Microphone\Microphone.cpp:1:
C:\Users\Joe\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/i2s.h:46:19: error: variable or field 'i2s_set_rate' declared void
void i2s_set_rate(uint32_t rate);//Sample Rate in Hz (ex 44100, 48000)
^
C:\Users\Joe\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/i2s.h:46:19: error: 'uint32_t' was not declared in this scope
C:\Users\Joe\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/i2s.h:47:23: error: variable or field 'i2s_set_dividers' declared void
void i2s_set_dividers(uint8_t div1, uint8_t div2);//Direct control over output rate
...
Compiling .pio\build\d1_mini_lite\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\d1_mini_lite\FrameworkArduino\FS.cpp.o
*** [.pio\build\d1_mini_lite\libcaf\Microphone\Microphone.cpp.o] Error 1
=============================================================================================== [ERROR] Took 1.67 seconds ===============================================================================================
The terminal process terminated with exit code: 1
мои настройки
Name: PlatformIO IDE
Id: platformio.platformio-ide
Description: Development environment for IoT, Arduino, ARM mbed, Espressif (ESP8266/ESP32), AVR, RISC-V, STM32, PIC32, nRF51/nRF52, MSP430, MCS-51 (8051), FPGA, FreeRTOS, ESP-IDF, CMSIS, SPL
Version: 1.7.1
Publisher: PlatformIO
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide
Почему я не могу импортировать из пользовательской библиотеки?