This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
codingstandard:index [2012-05-18 18:03] macke created |
codingstandard:index [2015-07-15 16:31] 127.0.0.1 external edit |
||
---|---|---|---|
Line 5: | Line 5: | ||
===== Doxygen ===== | ===== Doxygen ===== | ||
==== Main principles ==== | ==== Main principles ==== | ||
- | All functions/ | + | All functions/ |
The use of redundant information and excessive tag usage should be avoided. See the following example of the documentation for a file: | The use of redundant information and excessive tag usage should be avoided. See the following example of the documentation for a file: | ||
Line 28: | Line 28: | ||
* | * | ||
* @file | * @file | ||
+ | */ | ||
+ | </ | ||
+ | |||
+ | The tags for Doxygen should use the @ and the comments should use the notation except for [[codingstandard: | ||
+ | < | ||
+ | /** Doxygen comment */ | ||
+ | |||
+ | /** | ||
+ | * Doxygen comment. | ||
+ | * More comments | ||
*/ | */ | ||
</ | </ | ||
Line 84: | Line 94: | ||
</ | </ | ||
==== Files ==== | ==== Files ==== | ||
+ | The file header should follow this template: | ||
+ | < | ||
+ | /* | ||
+ | Insert license text here. | ||
+ | */ | ||
+ | |||
+ | /** | ||
+ | * This is the brief description. | ||
+ | * | ||
+ | * This is the detailed description. It is multi-line | ||
+ | * and multi-sentance. | ||
+ | * | ||
+ | * @file | ||
+ | * @ingroup drivers | ||
+ | */ | ||
+ | </ | ||
==== Functions ==== | ==== Functions ==== | ||
+ | Functions should be documented according to the following: | ||
+ | < | ||
+ | /** | ||
+ | * This is the brief description. | ||
+ | * | ||
+ | * This is the detailed description. It can be multi-line and | ||
+ | * multi-sentance. | ||
+ | * | ||
+ | * @param[in] | ||
+ | * @param[out] param2 Pass buffer to put return data into | ||
+ | * | ||
+ | * @return Description of the return (omitted if void) | ||
+ | * @ingroup group | ||
+ | | ||
+ | </ | ||
- | ==== Structs/typedef/unions ==== | + | |
+ | ==== Structs/enums/unions ==== | ||
+ | The same style should be used for structs/ | ||
+ | < | ||
+ | /** Struct for Testing */ | ||
+ | typedef struct { | ||
+ | uint32_t var1; ///< Variable 1 | ||
+ | uint32_t var2; ///< Variable 2 | ||
+ | } TestStruct; | ||
+ | </ | ||
+ | |||
+ | ==== Variables/ | ||
+ | The following should be used for variables/ | ||
+ | < | ||
+ | /** Definition of U32 */ | ||
+ | typedef uint32_t U32; | ||
+ | |||
+ | /** Variable for counting calls */ | ||
+ | uint32_t calls; | ||
+ | </ | ||
==== Macros ==== | ==== Macros ==== | ||
+ | < | ||
+ | /** Max count for things */ | ||
+ | #define MAX_COUNT | ||
+ | |||
+ | /** Macro for selecting max value */ | ||
+ | #define MAX(a,b) (a> | ||
+ | </ | ||
====== Coding standard for Python ====== | ====== Coding standard for Python ====== | ||
- | What ever works ;-) | + | We aim to follow [[http:// |
+ | |||
+ | ===== Documentation ===== | ||
+ | For documentation doc strings are used. | ||
+ | |||
+ | ===== Static analysis ===== | ||
+ | For static code analysis [[https:// | ||
+ | * These has been added to the list of good variables | ||
+ | * pk - used all over for variables that are CRTPPacket | ||
+ | * cf - used all over for variables that are Crazyflie | ||
+ | * logger - used all over as a file-global logger | ||
+ | * cb - used all over to describe an argument or variable that is a callback |