Include RMT peripheral API in custom component.

_K00CT_
Posts: 7
Joined: Thu Feb 23, 2023 9:18 am

Include RMT peripheral API in custom component.

Postby _K00CT_ » Tue Aug 15, 2023 3:00 pm

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 :)

ESP_Sprite
Posts: 9773
Joined: Thu Nov 26, 2015 4:08 am

Re: Include RMT peripheral API in custom component.

Postby ESP_Sprite » Wed Aug 16, 2023 6:59 am

idf_component_register(SRCS "SerialLedDriver.cpp"
INCLUDE_DIRS "include")
Add a 'REQUIRES driver' there.

_K00CT_
Posts: 7
Joined: Thu Feb 23, 2023 9:18 am

Re: Include RMT peripheral API in custom component.

Postby _K00CT_ » Wed Aug 16, 2023 2:27 pm

Thank you! Solved :)

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 57 guests