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

Parents
  • I am also a beginner in the field, but ads far as I understand the .h files are the header files which contain the prototypes for all the functions that are than defined in the .c files. Also I think u wont' be able to compile a project until u have the corresponding prototypes define in the .h files.

Reply
  • I am also a beginner in the field, but ads far as I understand the .h files are the header files which contain the prototypes for all the functions that are than defined in the .c files. Also I think u wont' be able to compile a project until u have the corresponding prototypes define in the .h files.

Children
  • Yeah that's what I gathered as well. And I can't move any further till i do. Is there a way to import the files as a package or do i have to declare each one separately? Is there a model i can follow?

    I ultimately want to use the nrf51822 to send out pwm signals so is there specific header files needed?

    And thanks for the response!! @rbgautam