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

Commit 6ae987b

Browse files
authored
Update README.md and add allman astyle utils
1 parent ff31171 commit 6ae987b

File tree

4 files changed

+116
-5
lines changed

4 files changed

+116
-5
lines changed

CONTRIBUTING.md

Lines changed: 23 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.16) or Platform.io version
18-
* `STM32` Core Version (e.g. STM32 core v2.1.0)
18+
* `STM32` Core Version (e.g. STM32 core v2.3.0)
1919
* Board type and relevant info
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.16
31-
STM32 Core Version 2.1.0
31+
STM32 Core Version 2.3.0
3232
Nucleo-144 STM32H7 NUCLEO_H743ZI2
3333
OS: Ubuntu 20.04 LTS
34-
Linux xy-Inspiron-3593 5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 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 TimerInterrupt.
37+
I encountered a crash while using this library
3838
3939
Steps to reproduce:
4040
1. ...
@@ -43,12 +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/STM32_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!
59+
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/STM32_PWM_GitHub/
66+
xy@xy-Inspiron-3593:~/Arduino/xy/STM32_PWM_GitHub$
67+
```
68+
69+
2. Issue astyle command
70+
71+
```
72+
xy@xy-Inspiron-3593:~/Arduino/xy/STM32_PWM_GitHub$ bash utils/restyle.sh
73+
```

README.md

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

5959
This **wrapper library** enables you to use Hardware-based PWM on STM32F/L/H/G/WB/MP1 boards to create and output PWM to pins.
6060

61+
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**
62+
63+
- [**RP2040_PWM**](https://github.com/khoih-prog/RP2040_PWM)
64+
- [**AVR_PWM**](https://github.com/khoih-prog/AVR_PWM)
65+
- [**megaAVR_PWM**](https://github.com/khoih-prog/megaAVR_PWM)
66+
- [**ESP32_FastPWM**](https://github.com/khoih-prog/ESP32_FastPWM)
67+
- [**SAMD_PWM**](https://github.com/khoih-prog/SAMD_PWM)
68+
- [**SAMDUE_PWM**](https://github.com/khoih-prog/SAMDUE_PWM)
69+
- [**nRF52_PWM**](https://github.com/khoih-prog/nRF52_PWM)
70+
- [**Teensy_PWM**](https://github.com/khoih-prog/Teensy_PWM)
71+
- [**ATtiny_PWM**](https://github.com/khoih-prog/ATtiny_PWM)
72+
- [**Portenta_H7_PWM**](https://github.com/khoih-prog/Portenta_H7_PWM)
73+
- [**MBED_RP2040_PWM**](https://github.com/khoih-prog/MBED_RP2040_PWM)
74+
- [**nRF52_MBED_PWM**](https://github.com/khoih-prog/nRF52_MBED_PWM)
75+
- [**STM32_PWM**](https://github.com/khoih-prog/STM32_PWM)
76+
6177
---
6278

6379
The most important feature is they're purely hardware-based PWM channels. Therefore, their executions are **very precise and not blocked by bad-behaving functions or tasks**. This important feature is absolutely necessary for mission-critical tasks.
@@ -111,7 +127,7 @@ Functions using normal software-based PWM, relying on loop() and calling millis(
111127
## Prerequisites
112128

113129
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)
114-
2. [`Arduino Core for STM32 v2.2.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
130+
2. [`Arduino Core for STM32 v2.3.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
115131

116132
3. To use with certain example
117133
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).

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)