I'm working on documentation and combining 2 pieces of code for testing parts of a larger project.
I'm supposed to comment and make the code very clear to people who will use it later and make sure it's modular. I'm supposed to make header files, to reference function chunks in the main code from just the #include(s)
.
I understand in C++, that the convention is that for each header files(?), .h
, there is a .cpp
, where the .h
is the header file that declares all the content, and that the .cpp
is where you define the .h
, ie. implementation.
My supervisor told me to put more parts of the code into library files, because additional components will be added in the future -
but confused because all the length comes from using already existing library files, just a specific pattern of calling pre-defined functions.
If I put the files into a .h, how do I reference all the calls?
Make a void setup () {}
?
The compiled code is 348 lines right now. All it has are some #include(s)
, code to calibrate and read from 2 different sensors using I2C and SPI protocols, with 1 shared master an Adafruit Bluefruit nRF52832, and comments with links to datasheets.
The bulkiness is in the set-ups and the different ways to represent data (have 24 lines just to print out data from 1 sensor).
Should the entire code be just calling built in functions from a library file? So people who read the code don't see the details so much?