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

Commit 83a89e1

Browse files
authored
Update README.md and add allman astyle utils
1 parent d322a37 commit 83a89e1

File tree

4 files changed

+115
-5
lines changed

4 files changed

+115
-5
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 4 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_nano core v2.7.2)
18+
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_nano core v3.4.1)
1919
* `RP2040` Board type (e.g. Nano_RP2040_Connect, RaspberryPi Pico,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_nano core v2.7.2
31+
`ArduinoCore-mbed` mbed_nano core v3.4.1
3232
Nano_RP2040_Connect
3333
OS: Ubuntu 20.04 LTS
34-
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
34+
Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 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,31 @@ 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/MBED_RP2040_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/MBED_RP2040_PWM_GitHub/
66+
xy@xy-Inspiron-3593:~/Arduino/xy/MBED_RP2040_PWM_GitHub$
67+
```
68+
69+
2. Issue astyle command
70+
71+
```
72+
xy@xy-Inspiron-3593:~/Arduino/xy/MBED_RP2040_PWM_GitHub$ bash utils/restyle.sh
73+
```

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@
5555

5656
This library enables you to use Hardware-based PWM to create and output PWM to pins on **MBED RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO**, using [**Arduino-mbed mbed_rp2040 or mbed_nano** core](https://github.com/arduino/ArduinoCore-mbed)
5757

58+
This library is using the **same or similar functions** as other FastPWM libraries, as follows, to enable you to **port your PWM code easily between platforms**
59+
60+
- [**RP2040_PWM**](https://github.com/khoih-prog/RP2040_PWM)
61+
- [**AVR_PWM**](https://github.com/khoih-prog/AVR_PWM)
62+
- [**megaAVR_PWM**](https://github.com/khoih-prog/megaAVR_PWM)
63+
- [**ESP32_FastPWM**](https://github.com/khoih-prog/ESP32_FastPWM)
64+
- [**SAMD_PWM**](https://github.com/khoih-prog/SAMD_PWM)
65+
- [**SAMDUE_PWM**](https://github.com/khoih-prog/SAMDUE_PWM)
66+
- [**nRF52_PWM**](https://github.com/khoih-prog/nRF52_PWM)
67+
- [**ATtiny_PWM**](https://github.com/khoih-prog/ATtiny_PWM)
68+
- [**Portenta_H7_PWM**](https://github.com/khoih-prog/Portenta_H7_PWM)
69+
- [**MBED_RP2040_PWM**](https://github.com/khoih-prog/MBED_RP2040_PWM)
70+
- [**nRF52_MBED_PWM**](https://github.com/khoih-prog/nRF52_MBED_PWM)
71+
- [**STM32_PWM**](https://github.com/khoih-prog/STM32_PWM)
72+
73+
5874
---
5975

6076
The most important feature is they're purely `hardware-based PWM` channels. Therefore, the frequency can be higher than `hybrid or software-based PWM`, and their executions are **not blocked by bad-behaving functions / tasks**. This important feature is absolutely necessary for mission-critical tasks.
@@ -78,7 +94,7 @@ This non-being-blocked important feature is absolutely necessary for mission-cri
7894
## Prerequisites
7995

8096
1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [![GitHub release](https://img.shields.io/github/release/arduino/Arduino.svg)](https://github.com/arduino/Arduino/releases/latest)
81-
2. [`Arduino mbed_rp2040 core 2.7.2+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino (Use Arduino Board Manager) RP2040-based boards, such as **Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest)
97+
2. [`Arduino mbed_rp2040 core 3.4.1+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino (Use Arduino Board Manager) RP2040-based boards, such as **Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest)
8298
---
8399
---
84100

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)