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

Commit d99a6b4

Browse files
authored
v1.2.2 to add support to Seeeduino nRF52
### Releases v1.2.2 1. Add support to Seeeduino nRF52840-based boards such as **SEEED_XIAO_NRF52840 and SEEED_XIAO_NRF52840_SENSE**, etc. using Seeeduino `mbed` core 2. Add astyle using `allman` style. Restyle the library
1 parent 20f287f commit d99a6b4

22 files changed

+418
-259
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ 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-
* Arduino `mbed` Core Version (e.g. Arduino `mbed` core v1.3.2 or Arduino `mbed_nano` core v2.7.2)
18+
* `nRF52840 mbed` Core Version (e.g. Arduino mbed_nano core v3.4.1, Seeeduino mbed core v2.7.2)
19+
* `nRF52840-based Nano_33_BLE` Board type (e.g. Nano_33_BLE, Nano_33_BLE_Sense, SEEED_XIAO_NRF52840 and SEEED_XIAO_NRF52840_SENSE, etc.)
1920
* Contextual information (e.g. what you were trying to achieve)
2021
* Simplest possible steps to reproduce
2122
* Anything that might be relevant in your opinion, such as:
@@ -27,12 +28,13 @@ Please ensure to specify the following:
2728

2829
```
2930
Arduino IDE version: 1.8.19
30-
Arduino mbed_nano` core v2.7.2
31+
Arduino mbed_nano core v3.4.1
32+
Nano_33_BLE board
3133
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 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
3335
3436
Context:
35-
I encountered a crash while trying to use the Timer Interrupt.
37+
I encountered a crash while using this library
3638
3739
Steps to reproduce:
3840
1. ...
@@ -41,13 +43,31 @@ Steps to reproduce:
4143
4. ...
4244
```
4345

46+
---
47+
4448
### Sending Feature Requests
4549

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

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

54+
---
55+
5056
### Sending Pull Requests
5157

5258
Pull Requests with changes and fixes are also welcome!
5359

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/nRF52_MBED_Slow_PWM_GitHub/
66+
xy@xy-Inspiron-3593:~/Arduino/xy/nRF52_MBED_Slow_PWM_GitHub$
67+
```
68+
69+
2. Issue astyle command
70+
71+
```
72+
xy@xy-Inspiron-3593:~/Arduino/xy/nRF52_MBED_Slow_PWM_GitHub$ bash utils/restyle.sh
73+
```

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## Table of Contents
1313

