This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Adding all necessary .h files to every .c file

Hello there, I am already guessing that by the question alone it seems like what i'm asking is silly or wrong but I have no formal education here so I will need some help.

I have done all the tutorials posted, (advertising, services, characterisitcs, ble_uart, etc..) on my nrf51-dk but now I am on the ble_app_template to try and make my custom service and characteristics but I just can't seem to understand the structure of it all.

Why is it that main.c and the other tutorials .c files (like our_service.c) have so many .h files beneath it? are they all necessary or are some just to be sure? are these "packs" that are installed or are they something else? Whenever I make a .c file to make a service how do i get all the correct .h files the go beneath it so i can begin to follow the tutorials on how to create characteristics for my particular project?

So I guess im asking for an explanation as well as a little instruction. The nAN-36 is helpful but a its thing like this that i don't understand that are a big issue for me continuing. And answer is helpful, thank you

  • I mean i understand what they're for and why they exist, i just want to know how to get them into my new project. In this project i want to have a custom service with a few characteristics in it. I was wondering if I will i need to make my own header files for the .c class to create the service? The tutorial i followed had a service and its characteristic created in a .c file separate from the main.c, and this .c file had a lot of headers in order to accomplish its function of adding the service to the stack. I just assumed that the dozen or so headers that were added in the tutorial were not an excess and were standard for every project wishing to make a custom service and I wanted to know how to do it for y project.

    Sorry if i'm being confusing or difficult but this is the best way i know how to ask for help, thanks for your time

  • Just try it! You'll know if you need to include a header because it won't compile.

Related