Skip to content

Commit 1593876

Browse files
author
Irit Arkin
committed
Header levels
1 parent 8ceb353 commit 1593876

File tree

10 files changed

+138
-145
lines changed

10 files changed

+138
-145
lines changed

docs/creating_apps/EventQueue_impl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## EventQueue implemntation
1+
## EventQueue implementation
22

33
[A document about the particular features and peculiarities of the implementation of the EventQueue.]

docs/creating_apps/code_style.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Code contributions: GitHub pull requests and code style guide
1+
## Code contributions: GitHub pull requests and code style guide
22

33
The mbed OS codebase is hosted on GitHub, and you can submit new features or bug fixes. Please follow the [guidelines for GitHub pull requests](#guidelines-for-github-pull-requests) and the [coding style guide](#coding-style) in your submissions.
44

55
<span class="tips">**Tip:** Please also read the section [Creating and publishing your own libraries and contributing to mbed OS](contributing.md) for a review of the process and legal requirements.</span>
66

7-
## Guidelines for GitHub pull requests
7+
### Guidelines for GitHub pull requests
88

99
Pull requests on GitHub have to meet the following requirements in order to keep the code and commit history clean:
1010

@@ -22,17 +22,17 @@ Pull requests on GitHub have to meet the following requirements in order to keep
2222
* Because we use GitHub and explicit CLAs, special commit tags that other projects may use, such as “Reviewed-by”, or “Signed-off-by”, are redundant and should be omitted. GitHub keeps track of who reviewed what and when, and our stack of signed CLAs shows us who has agreed to our development contribution agreement.
2323
* Prefixing your commit message with a domain is acceptable and recommended where it makes sense to do so. However, prefixing one's domain with the name of the repo is not useful. For example, making a commit entitled "mbed-drivers: Fix doppelwidget frobulation" to the mbed-drivers repo would not be acceptable, as it is already understood that the commit applies to "mbed-drivers". Renaming the commit to "doppelwidget: Fix frobulation" would be better, if we presume that "doppelwidget" is a meaningful domain for changes, as it communicates that the change applies to the doppelwidget area of mbed-drivers.
2424

25-
## Code acceptance
25+
### Code acceptance
2626

2727
[After the CLA](contributing.md) is in place and the code has gone through automated testing, developers will take a look and comment on the pull request. If all is well and acceptable, your code will be ready for merging into the central development branch.
2828

29-
## Coding style
29+
### Coding style
3030

31-
Whether you're writing new code or fixing bugs in existing code, please follow the mbed OS coding style.
31+
Whether you're writing new code or fixing bugs in existing code, please follow the mbed OS coding style.
3232

3333
mbed OS follows the [K&R style](https://en.wikipedia.org/wiki/Indent_style#K.26R_style), with at least two exceptions (which can be found in the list below the code sample).
3434

35-
### Code sample
35+
#### Code sample
3636

3737
```c
3838
static const PinMap PinMap_ADC[] = {
@@ -51,37 +51,37 @@ uint32_t adc_function(analogin_t *obj, uint32_t options)
5151
timeout = 10;
5252
break;
5353
}
54-
54+
5555
while (!adc_hal_is_conversion_completed(instance, 0)) {
5656
if (timeout == 0) {
5757
break;
5858
} else {
5959
timeout--;
6060
}
6161
}
62-
62+
6363
if (obj->adc == ADC_CHANNEL0) {
6464
adc_measure_channel(instance);
6565
adc_stop_channel(instance);
6666
} else {
6767
error("channel not available");
6868
}
69-
69+
7070
#if DEBUG
7171
for (uint32_t i = 0; i < 10; i++) {
7272
printf("Loop : %d", i);
7373
}
7474
#endif
7575
return adc_hal_get_conversion_value(instance, 0);
76-
}
76+
}
7777
```
78-
### Rules
78+
#### Rules
7979
8080
* Indentation - four spaces. Please do not use tabs.
8181
8282
* Braces - K&R style.
8383
84-
* One true brace style (1TBS) - use braces for statements of type `if`, `else`, `while` and `for` (exception [from K&R](http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS)).
84+
* One true brace style (1TBS) - use braces for statements of type `if`, `else`, `while` and `for` (exception [from K&R](http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS)).
8585
8686
* One line per statement.
8787
@@ -95,7 +95,7 @@ uint32_t adc_function(analogin_t *obj, uint32_t options)
9595
9696
* Comments should use proper spelling and grammar.
9797
98-
* For pointers, `*` is adjacent to a name (analogin_t *obj).
98+
* For pointers, `*` is adjacent to a name (`analogin_t *obj`).
9999
100100
* Don't leave trailing spaces at the end of lines.
101101
@@ -107,21 +107,21 @@ uint32_t adc_function(analogin_t *obj, uint32_t options)
107107
108108
* A file should have an empty line at the end.
109109
110-
### Naming conventions
110+
#### Naming conventions
111111
112-
#### Classes
112+
##### Classes
113113
114114
* Begins with a capital letter, and each word in it also begins with a capital letter (AnalogIn, BusInOut).
115115
116116
* Methods contain small letters, with words separated by underscore.
117117
118118
* Private members starts with an underscore: ``__User defined types (typedef)))``.
119119
120-
* Structures - suffix _t - to denote it is a user defined type.
120+
* Structures - `suffix _t` - to denote it is a user defined type.
121121
122122
* Enumeration - the type name and values name - same naming convention as classes (for example MyNewEnum).
123123
124-
#### Functions
124+
##### Functions
125125
126126
* Contain lower case letters (as methods within classes).
127127
@@ -139,17 +139,17 @@ public:
139139
* @param pin AnalogIn pin to connect to
140140
* @param name (optional) A string to identify the object
141141
*/
142-
AnalogIn(PinName pin)
142+
AnalogIn(PinName pin)
143143
{
144144
analogin_init(&_adc, pin);
145145
}
146-
146+
147147
/** Read the input voltage, represented as a float in the range [0.0, 1.0].
148148
*
149149
* @returns
150150
* A floating-point value representing the current input voltage, measured as a percentage
151151
*/
152-
uint32_t read()
152+
uint32_t read()
153153
{
154154
return analogin_read(&_adc, operation);
155155
}
@@ -168,7 +168,7 @@ struct analogin_s {
168168
typedef struct analogin_s analogin_t;
169169
```
170170

171-
### Doxygen documentation
171+
#### Doxygen documentation
172172

173173
All functions and methods should contain documentation using doxgyen.
174174

@@ -180,11 +180,11 @@ You can use [Artistic Style (AStyle)](http://sourceforge.net/projects/astyle/fil
180180
astyle.exe --style=kr --indent=spaces=4 --indents-switches $(full_path_to_file)
181181
```
182182

183-
## Compile flags and ABI requirements
183+
### Compile flags and ABI requirements
184184

185185
All C and C++ code submitted to mbed OS must compile with GCC ARM Embedded, ARM Compiler 5 and IAR EWARM. Code must compile with specific flags for each compiler. See the list of these flags below. The profiles used by the mbed OS tools are each subsets of these flags. Each profile has one optimization setting.
186186

187-
### GCC ARM Embedded
187+
#### GCC ARM Embedded
188188

189189
Code must be compatible with the `softfp` float ABI. mbed OS uses the following flags when compiling with GCC ARM Embedded.
190190

@@ -198,10 +198,10 @@ flag | meaning
198198
`-fno-rtti` | Disable runtime type information (C++ only)
199199
`-Os` | Optimize for size
200200
`-O0` | Do not optimize
201-
`-std=gnu99` | C uses the GNU99 standard
201+
`-std=gnu99` | C uses the GNU99 standard
202202
`-std=gnu++98` | C++ uses the GNU++98 standard
203203

204-
### ARM Compiler 5
204+
#### ARM Compiler 5
205205

206206
mbed OS uses the following flags when compiling with ARM Compiler 5.
207207

@@ -213,7 +213,7 @@ flag | meaning
213213
`-O3` | Optimize for speed
214214
`-c99` | C uses the C99 standard
215215

216-
### IAR EWARM
216+
#### IAR EWARM
217217

218218
mbed OS uses the following flags when compiling with IAR EWARM.
219219

docs/creating_apps/contributing.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Creating and publishing your own libraries and contributing to mbed OS
1+
## Creating and publishing your own libraries and contributing to mbed OS
22

33
This chapter covers the different aspects of developing your own libraries for use in mbed devices, as well as items to keep in mind during development, such as licensing. It covers:
44

@@ -8,17 +8,17 @@ This chapter covers the different aspects of developing your own libraries for u
88

99
### Licensing binaries and libraries
1010

11-
When you write original code, you own the copyright and can choose to make it available to others under a license of your choice. A license gives rights and puts limitations on the reuse of your code by others. Not having a license means others cannot use your code. We encourage you to choose a license that makes possible (and encourages!) reuse by others.
11+
When you write original code, you own the copyright and can choose to make it available to others under a license of your choice. A license gives rights and puts limitations on the reuse of your code by others. Not having a license means others cannot use your code. We encourage you to choose a license that makes possible (and encourages!) reuse by others.
1212

1313
If you create new software, such as drivers, libraries and examples, you can apply whatever license you like as the author and copyright holder of that code. Having said that, we encourage you to use a well-known license such as one of the ones listed [on the SPDX License List](http://spdx.org/licenses/), preferably an [OSI-approved] (https://opensource.org/licenses/alphabetical), permissive open source software license. Specifically, we recommend the following:
1414

1515
* For original source code, use the Apache 2.0 license.  
1616

1717
* For binary releases (for example, private source code you can’t or don’t want to release but want to share as a binary library and headers available for others to use), consider the [Permissive Binary License](https://www.mbed.com/licenses/PBL-1.0). This is designed to be compatible with Apache 2.0 and the mbed OS codebase.
1818

19-
* If your software incorporates or is derived from other third party open source code, please be sure to retain all notices and identify the license for the third party licensed code in the same manner as described below. Remember, you cannot change the license on someone else’s code, because you are not the copyright holder! Instead, choose a license that is compatible with the license used by the third party open source code, or use the same license as that code. For example, if your software is derived from GPL source code, GPL requires you to license the rest of your code in that software under the GPL too. Note that many commercial users won’t be able to use GPL source code in their products, so we don't recommend this license if you're not obligated to use it.
19+
* If your software incorporates or is derived from other third party open source code, please be sure to retain all notices and identify the license for the third party licensed code in the same manner as described below. Remember, you cannot change the license on someone else’s code, because you are not the copyright holder! Instead, choose a license that is compatible with the license used by the third party open source code, or use the same license as that code. For example, if your software is derived from GPL source code, GPL requires you to license the rest of your code in that software under the GPL too. Note that many commercial users won’t be able to use GPL source code in their products, so we don't recommend this license if you're not obligated to use it.
2020

21-
You must either write all the code you provide yourself, or have the necessary rights to provide code written by someone else.
21+
You must either write all the code you provide yourself, or have the necessary rights to provide code written by someone else.
2222

2323
In all cases, whatever license you use, please use an [SPDX license identifier](http://spdx.org/licenses/) in every source file following the recommendations [here](https://spdx.org/spdx-specification-21-web-version#h.twlc0ztnng3b) to make it easier for users to understand and review licenses.
2424

@@ -34,7 +34,7 @@ In order to clearly reflect the Apache 2.0 license, please create two text files
3434

3535
* A *LICENSE* file with the following text:</br>
3636

37-
<pre>Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license,
37+
<pre>Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license,
3838
as can be found in: LICENSE-apache-2.0.txt</pre>
3939

4040
* The full original [Apache 2.0 license text](http://www.apache.org/licenses/LICENSE-2.0) in *LICENSE-apache-2.0.txt*
@@ -45,13 +45,13 @@ Each source header should *start with* your copyright line, the SPDX identifier
4545
Copyright (c) [First year]-[Last year], **Your Name or Company Here**
4646
SPDX-License-Identifier: Apache-2.0
4747
48-
Licensed under the Apache License, Version 2.0 (the "License");
48+
Licensed under the Apache License, Version 2.0 (the "License");
4949
you may not use this file except in compliance with the License.
5050
5151
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
5252
53-
Unless required by applicable law or agreed to in writing, software
54-
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
53+
Unless required by applicable law or agreed to in writing, software
54+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
5555
either express or implied.
5656
5757
See the License for the specific language governing permissions and limitations under the License.
@@ -61,7 +61,7 @@ See the License for the specific language governing permissions and limitations
6161

6262
The Permissive Binary License (PBL) is a permissive license based on BSD-3-Clause and designed specifically for binary blobs. It's minimal but covers the basics, including an express patent grant.
6363

64-
It allows you to share a binary blob and the relevant headers, and allows others to use that binary blob as part of their product - as long as they provide it with all the relevant dependencies and don't modify it or reverse engineer it.
64+
It allows you to share a binary blob and the relevant headers, and allows others to use that binary blob as part of their product - as long as they provide it with all the relevant dependencies and don't modify it or reverse engineer it.
6565

6666
The full text can be found on [mbed.com](https://www.mbed.com/licenses/PBL-1.0).
6767

@@ -71,7 +71,7 @@ In order to clearly reflect the PBL license, please create three text files:
7171

7272
* A *LICENSE* file with:
7373

74-
<pre>Unless specifically indicated otherwise in a file, files are licensed under the Permissive Binary License,
74+
<pre>Unless specifically indicated otherwise in a file, files are licensed under the Permissive Binary License,
7575
as can be found in: LICENSE-permissive-binary-license-1.0.txt</pre>
7676

7777
* The full original [Permissive Binary License 1.0 text](https://www.mbed.com/licenses/PBL-1.0) in *LICENSE-permissive-binary-license-1.0.txt*.
@@ -104,56 +104,56 @@ If you decide to use a different license for your work, follow the same pattern:
104104

105105
* If more than one license applies to the source file, then use an SPDX license expression (see [SPDX Specification, Appendix IV](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60)), to reflect the presence of multiple licenses in your *LICENSE* file and in each source file.
106106

107-
## Contributing to the mbed OS codebase
107+
### Contributing to the mbed OS codebase
108108

109-
### mbed OS principles
109+
#### mbed OS principles
110110

111111
mbed OS uses these same basic principles for its source code and library distributions. So source code we own is distributed under the Apache 2.0 license, and binary blobs are released under the Permissive Binary License. Software parts from third parties that were already licensed under a different license are available under that original license.
112112

113113
All the source code and binary blobs that end up in mbed OS are maintained in public GitHub repositories.
114114

115-
### Contributions
115+
#### Contributions
116116

117117
All code changes and additions to mbed OS are handled through GitHub. If you want to contribute, either by adding features or by fixing bugs, please follow the guidelines for [new features](#contributing-new-features-to-mbed-os) and [bugs](#reporting-and-fixing-bugs), and in both cases please follow the [code style guide and GitHub pull request guidelines](code_style.md).
118118

119-
### Inbound License for Contributions
119+
#### Inbound License for Contributions
120120

121-
If you want to contribute code to mbed OS, you must sign an mbed Contributor License Agreement (CLA). Please ask for a CLA before submitting any code (for example, while discussing the issue on GitHub), then wait for ARM to confirm acceptance of your CLA before making contributions.
121+
If you want to contribute code to mbed OS, you must sign an mbed Contributor License Agreement (CLA). Please ask for a CLA before submitting any code (for example, while discussing the issue on GitHub), then wait for ARM to confirm acceptance of your CLA before making contributions.
122122

123123
<span style="background-color:#E6E6E6;border:1px solid #000;display:block; height:100%; padding:10px">**Note:** If you publish a feature or a solution to a problem before signing the CLA, then find out that you are not able or allowed to sign the CLA, we will not be able to use your solution anymore. That may prevent us from solving the problem for you.</span>
124124

125-
When you ask for the CLA, we'll send you the agreement and ask you to sign it *before* we handle any pull request from you:
125+
When you ask for the CLA, we'll send you the agreement and ask you to sign it *before* we handle any pull request from you:
126126

127127
* Individuals who want to contribute their own work must sign and return an Individual CLA.
128128

129129
* Companies that want employees to contribute on its behalf must sign and return a Corporate CLA.
130130

131131
The same agreement is then valid for all future pull requests from that GitHub username.  
132132

133-
### Contributing new features to mbed OS
133+
#### Contributing new features to mbed OS
134134

135135
Before contributing an enhancement (new feature, new port and so on) please [discuss it on the forums](https://developer.mbed.org/forum/) to avoid duplication of work, as we or others might be working on a related feature.
136136

137137
Patch contributions can only be accepted through GitHub by creating a pull request from forked versions of our repositories. This allows us to review the contributions in a user friendly and reliable way, under public scrutiny.
138138

139139
Please create separate patches for each concern; each patch should have a clear unity of purpose. In particular, separate code formatting and style changes from functional changes. This makes each patch’s true contribution clearer and therefore quicker and easier to review.
140140

141-
### Reporting and fixing bugs
141+
#### Reporting and fixing bugs
142142

143143
Before submitting a bug report or a bug fix, please [discuss it on the forums](https://developer.mbed.org/forum/) to avoid duplication of work, as we or others might be working on it already.
144144

145-
#### Bug reports (issues) on GitHub
145+
##### Bug reports (issues) on GitHub
146146

147147
All mbed OS is on GitHub; please use GitHub's [issues mechanism](https://guides.github.com/features/issues/) to open a bug report directly against the relevant GitHub repository.
148148

149-
#### Bug fixes
149+
##### Bug fixes
150150

151-
Please refer to the [code contributions chapter](code_style.md).
151+
Please refer to the [code contributions chapter](code_style.md).
152152

153-
Bug fixes must be verified by a member of the mbed team before they're pulled into the main branch. You must therefore use GitHub to fork the repo, then submit a pull request with your changes.
153+
Bug fixes must be verified by a member of the mbed team before they're pulled into the main branch. You must therefore use GitHub to fork the repo, then submit a pull request with your changes.
154154

155155
The last line in your commit message description should say “Fixes #deadbeef”, where “deadbeef” is the issue number in GitHub. This allows GitHub to automatically close the issue when the commit is merged into the default branch.
156156

157-
## Further reading
157+
### Further reading
158158

159159
Please see the [code contributions chapter](code_style.md) for the guidelines to GitHub pull requests and the coding style guide.

0 commit comments

Comments
 (0)