Page 1 of 1

Include RMT peripheral API in custom component.

Posted: Tue Aug 15, 2023 3:00 pm
by _K00CT_
Hi there.

I have used the base template to create an empty IDF project. (working in VS Code)

I then created a component, called LedDriver. This is going to communicate with a serial LED using the RMT peripheral. In the header file I have written #include "driver/rmt_tx.h"

My component CMakeLists.txt contains:
idf_component_register(SRCS "SerialLedDriver.cpp"
INCLUDE_DIRS "include")

When I attempt to compile my code I get the following error:
components/LedDriver/include/LedDriver.hpp:4:10: fatal error: driver/rmt_tx.h: No such file or directory
4 | #include "driver/rmt_tx.h"
| ^~~~~~~~~~~~~~~~~
compilation terminated.

However, in the file LedDriver.hpp I can CTRL+LEFT-CLICK into the file rmt_tx.h. This makes me believe that I am missing a configuration somewhere.

How can I tell the compiler to look in the ESP IDF components to find this header file for my custom component?

Many thanks :)

Re: Include RMT peripheral API in custom component.

Posted: Wed Aug 16, 2023 6:59 am
by ESP_Sprite
idf_component_register(SRCS "SerialLedDriver.cpp"
INCLUDE_DIRS "include")
Add a 'REQUIRES driver' there.

Re: Include RMT peripheral API in custom component.

Posted: Wed Aug 16, 2023 2:27 pm
by _K00CT_
Thank you! Solved :)