Runnable component template
Posted: Tue Oct 24, 2023 11:35 am
For an assignment I will need to create a lot of custom components that I will use in different IDF projects, so I wanted to create a template for this. The thing is, I also want to be able to open these components as a project and be runnable with a main.c to test/develop functionalities.
Via the documentation I figured out how to create and add new components to a project, but I cant manage to create a component that can be run by a main.c in the same component folder.
Making component:
idf.py -C x:/.../custom_components create-component cus_twai
I get:
components/ // idf components
custom_components/ // custom components
____cus_twai/ // custom implementation of twai
________include/
____________cus_twai.h
________cus_twai.c
I would also like:
________main.c // includes cus_twai
I tried adding a main to make it runnable but this didn't work and I couldn't figure out why (inexperienced with CMake etc).
Should I maybe try to make a working project into a component? Or am I maybe approaching this all wrong?
Any advice is greatly appreciated, thank you!
Via the documentation I figured out how to create and add new components to a project, but I cant manage to create a component that can be run by a main.c in the same component folder.
Making component:
idf.py -C x:/.../custom_components create-component cus_twai
I get:
components/ // idf components
custom_components/ // custom components
____cus_twai/ // custom implementation of twai
________include/
____________cus_twai.h
________cus_twai.c
I would also like:
________main.c // includes cus_twai
I tried adding a main to make it runnable but this didn't work and I couldn't figure out why (inexperienced with CMake etc).
Should I maybe try to make a working project into a component? Or am I maybe approaching this all wrong?
Any advice is greatly appreciated, thank you!