1414
* [Changelog](#changelog)
15+
* [Releases v1.2.2](#releases-v122)
1516
* [Releases v1.2.1](#releases-v121)
1617
* [Releases v1.2.0](#releases-v120)
1718
* [Releases v1.1.0](#releases-v110)
@@ -22,6 +23,11 @@
2223

2324
## Changelog
2425

26+
### Releases v1.2.2
27+
28+
1. Add support to Seeeduino nRF52840-based boards such as **SEEED_XIAO_NRF52840 and SEEED_XIAO_NRF52840_SENSE**, etc. using Seeeduino `mbed` core
29+
2. Add astyle using `allman` style. Restyle the library
30+
2531
### Releases v1.2.1
2632

2733
1. Fix `DutyCycle` bug. Check [float precisison of DutyCycle only sometimes working #3](https://github.com/khoih-prog/SAMD_Slow_PWM/issues/3)

examples/ISR_16_PWMs_Array/ISR_16_PWMs_Array.ino

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ NRF52_MBED_Slow_PWM ISR_PWM;
5858
//////////////////////////////////////////////////////
5959

6060
void TimerHandler()
61-
{
61+
{
6262
ISR_PWM.run();
6363
}
6464

@@ -89,15 +89,15 @@ void TimerHandler()
8989
// You can assign pins here. Be carefull to select good pin to use or crash, e.g pin 6-11
9090
uint32_t PWM_Pin[] =
9191
{
92-
LED_BUILTIN, LED_BLUE, LED_RED, PIN_D0, PIN_D1, PIN_D2, PIN_D3, PIN_D4,
93-
PIN_D5, PIN_D6, PIN_D7, PIN_D8, PIN_D9, PIN_D10, PIN_D11, PIN_D12
92+
LED_BUILTIN, LED_BLUE, LED_RED, PIN_D0, PIN_D1, PIN_D2, PIN_D3, PIN_D4,
93+
PIN_D5, PIN_D6, PIN_D7, PIN_D8, PIN_D9, PIN_D10, PIN_D11, PIN_D12
9494
};
9595

9696
// You can assign any interval for any timer here, in microseconds
9797
uint32_t PWM_Period[] =
9898
{
9999
1000000L, 500000L, 333333L, 250000L, 200000L, 166667L, 142857L, 125000L,
100-
111111L, 100000L, 66667L, 50000L, 40000L, 33333L, 25000L, 20000L
100+
111111L, 100000L, 66667L, 50000L, 40000L, 33333L, 25000L, 20000L
101101
};
102102

103103
// You can assign any interval for any timer here, in Hz
@@ -110,7 +110,7 @@ float PWM_Freq[] =
110110
// You can assign any interval for any timer here, in milliseconds
111111
float PWM_DutyCycle[] =
112112
{
113-
5.0, 10.0, 20.0, 30.0, 40.0, 45.0, 50.0, 55.0,
113+
5.0, 10.0, 20.0, 30.0, 40.0, 45.0, 50.0, 55.0,
114114
60.0, 65.0, 70.0, 75.0, 80.0, 85.0, 90.0, 95.0
115115
};
116116

@@ -186,18 +186,19 @@ void doingSomething15()
186186

187187
irqCallback irqCallbackStartFunc[] =
188188
{
189-
doingSomething0, doingSomething1, doingSomething2, doingSomething3,
190-
doingSomething4, doingSomething5, doingSomething6, doingSomething7,
189+
doingSomething0, doingSomething1, doingSomething2, doingSomething3,
190+
doingSomething4, doingSomething5, doingSomething6, doingSomething7,
191191
doingSomething8, doingSomething9, doingSomething10, doingSomething11,
192192
doingSomething12, doingSomething13, doingSomething14, doingSomething15
193193
};
194194

195195
////////////////////////////////////////////////
196196

197197
void setup()
198-
{
198+
{
199199
Serial.begin(115200);
200-
while (!Serial);
200+
201+
while (!Serial && millis() < 5000);
201202

202203
delay(2000);
203204

@@ -208,7 +209,8 @@ void setup()
208209
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
209210
{
210211
startMicros = micros();
211-
Serial.print(F("Starting ITimer OK, micros() = ")); Serial.println(startMicros);
212+
Serial.print(F("Starting ITimer OK, micros() = "));
213+
Serial.println(startMicros);
212214
}
213215
else
214216
Serial.println(F("Can't set ITimer. Select another freq. or timer"));
@@ -226,13 +228,13 @@ void setup()
226228
ISR_PWM.setPWM(PWM_Pin[i], PWM_Freq[i], PWM_DutyCycle[i], irqCallbackStartFunc[i]);
227229

228230
#else
229-
#if USING_MICROS_RESOLUTION
231+
#if USING_MICROS_RESOLUTION
230232
// Or using period in microsecs resolution
231233
ISR_PWM.setPWM_Period(PWM_Pin[i], PWM_Period[i], PWM_DutyCycle[i], irqCallbackStartFunc[i]);
232-
#else
234+
#else
233235
// Or using period in millisecs resolution
234236
ISR_PWM.setPWM_Period(PWM_Pin[i], PWM_Period[i] / 1000, PWM_DutyCycle[i], irqCallbackStartFunc[i]);
235-
#endif
237+
#endif
236238
#endif
237239
}
238240
}

0 commit comments

Comments
 (0)