For the identation style we try to aim for a allman identation style with 2 space for each indentation: https://en.wikipedia.org/wiki/Indentation_style#Allman_style.
For the documentation we aim for a doxygen syntax. Each function must be documented in the header file where the function prototype is written. If there's no header file for the function, the documentation must be done in the source file on top of the function.
Here's a doxygen documentation template for function:
/**
* @brief the user function to read on RS485
*
* @param cmd_array an array that contains the command the thread need to receive to wakeup.
* @param nb_command the number of command.
* @param data_buffer the buffer where the byte gonna be written. The buffer should be of size 255.
* @return uint8_t the number of byte received.
*/
uint8_t read(const uint8_t* cmd_array, const uint8_t nb_command, uint8_t* data_buffer)
Also each file must have a header in doxygen documentation format, here's a template:
/**
* @file RS485.cpp
* @brief The source file for the RS485 firmware interface
*
* To start the RS485 thread call the RS485::init() before initializing other thread in the main function.
* To read bytes, use the RS485::read() function the priority of your thread must be higher than osPriorityBelowNormal.
* To write bytes, use the RS485::write() function.
*
* never call write and read function inside an interrupt.
*
*/
Adding more comment is strongly appreciated if you judge that the code is complex, but it's not mandatory.