This documentation guide applies to any code being written in C/C++ on the team.

Comments

Single Line Comments

Variable and function names should be descriptive enough to understand even without comments, but if comments are needed to explain parts of the code, use single line comments with the /* */ notation for better compatibility with old compilers in C.

/* Single line comment */
// Do not use this for C code

Function Comments

Function comments should exist in both the .h and .c files optimally, but at minimum they should be available in the .h files. Comments should follow the format shown below:

/**
 * @brief Adds two numbers together
 * 
 * @param num1 - The first number to add.
 * @param num2 - The second number to add.
 * @return uint8_t - Returns the sum of of the two numbers.
 */
uint8_t add_numbers(uint8_t num1, uint8_t num2);

File Header Comments

Naming and typing conventions