Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit e3ea465

Browse files
authored
Add allman utils
1 parent 26c6ab7 commit e3ea465

File tree

3 files changed

+99
-3
lines changed

3 files changed

+99
-3
lines changed

CONTRIBUTING.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1515
Please ensure to specify the following:
1616

1717
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18-
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_portenta core v2.7.2)
18+
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_portenta core v3.4.1)
1919
* `Portenta_H7` Board type (e.g. Portenta_H7 Rev2 ABX00042, etc.)
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -28,13 +28,13 @@ Please ensure to specify the following:
2828

2929
```
3030
Arduino IDE version: 1.8.19
31-
`ArduinoCore-mbed` mbed_portenta core v2.7.2
31+
`ArduinoCore-mbed` mbed_portenta core v3.4.1
3232
Portenta_H7 Rev2 ABX00042
3333
OS: Ubuntu 20.04 LTS
3434
Linux xy-Inspiron-3593 5.4.0-99-generic #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3535
3636
Context:
37-
I encountered a crash while using PWM.
37+
I encountered a crash while using this library
3838
3939
Steps to reproduce:
4040
1. ...
@@ -43,13 +43,33 @@ Steps to reproduce:
4343
4. ...
4444
```
4545

46+
---
47+
4648
### Sending Feature Requests
4749

4850
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
4951

5052
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/Portenta_H7_PWM/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
5153

54+
---
55+
5256
### Sending Pull Requests
5357

5458
Pull Requests with changes and fixes are also welcome!
5559

60+
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
61+
62+
1. Change directory to the library GitHub
63+
64+
```
65+
xy@xy-Inspiron-3593:~$ cd Arduino/xy/Portenta_H7_PWM_GitHub/
66+
xy@xy-Inspiron-3593:~/Arduino/xy/Portenta_H7_PWM_GitHub$
67+
```
68+
69+
2. Issue astyle command
70+
71+
```
72+
xy@xy-Inspiron-3593:~/Arduino/xy/Portenta_H7_PWM_GitHub$ bash utils/restyle.sh
73+
```
74+
75+

utils/astyle_library.conf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Code formatting rules for Arduino libraries, modified from for KH libraries:
2+
#
3+
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
4+
#
5+
6+
# astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino
7+
8+
--mode=c
9+
--lineend=linux
10+
--style=allman
11+
12+
# -r or -R
13+
#--recursive
14+
15+
# -c => Converts tabs into spaces
16+
convert-tabs
17+
18+
# -s2 => 2 spaces indentation
19+
--indent=spaces=2
20+
21+
# -t2 => tab =2 spaces
22+
#--indent=tab=2
23+
24+
# -C
25+
--indent-classes
26+
27+
# -S
28+
--indent-switches
29+
30+
# -xW
31+
--indent-preproc-block
32+
33+
# -Y => indent classes, switches (and cases), comments starting at column 1
34+
--indent-col1-comments
35+
36+
# -M120 => maximum of 120 spaces to indent a continuation line
37+
--max-continuation-indent=120
38+
39+
# -xC120 => max‑code‑length will break a line if the code exceeds # characters
40+
--max-code-length=120
41+
42+
# -f =>
43+
--break-blocks
44+
45+
# -p => put a space around operators
46+
--pad-oper
47+
48+
# -xg => Insert space padding after commas
49+
--pad-comma
50+
51+
# -H => put a space after if/for/while
52+
pad-header
53+
54+
# -xb => Break one line headers (e.g. if/for/while)
55+
--break-one-line-headers
56+
57+
# -c => Converts tabs into spaces
58+
#--convert-tabs
59+
60+
# if you like one-liners, keep them
61+
#keep-one-line-statements
62+
63+
# -xV
64+
--attach-closing-while
65+
66+
#unpad-paren
67+
68+
# -xp
69+
remove-comment-prefix
70+

utils/restyle.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
for dir in . ; do
4+
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \;
5+
done
6+

0 commit comments

Comments
 (0)