Page 1 of 1

Using ESP-IDF code in Arduino code?

Posted: Wed Oct 05, 2022 10:36 am
by vritzka
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

Re: Using ESP-IDF code in Arduino code?

Posted: Thu Oct 06, 2022 12:46 pm
by username
You can use ESP-IDF in Arduino

Re: Using ESP-IDF code in Arduino code?

Posted: Thu Oct 06, 2022 6:18 pm
by lbernstone
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

Re: Using ESP-IDF code in Arduino code?

Posted: Sat Oct 08, 2022 9:57 pm
by martinius96
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.

Re: Using ESP-IDF code in Arduino code?

Posted: Fri Oct 14, 2022 5:52 am
by vritzka
Thank you, this was very helpful.