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

Commit 63d2dc3

Browse files
authored
v1.1.1
### Releases v1.1.1 1. Add example [**Change_Interval**](examples/Change_Interval) 2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
1 parent 5ec7c85 commit 63d2dc3

21 files changed

+147
-51
lines changed

.gitignore

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app

README.md

+52-10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
4444
---
4545
---
4646

47+
### Releases v1.1.1
48+
49+
1. Add example [**Change_Interval**](examples/Change_Interval)
50+
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
51+
4752
### Releases v1.0.2
4853

4954
1. Add example [**ISR_16_Timers_Array_Complex**](examples/ISR_16_Timers_Array_Complex) and optimize example [**ISR_16_Timers_Array**](examples/ISR_16_Timers_Array)
@@ -60,7 +65,7 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
6065
---
6166
---
6267

63-
## Prerequisite
68+
## Prerequisites
6469

6570
1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
6671
2. [`Arduino mbed v1.3.0+`](https://www.arduino.cc/en/Guide/NANO33BLE#use-your-arduino-nano-33-ble-on-the-arduino-desktop-ide) for NRF52-based board using mbed-RTOS such as Nano-33-BLE.
@@ -90,7 +95,7 @@ Another way to install is to:
9095

9196
1. Install [VS Code](https://code.visualstudio.com/)
9297
2. Install [PlatformIO](https://platformio.org/platformio-ide)
93-
3. Install [**NRF52_MBED_TimerInterrupt** library](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt/installation). Search for **NRF52_MBED_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
98+
3. Install [**NRF52_MBED_TimerInterrupt** library](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt) or [**NRF52_MBED_TimerInterrupt** library](https://platformio.org/lib/show/11539/NRF52_MBED_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt/installation). Search for **NRF52_MBED_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
9499
4. Use included [platformio.ini](platformio/platformio.ini) file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at [Project Configuration File](https://docs.platformio.org/page/projectconf.html)
95100

96101
---
@@ -325,7 +330,7 @@ void setup()
325330
5. [TimerInterruptTest](examples/TimerInterruptTest)
326331
6. [TimerInterruptLEDDemo](examples/TimerInterruptLEDDemo)
327332
7. [FakeAnalogWrite](examples/FakeAnalogWrite)
328-
8. [Change_Interval](examples/Change_Interval)
333+
8. [**Change_Interval**](examples/Change_Interval). New
329334

330335
---
331336
---
@@ -401,7 +406,7 @@ typedef void (*irqCallback) (void);
401406
402407
/////////////////////////////////////////////////
403408
404-
#define USE_COMPLEX_STRUCT false
409+
#define USE_COMPLEX_STRUCT true
405410
406411
#if USE_COMPLEX_STRUCT
407412
@@ -606,7 +611,7 @@ void setup()
606611
while (!Serial);
607612
608613
Serial.printf("\nStarting ISR_16_Timers_Array_Complex on %s\n", BOARD_NAME);
609-
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
614+
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
610615
611616
// Interval in microsecs
612617
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
@@ -660,7 +665,7 @@ While software timer, **programmed for 2s, is activated after more than 3.000s i
660665

661666
```
662667
Starting ISR_16_Timers_Array_Complex on Nano 33 BLE
663-
Version : 1.0.2
668+
NRF52_MBED_TimerInterrupt v1.1.1
664669
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
665670
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 10000
666671
Starting ITimer OK, millis() = 714
@@ -1132,7 +1137,7 @@ Timer : 15, programmed : 80000, actual : 80009
11321137

11331138
```
11341139
Starting TimerInterruptTest on Nano 33 BLE
1135-
Version : v1.0.2
1140+
NRF52_MBED_TimerInterrupt v1.1.1
11361141
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
11371142
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 1000000
11381143
Starting ITimer0 OK, millis() = 5660
@@ -1163,7 +1168,7 @@ Start ITimer0, millis() = 60680
11631168

11641169
```
11651170
Starting Argument_None on Nano 33 BLE
1166-
Version : 1.0.2
1171+
NRF52_MBED_TimerInterrupt v1.1.1
11671172
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER1
11681173
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 500000
11691174
Starting ITimer0 OK, millis() = 1519
@@ -1188,9 +1193,8 @@ Time = 100010, Timer0Count = 197, Timer1Count = 49
11881193
4. The following is the sample terminal output when running example [FakeAnalogWrite](examples/FakeAnalogWrite) on **Nano 33 BLE** to demonstrate the usage of PWWM fakeAnalogWrite to simulate PWM analogWrite, but being able to write to many more pins.
11891194

11901195
```
1191-
11921196
Starting FakeAnalogWrite on Nano 33 BLE
1193-
Version : v1.0.2
1197+
NRF52_MBED_TimerInterrupt v1.1.1
11941198
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
11951199
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 100
11961200
Starting ITimer OK, millis() = 1811
@@ -1287,9 +1291,47 @@ Update index 7, pin = 9, input PWM_Value=120, mapped PWM_Value= 124
12871291
Test PWM_Value = 120, max = 255
12881292
```
12891293

1294+
---
1295+
1296+
5. The following is the sample terminal output when running example [Change_Interval](examples/Change_Interval) to demonstrate how to change Timer Interval on-the-fly
1297+
1298+
```
1299+
Starting Change_Interval on Nano 33 BLE
1300+
NRF52_MBED_TimerInterrupt v1.1.1
1301+
Starting ITimer0 OK, millis() = 801
1302+
Starting ITimer1 OK, millis() = 805
1303+
Time = 10001, Timer0Count = 18, , Timer1Count = 4
1304+
Time = 20002, Timer0Count = 38, , Timer1Count = 9
1305+
Changing Interval, Timer0 = 1000, Timer1 = 4000
1306+
Time = 30003, Timer0Count = 47, , Timer1Count = 11
1307+
Time = 40004, Timer0Count = 57, , Timer1Count = 13
1308+
Changing Interval, Timer0 = 500, Timer1 = 2000
1309+
Time = 50005, Timer0Count = 76, , Timer1Count = 17
1310+
Time = 60006, Timer0Count = 96, , Timer1Count = 22
1311+
Changing Interval, Timer0 = 1000, Timer1 = 4000
1312+
Time = 70007, Timer0Count = 105, , Timer1Count = 24
1313+
Time = 80008, Timer0Count = 115, , Timer1Count = 26
1314+
Changing Interval, Timer0 = 500, Timer1 = 2000
1315+
Time = 90009, Timer0Count = 134, , Timer1Count = 30
1316+
Time = 100010, Timer0Count = 154, , Timer1Count = 35
1317+
Changing Interval, Timer0 = 1000, Timer1 = 4000
1318+
Time = 110011, Timer0Count = 163, , Timer1Count = 37
1319+
Time = 120012, Timer0Count = 173, , Timer1Count = 39
1320+
Changing Interval, Timer0 = 500, Timer1 = 2000
1321+
Time = 130013, Timer0Count = 192, , Timer1Count = 43
1322+
Time = 140014, Timer0Count = 212, , Timer1Count = 48
1323+
Changing Interval, Timer0 = 1000, Timer1 = 4000
1324+
Time = 150015, Timer0Count = 221, , Timer1Count = 50
1325+
Time = 160016, Timer0Count = 231, , Timer1Count = 52
1326+
```
12901327
---
12911328
---
12921329

1330+
### Releases v1.1.1
1331+
1332+
1. Add example [**Change_Interval**](examples/Change_Interval)
1333+
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
1334+
12931335
### Releases v1.0.2
12941336

12951337
1. Add example [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex) and optimize example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array)

examples/Argument_None/Argument_None.ino

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.0.2
22+
Version: 1.1.1
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
2626
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
2727
1.0.2 K Hoang 23/11/2020 Add and optimize examples
28+
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2829
*****************************************************************************************************************************/
2930

3031
/*
@@ -116,7 +117,7 @@ void setup()
116117
delay(100);
117118

118119
Serial.printf("\nStarting Argument_None on %s\n", BOARD_NAME);
119-
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
120+
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
120121

121122
// Interval in microsecs
122123
if (ITimer0.attachInterruptInterval(TIMER0_INTERVAL_MS * 1000, TimerHandler0))

examples/Change_Interval/Change_Interval.ino

+11-10
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.0.2
22+
Version: 1.1.1
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
2626
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
2727
1.0.2 K Hoang 23/11/2020 Add and optimize examples
28+
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2829
*****************************************************************************************************************************/
2930

3031
/*
@@ -40,7 +41,7 @@
4041
*/
4142

4243
#if !( ARDUINO_ARCH_NRF52840 && TARGET_NAME == ARDUINO_NANO33BLE )
43-
#error This code is designed to run on nRF52-based Nano-33-BLE boards using mbed-RTOS platform! Please check your Tools->Board setting.
44+
#error This code is designed to run on nRF52-based Nano-33-BLE boards using mbed-RTOS platform! Please check your Tools->Board setting.
4445
#endif
4546

4647
// These define's must be placed at the beginning before #include "NRF52TimerInterrupt.h"
@@ -54,11 +55,11 @@
5455
//#endif
5556

5657
#ifndef LED_BLUE_PIN
57-
#define LED_BLUE_PIN D7
58+
#define LED_BLUE_PIN D7
5859
#endif
5960

6061
#ifndef LED_RED_PIN
61-
#define LED_RED_PIN D8
62+
#define LED_RED_PIN D8
6263
#endif
6364

6465
#define TIMER0_INTERVAL_MS 500 //1000
@@ -99,7 +100,7 @@ void TimerHandler1(void)
99100

100101
// Flag for checking to be sure ISR is working as Serial.print is not OK here in ISR
101102
Timer1Count++;
102-
103+
103104
//timer interrupt toggles outputPin
104105
digitalWrite(LED_BLUE_PIN, toggle1);
105106
toggle1 = !toggle1;
@@ -109,15 +110,15 @@ void setup()
109110
{
110111
pinMode(LED_BUILTIN, OUTPUT);
111112
pinMode(LED_BLUE_PIN, OUTPUT);
112-
113+
113114
Serial.begin(115200);
114115
while (!Serial);
115116

116117
delay(100);
117118

118119
Serial.printf("\nStarting Change_Interval on %s\n", BOARD_NAME);
119-
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
120-
120+
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
121+
121122
// Interval in microsecs
122123
if (ITimer0.attachInterruptInterval(TIMER0_INTERVAL_MS * 1000, TimerHandler0))
123124
{
@@ -156,12 +157,12 @@ void loop()
156157
{
157158
//setInterval(unsigned long interval, timerCallback callback)
158159
multFactor = (multFactor + 1) % 2;
159-
160+
160161
ITimer0.setInterval(TIMER0_INTERVAL_MS * 1000 * (multFactor + 1), TimerHandler0);
161162
ITimer1.setInterval(TIMER1_INTERVAL_MS * 1000 * (multFactor + 1), TimerHandler1);
162163

163164
Serial.printf("Changing Interval, Timer0 = %lu, Timer1 = %lu\n", TIMER0_INTERVAL_MS * (multFactor + 1), TIMER1_INTERVAL_MS * (multFactor + 1));
164-
165+
165166
lastChangeTime = currTime;
166167
}
167168
}

examples/FakeAnalogWrite/FakeAnalogWrite.ino

+10-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
1414
15-
Version: 1.0.2
15+
Version: 1.1.1
1616
1717
Version Modified By Date Comments
1818
------- ----------- ---------- -----------
1919
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
2020
1.0.2 K Hoang 23/11/2020 Add and optimize examples
21+
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2122
*****************************************************************************************************************************/
2223
/*
2324
Notes:
@@ -167,6 +168,8 @@ void doingSomething(int index)
167168
{
168169
if (curISRTimerData[index].PWM_Value > 0)
169170
digitalWrite(curISRTimerData[index].pin, 1);
171+
else
172+
digitalWrite(curISRTimerData[index].pin, 0);
170173
}
171174
else if (curISRTimerData[index].countPWM == curISRTimerData[index].PWM_Value)
172175
{
@@ -188,7 +191,7 @@ void setup()
188191
while (!Serial);
189192

190193
Serial.printf("\nStarting FakeAnalogWrite on %s\n", BOARD_NAME);
191-
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
194+
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
192195

193196
// Interval in microsecs
194197
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
@@ -274,6 +277,9 @@ void fakeAnalogWrite(uint16_t pin, uint16_t value)
274277
curISRTimerData[i].PWM_Value = 0;
275278
}
276279

280+
// Reset countPWM
281+
curISRTimerData[i].countPWM = 0;
282+
277283
return;
278284
}
279285
}
@@ -328,8 +334,8 @@ void fakeAnalogWrite(uint16_t pin, uint16_t value)
328334
}
329335
}
330336

331-
#define DELAY_BETWEEN_CHANGE_MS 10000L
332-
#define REPEAT_INTERVAL_MS 60000L
337+
#define DELAY_BETWEEN_CHANGE_MS 5000L
338+
#define REPEAT_INTERVAL_MS 10000L
333339

334340
#define DIVIDER 5
335341

examples/ISR_16_Timers_Array/ISR_16_Timers_Array.ino

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.0.2
22+
Version: 1.1.1
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
2626
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
2727
1.0.2 K Hoang 23/11/2020 Add and optimize examples
28+
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2829
*****************************************************************************************************************************/
2930
/*
3031
Notes:
@@ -255,7 +256,7 @@ void setup()
255256
while (!Serial);
256257

257258
Serial.printf("\nStarting ISR_16_Timers_Array on %s\n", BOARD_NAME);
258-
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
259+
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
259260

260261
// Interval in microsecs
261262
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))

examples/ISR_16_Timers_Array_Complex/ISR_16_Timers_Array_Complex.ino

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.0.2
22+
Version: 1.1.1
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
2626
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
2727
1.0.2 K Hoang 23/11/2020 Add and optimize examples
28+
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
2829
*****************************************************************************************************************************/
2930
/*
3031
Notes:
@@ -114,7 +115,7 @@ typedef void (*irqCallback) (void);
114115

115116
/////////////////////////////////////////////////
116117

117-
#define USE_COMPLEX_STRUCT false
118+
#define USE_COMPLEX_STRUCT true
118119

119120
#if USE_COMPLEX_STRUCT
120121

@@ -319,7 +320,7 @@ void setup()
319320
while (!Serial);
320321

321322
Serial.printf("\nStarting ISR_16_Timers_Array_Complex on %s\n", BOARD_NAME);
322-
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
323+
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
323324

324325
// Interval in microsecs
325326
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))

0 commit comments

Comments
 (0)