Arduino libs in expresif32 project

Hi, I have a hobby radio amateur project which uses several Arduino libraries (RadioLib, AXP202, GPS, SSD1306 …) and I need a hpf_ag Bluetooth functionality that works AFAIK just with expresif32 (have a working example). Is there a way to move all my code and libraries to the expresif32 framework? The best would be some working example. I’ve tried several tips from forums without much success.

How is it with Bluetooth serial and ESP Async WebServer, I’ll probably have to refrain from using them, don’t I? Tnx!

This is discuseed in Using esp-idf library within the Arduino Framework (ESP32).

For your specific case: The Bluetooth hands-free profile audio gateway APIs, as seen in here, while the header file is included in the latest Arduino-ESP32, see e.g. here, it is not actually usuable because the component was deactivated on compile-time.

If that was not the case you would have been able to call into these ESP-IDF APIs from within just a pure Arduino-ESP32 environment.

So you’ll have to resort to the ESP-IDF plus Arduino as a component method for this one.

Note that currently there’s a caveat in the PlatformIO-provided example: espidf-arduino-blink example uncompilable because of missing branch · Issue #524 · platformio/platform-espressif32 · GitHub.

@ maxgerhardt
Tnx for your answer, I’ve read the discussion thoughtfully and went over the caveat with missing branch and tool. Now I have espidf-arduino-wifiscan running.

How can I now use some existing libraries for Arduino? For example TinyGPSPlus.
lib_deps=TinyGPSPlus For all libraries I’m using I’m getting various include errors.

What’s your current full platformio.ini?

[env:ttgo]
platform_packages = framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
platform = espressif32
framework = espidf, arduino
board = esp32dev
build_flags = 
        -D ESP32=1
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
lib_deps= mikalhart/TinyGPSPlus@1.0.2

From your post in mentioned thread, I’ve got that Arduino API is a component in esp-idf and libraries using Arduino are components in Arduino. Shall the library be used in another way then?

Ok, I probably have it. Those libraries are using #ifdef ARDUINO>=100 which is not defined also:

build_flags = 
        -D ARDUINO=200

helps. Now it’s compiling.