Skip to content

Commit f1b06d2

Browse files
authored
Added the example guideline and template (espressif#7665)
* Added the example guideline and template * PR review changes with some typos and grammar fixes * Changes according to the PR review
1 parent a95d838 commit f1b06d2

File tree

4 files changed

+131
-76
lines changed

4 files changed

+131
-76
lines changed

CONTRIBUTING.rst

-50
This file was deleted.

docs/source/contributing.rst

+98-9
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ Before Contributing
1515

1616
Before sending us a Pull Request, please consider this:
1717

18-
* Is the contribution entirely your own work, or is it already licensed under an LGPL 2.1 compatible Open Source License? If not, we unfortunately cannot accept it.
18+
* Is the contribution entirely your own work, or is it already licensed under an LGPL 2.1 compatible Open Source License? If not, cannot accept it.
1919

20-
* Is the code adequately commented for people to understand how it is structured?
20+
* Is the code adequately commented and can people understand how it is structured?
2121

2222
* Is there documentation or examples that go with code contributions?
2323

2424
* Are comments and documentation written in clear English, with no spelling or grammar errors?
2525

2626
* Example contributions are also welcome.
27-
* If you are contributing by adding a new example, please use the `Arduino style guide`_.
27+
28+
* If you are contributing by adding a new example, please use the `Arduino style guide`_ and the example guideline below.
2829

2930
* If the contribution contains multiple commits, are they grouped together into logical changes (one major change per pull request)? Are any commits with names like "fixed typo" `squashed into previous commits <https://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit/>`_?
3031

@@ -33,17 +34,105 @@ If you're unsure about any of these points, please open the Pull Request anyhow
3334
Pull Request Process
3435
--------------------
3536

36-
After you open the Pull Request, there will probably be some discussion in the comments' field of the request itself.
37+
After you open the Pull Request, there will probably be some discussion in the comments field of the request itself.
3738

38-
Once the Pull Request is ready to merge, it will first be merged into our internal git system for in-house automated testing.
39+
Once the Pull Request is ready to merge, it will first be merged into our internal git system for "in-house" automated testing.
3940

40-
If this process passes, it will be merged onto the public github repository.
41+
If this process passes, it will be merged into the public GitHub repository.
4142

42-
Legal Part
43-
----------
43+
Example Contribution Guideline
44+
------------------------------
45+
46+
Checklist
47+
*********
48+
49+
* Check if your example proposal has no similarities to the project (**already existing examples**)
50+
* Use the `Arduino style guide`_
51+
* Add the header to all source files
52+
* Add the `README.md` file
53+
* Add inline comments if needed
54+
* Test the example
55+
56+
Header
57+
******
58+
59+
All the source files must include the header with the example name and license, if applicable. You can change this header as you wish, but it will be reviewed by the community and may not be accepted.
60+
61+
Ideally, you can add some description about the example, links to the documentation, or the author's name. Just have in mind to keep it simple and short.
62+
63+
**Header Example**
64+
65+
.. code-block:: arduino
66+
67+
/* Wi-Fi FTM Initiator Arduino Example
68+
69+
This example code is in the Public Domain (or CC0 licensed, at your option.)
70+
71+
Unless required by applicable law or agreed to in writing, this
72+
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
73+
CONDITIONS OF ANY KIND, either express or implied.
74+
*/
75+
76+
77+
README file
78+
***********
79+
80+
The **README.md** file should contain the example details.
81+
82+
Please see the recommended **README.md** file in the `example template folder <https://github.com/espressif/arduino-esp32/tree/master/libraries/ESP32/examples/Template/ExampleTemplate>`_.
83+
84+
Inline Comments
85+
***************
86+
87+
Inline comments are important if the example contains complex algorithms or specific configurations that the user needs to change.
88+
89+
Brief and clear inline comments are really helpful for the example understanding and it's fast usage.
4490

45-
Before a contribution can be accepted, you will need to sign our contributor-agreement. You will be prompted for this automatically as part of the Pull Request process.
91+
**Example**
4692

93+
See the `FTM example <https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/FTM/FTM_Initiator/FTM_Initiator.ino>`_ as a reference.
94+
95+
.. code-block:: arduino
96+
97+
// Number of FTM frames requested in terms of 4 or 8 bursts (allowed values - 0 (No pref), 16, 24, 32, 64)
98+
99+
and
100+
101+
.. code-block:: arduino
102+
103+
const char * WIFI_FTM_SSID = "WiFi_FTM_Responder"; // SSID of AP that has FTM Enabled
104+
const char * WIFI_FTM_PASS = "ftm_responder"; // STA Password
105+
106+
Testing
107+
*******
108+
109+
Be sure you have tested the example in all the supported targets. If the example works only with specific targets, add this information in the **README.md** file on the **Supported Targets** and in the example code as an inline comment.
110+
111+
**Example**
112+
113+
.. code-block:: arduino
114+
115+
/*
116+
THIS FEATURE IS SUPPORTED ONLY BY ESP32-S2 AND ESP32-C3
117+
*/
118+
119+
and
120+
121+
.. code-block:: markdown
122+
123+
Currently, this example supports the following targets.
124+
125+
| Supported Targets | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
126+
| ----------------- | ----- | -------- | -------- | -------- |
127+
128+
Example Template
129+
****************
130+
131+
The example template can be found `here <https://github.com/espressif/arduino-esp32/tree/master/libraries/ESP32/examples/Template/ExampleTemplate>`_ and can be used as a reference.
132+
133+
Legal Part
134+
----------
47135

136+
Before a contribution can be accepted, you will need to sign our contributor agreement. You will be prompted for this automatically as part of the Pull Request process.
48137

49138
.. _Arduino style guide: https://www.arduino.cc/en/Reference/StyleGuide
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* Arduino Example Template
2+
3+
This example code is in the Public Domain (or CC0 licensed, at your option.)
4+
5+
Unless required by applicable law or agreed to in writing, this
6+
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7+
CONDITIONS OF ANY KIND, either express or implied.
8+
*/
9+
10+
void setup() {
11+
12+
}
13+
14+
void loop() {
15+
16+
}

docs/EXAMPLE_README_TEMPLATE.md renamed to libraries/ESP32/examples/Template/ExampleTemplate/README.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Arduino-ESP32 Example/Library Name ==(REQUIRED)==
22

3-
==*Add a brief description about this example/library here!*==
3+
==*Add a brief description of this example/library here!*==
44

55
This example/library demonstrates how to create a new example README file.
66

@@ -15,33 +15,33 @@ Currently, this example supports the following targets.
1515

1616
## How to Use Example/Library ==(OPTIONAL)==
1717

18-
==*Add a brief description on how to use this example.*==
18+
==*Add a brief description of how to use this example.*==
1919

2020
* How to install the Arduino IDE: [Install Arduino IDE](https://github.com/espressif/arduino-esp32/tree/master/docs/arduino-ide).
2121

2222
### Hardware Connection ==(OPTIONAL)==
2323

24-
==*Add a brief description about wiring or any other hardware specific connection.*==
24+
==*Add a brief description of wiring or any other hardware-specific connection.*==
2525

2626
To use this example, you need to connect the LED to the `GPIOx`.
2727

2828
SDCard GPIO connection scheme:
2929

30-
| SDCard Pin | Function | GPIO |
30+
| SDCard Pin | Function | GPIO |
3131
| ----------- | -------- | ------ |
32-
| 1 | CS | GPIO5 |
33-
| 2 | DI/MOSI | GPIO23 |
34-
| 3 | VSS/GND | GND |
35-
| 4 | VDD/3V3 | 3V3 |
36-
| 5 | SCLK | GPIO18 |
37-
| 6 | VSS/GND | GND |
38-
| 7 | DO/MISO | GPIO19 |
32+
| 1 | CS | GPIO5 |
33+
| 2 | DI/MOSI | GPIO23 |
34+
| 3 | VSS/GND | GND |
35+
| 4 | VDD/3V3 | 3V3 |
36+
| 5 | SCLK | GPIO18 |
37+
| 6 | VSS/GND | GND |
38+
| 7 | DO/MISO | GPIO19 |
3939

4040
To add images, please create a folder `_asset` inside the example folder to add the relevant images.
4141

4242
### Configure the Project ==(OPTIONAL)==
4343

44-
==*Add a brief description about this example here!*==
44+
==*Add a brief description of this example here!*==
4545

4646
Set the LED GPIO by changing the `LED_BUILTIN` value in the function `pinMode(LED_BUILTIN, OUTPUT);`. By default, the GPIO is: `GPIOx`.
4747

@@ -66,7 +66,7 @@ To get more information about the Espressif boards see [Espressif Development Ki
6666

6767
#### Using Platform IO
6868

69-
* Select the COM port: `Devices` or setting the `upload_port` option on the `platformio.ini` file.
69+
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
7070

7171
## Example/Log Output ==(OPTIONAL)==
7272

@@ -98,21 +98,21 @@ Chip ID: 3957392
9898
* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed.
9999
* **COM port not detected:** Check the USB cable and the USB to Serial driver installation.
100100

101-
If the error persist, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute).
101+
If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute).
102102

103103
## Contribute ==(REQUIRED)==
104104

105-
==*Do not change! Keep as is.*==
105+
==*Do not change! Keep it as is.*==
106106

107107
To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst)
108108

109109
If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome!
110110

111-
Before creating a new issue, be sure to try the Troubleshooting and to check if the same issue was already created by someone else.
111+
Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else.
112112

113113
## Resources ==(REQUIRED)==
114114

115-
==*Do not change here! Keep as is or add only relevant documents/info for this example. Do not add any purchase link/marketing stuff*==
115+
==*Do not change here! Keep it as is or add only relevant documents/info for this example. Do not add any purchase link/marketing stuff*==
116116

117117
* Official ESP32 Forum: [Link](https://esp32.com)
118118
* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)

0 commit comments

Comments
 (0)