forked from CANopenNode/CANopenNode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codingStyle
98 lines (86 loc) · 2.18 KB
/
codingStyle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* Description of the coding style for the source files.
*
* @file codingStyle
* @ingroup codingStyle
* @author Janez Paternoster
* @copyright 2015 Janez Paternoster
*
* License.
*/
#ifndef XYZ_H
#define XYZ_H
/**
* @defgroup codingStyle Description of coding style
* @ingroup parentGroup
* @{
*
* Contents of this file should be the base for .h source file, except function
* body at the end.
*
* ###Indentation
* Indent size is 4.
* Spaces are used, not tabs.
*
* ###Doxygen
* Documentation is generated by <http://doxygen.org>.
* Doxygen comment starts with /**. /**< is used after member.
* Documentation is usually in header.
* Doxygen settings:
* - JAVADOC_AUTOBRIEF = YES.
* - See doxyfile for other settings.
*
* Doxygen specifics: If description of the structure member is one sentence only,
* don't use period after the sentence.
*
* ###Misra C
* Code shall follow MISRA-C:2012 standard.
*/
/**
* Brief description of the object ends at this dot. Details follow
* here.
*/
typedef struct {
int8_t member1; /**< Short description of the member 1 */
uint16_t member2; /**< Note the '/**<' sequence after the member 2 */
/** Long description of the variable stringMember. More description. */
char_t stringMember[5];
} object1_t;
/**
* Function example 1.
*
* This is global function. Local functions (and variables) used inside one file
* are declared as static and not documented by Doxygen.
*
* @param obj Pointer to object. Function operates on this object (not on global
* variables).
* @param arg2 Description of the argument.
* @param arg3 Description of the argument.
* @param arg4 Description of the argument.
*
* @return Some value.
*/
int32_t foo1(
object1_t *obj,
int32_t arg2,
uint16_t arg3,
float32_t arg4)
{
/* Comment */
/* Multiline
* comment.
*/
if(xy == yz) { /* Comment. '//' comments are not allowed */
...
}
else {
...
}
switch(zx) {
case 1: {
...
}
}
}
/** @} */
#endif