3
3
*
4
4
* @file codingStyle
5
5
* @ingroup codingStyle
6
- * @author Janez Paternoster
7
- * @copyright 2015 Janez Paternoster
8
- *
9
- * License.
6
+ * @author name
7
+ * @copyright 2020 name
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
10
20
*/
11
21
12
-
13
22
#ifndef XYZ_H
14
23
#define XYZ_H
15
24
25
+ #ifdef __cplusplus
26
+ extern "C" {
27
+ #endif
16
28
17
29
/**
18
30
* @defgroup codingStyle Description of coding style
22
34
* Contents of this file should be the base for .h source file, except function
23
35
* body at the end.
24
36
*
25
- * ###Indentation
26
- * Indent size is 4.
27
- * Spaces are used, not tabs.
37
+ * ###Style
38
+ * - Style is based on Linux style
39
+ * - Indent size is 4.
40
+ * - Spaces are used, not tabs.
41
+ * - More datails are defined in .clang-format file
42
+ * - Some (old) code is still not corectly formatted. (To not break git history.)
28
43
*
29
44
* ###Doxygen
30
- * Documentation is generated by <http:// doxygen.org> .
45
+ * Documentation is generated by doxygen.
31
46
* Doxygen comment starts with /**. /**< is used after member.
32
47
* Documentation is usually in header.
33
48
* Doxygen settings:
34
49
* - JAVADOC_AUTOBRIEF = YES.
35
50
* - See doxyfile for other settings.
36
51
*
37
- * Doxygen specifics: If description of the structure member is one sentence only,
38
- * don't use period after the sentence.
52
+ * Doxygen specifics: If description of the structure member is one sentence
53
+ * only, don't use period after the sentence.
39
54
*
40
55
* ###Misra C
41
56
* Code shall follow MISRA-C:2012 standard.
47
62
* here.
48
63
*/
49
64
typedef struct {
50
- int8_t member1; /**< Short description of the member 1 */
51
- uint16_t member2; /**< Note the '/**<' sequence after the member 2 */
65
+ int8_t member1; /**< Short description of the member 1 */
66
+ uint16_t member2; /**< Note the '/**<' sequence after the member 2 */
52
67
/** Long description of the variable stringMember. More description. */
53
- char_t stringMember[5];
68
+ char_t stringMember[5];
54
69
} object1_t;
55
70
56
71
@@ -62,37 +77,40 @@ typedef struct {
62
77
*
63
78
* @param obj Pointer to object. Function operates on this object (not on global
64
79
* variables).
65
- * @param arg2 Description of the argument.
66
- * @param arg3 Description of the argument.
67
- * @param arg4 Description of the argument.
80
+ * @param argument_2 Description of the argument.
81
+ * @param argument_2 Description of the argument.
82
+ * @param argument_4 Description of the argument.
68
83
*
69
84
* @return Some value.
70
85
*/
71
- int32_t foo1(
72
- object1_t *obj,
73
- int32_t arg2,
74
- uint16_t arg3,
75
- float32_t arg4)
86
+ int32_t foo1(object1_t *obj,
87
+ int32_t argument_2,
88
+ uint16_t argument_3,
89
+ float32_t argument_4)
76
90
{
77
91
/* Comment */
78
92
79
93
/* Multiline
80
94
* comment.
81
95
*/
82
96
83
- if(xy == yz) { /* Comment. '//' comments are not allowed */
84
- ...
85
- }
86
- else {
87
- ...
97
+ if (xy == yz) { /* Comment. '//' comments are not allowed */
98
+ a = b;
99
+ } else {
100
+ a = c;
88
101
}
89
102
90
- switch(zx) {
91
- case 1: {
92
- ...
93
- }
103
+ switch (zx) {
104
+ case 1:
105
+ a = b;
106
+ break;
94
107
}
95
108
}
96
109
97
110
/** @} */
98
- #endif
111
+
112
+ #ifdef __cplusplus
113
+ }
114
+ #endif /*__cplusplus */
115
+
116
+ #endif /* XYZ_H */
0 commit comments