Using ESP-IDF code in Arduino code?

vritzka
Posts: 22
Joined: Wed Sep 07, 2022 5:33 am

Using ESP-IDF code in Arduino code?

Postby vritzka » Wed Oct 05, 2022 10:36 am

Hello,

I’m working on a project with a large LCD display on the EDP32-S3.

I have the LCD working with the provided sample code https://github.com/espressif/esp-idf/tr ... /rgb_panel.

However, I’m struggling to write the rest of my app with the ESP-S3. My skills are not good enough.

So I switched to Arduino core. But now I cannot get the RGB LCD panel working.

Is there a way to use the ESP LCD code in Arduino?

Thanks

username
Posts: 528
Joined: Thu May 03, 2018 1:18 pm

Re: Using ESP-IDF code in Arduino code?

Postby username » Thu Oct 06, 2022 12:46 pm

You can use ESP-IDF in Arduino

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Using ESP-IDF code in Arduino code?

Postby lbernstone » Thu Oct 06, 2022 6:18 pm

I suspect your issue is not in using esp-idf in Arduino, but rather using C-style code in C++.
When assigning struct's in C++, you cannot leave missing identifiers, and it will not automatically cast elements into the correct type. There are a few fixes:
- If you are including a header that will have C code in it, use an extern "C" (https://github.com/espressif/arduino-es ... pp#L31-L33)
- If you have missing identifiers, look at the struct definition and add those into the assignment. If you have very few elements to assign in a large struct, do away with the C-style dot assignment, and assign the elements explicitly with the top-level variable (mystruct.myelement = val;)
- If you have invalid conversions, force cast that identifier into the appropriate variable type or use the correct variable type in your assignment

martinius96
Posts: 33
Joined: Thu Dec 13, 2018 1:39 am

Re: Using ESP-IDF code in Arduino code?

Postby martinius96 » Sat Oct 08, 2022 9:57 pm

Yes you can. Your Arduino code is simply... calling low-level ESP-IDF functions.
So you can skip these "macros" and call these ESP-IDF functions directly.

vritzka
Posts: 22
Joined: Wed Sep 07, 2022 5:33 am

Re: Using ESP-IDF code in Arduino code?

Postby vritzka » Fri Oct 14, 2022 5:52 am

Thank you, this was very helpful.

Who is online

Users browsing this forum: No registered users and 85 guests