This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
codingstandard:index [2012-05-18 18:25] macke |
codingstandard:index [2021-06-24 16:35] (current) kimberly |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <WRAP center round important 60%> | ||
+ | This page has deprecated and will be archived. Please go to [[https:// | ||
+ | </ | ||
+ | |||
====== Coding standard for C ====== | ====== Coding standard for C ====== | ||
===== Indentation ===== | ===== Indentation ===== | ||
Line 5: | Line 9: | ||
===== 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 32: | ||
* | * | ||
* @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 119: | Line 133: | ||
- | ==== 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 |