Hello again!
Now is time to discover Doxygen, a magical tool than can create
miracles out of simple comments. For full understanding, please refer
to the file I uploaded in the Files section (IntroToDoxygen.pdf).
Especially you need to read chapter 3, since the rest of the chapters
cover how to install, configure and run doxygen. In fact, you want
need this, since I will create, at some point, an script to generate
the documentation automatically, so just focus on knowing how to code
the comments in a proper format ;)
Besides the PDF, I still would like to give you a brief example, since
the PDF covers a lot of things, and you might get confused. Moreover,
there are different ways of commenting the same thing, so I post here
the one I would like to follow in this project:
/*!
* Brief description of a block (typically a function).
*
* Long description of the block (it is optional, but here you can
tell
* much more about your function or your struct, in detail).
*
* @param p1 This is parameter 1, and it is used for this and that.
* @param p2 This is parameter 2, and it is used...
* ...
* @param pn This is parameter n, and it it used...
*
* @author Name of the author (this is optional; and seldom used).
* @see this_and_that (also optional, make reference to another part
of the code).
*
* @return what it is to be returned (if the function is void, then
this is skipped).
*/
type function(type p1, type p2, ..., type pn)
{
....
}
Let's see a concrete example:
/*!
* Test if a given port is set to 1 or not.
*
* This function checks the current value of a GPIO port and tests if
it is set to 1 or not.
*
* @param port GPIO number corresponding with the port to be tested.
*
* @author Claudio M. Camacho <
claud...@gmail.com>
* @see gpio_get_value
*
* @return true if the value of the given port is set to 1, false
otherwise.
*/
int port_is_high(int port)
{
return gpio_get_value(port);
}
I hope this information was useful, but, even if you don't understand
anything, don't worry. We will see how it develops on the fly ;)
BR,
Claudio M. Camacho