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

Commit 3f496d6

Browse files
authored
v1.7.0 to optimize code for setInterval
### Releases v1.7.0 1. Optimize code for setInterval() of SAMD21 TC3. Check [setInterval on a running timer results in a period significantly longer than the specified period #17](#17) 2. Update `Packages_Patches`
1 parent d8d2a0e commit 3f496d6

13 files changed

+569
-430
lines changed

CONTRIBUTING.md

Lines changed: 4 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-
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.12, Adafruit SAMD core v1.7.7, Seeed Studio SAMD v1.8.2, Sparkfun SAMD v1.8.1)
18+
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.13, Adafruit SAMD core v1.7.10, Seeed Studio SAMD v1.8.2, Sparkfun SAMD v1.8.1)
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
2121
* Anything that might be relevant in your opinion, such as:
@@ -27,9 +27,9 @@ Please ensure to specify the following:
2727

2828
```
2929
Arduino IDE version: 1.8.19
30-
Arduino SAMD Core Version 1.8.12
30+
Arduino SAMD Core Version 1.8.13
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-96-generic #109-Ubuntu SMP Wed Jan 12 16:49:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
32+
Linux xy-Inspiron-3593 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3333
3434
Context:
3535
I encountered a crash while trying to use the Timer Interrupt.
@@ -50,3 +50,4 @@ There are usually some outstanding feature requests in the [existing issues list
5050
### Sending Pull Requests
5151

5252
Pull Requests with changes and fixes are also welcome!
53+

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,12 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
155155

156156
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)
157157
2. [`Arduino SAMD core 1.8.13+`](https://github.com/arduino/ArduinoCore-samd) for SAMD ARM Cortex-M0+ boards. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-samd.svg)](https://github.com/arduino/ArduinoCore-samd/releases/latest)
158-
3. [`Adafruit SAMD core 1.7.9+`](https://github.com/adafruit/ArduinoCore-samd) for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). [![GitHub release](https://img.shields.io/github/release/adafruit/ArduinoCore-samd.svg)](https://github.com/adafruit/ArduinoCore-samd/releases/latest)
158+
3. [`Adafruit SAMD core 1.7.10+`](https://github.com/adafruit/ArduinoCore-samd) for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). [![GitHub release](https://img.shields.io/github/release/adafruit/ArduinoCore-samd.svg)](https://github.com/adafruit/ArduinoCore-samd/releases/latest)
159159
4. [`Seeeduino SAMD core 1.8.2+`](https://github.com/Seeed-Studio/ArduinoCore-samd) for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). [![Latest release](https://img.shields.io/github/release/Seeed-Studio/ArduinoCore-samd.svg)](https://github.com/Seeed-Studio/ArduinoCore-samd/releases/latest/)
160160
5. [`Sparkfun SAMD core 1.8.1+`](https://github.com/sparkfun/Arduino_Boards) for SAMD21/SAMD51 boards (SparkFun_RedBoard_Turbo, SparkFun_SAMD51_Thing_Plus, etc.).
161161
6. [`Blynk library 1.0.1`](https://github.com/blynkkk/blynk-library/releases). [![Latest release](https://img.shields.io/github/release/blynkkk/blynk-library.svg)](https://github.com/blynkkk/blynk-library/releases/latest/) to use with some examples. Don't use Blynk beta versions.
162162
7. To use with some examples, depending on which Ethernet card you're using:
163-
- [`Ethernet library v2.0.0+`](https://github.com/arduino-libraries/Ethernet) for W5100, W5200 and W5500. [![GitHub release](https://img.shields.io/github/release/arduino-libraries/Ethernet.svg)](https://github.com/arduino-libraries/Ethernet/releases/latest)
164-
- [`EthernetLarge library v2.0.0+`](https://github.com/OPEnSLab-OSU/EthernetLarge) for W5100, W5200 and W5500.
165-
- [`Ethernet2 library v1.0.4+`](https://github.com/khoih-prog/Ethernet2) for W5500. [![GitHub release](https://img.shields.io/github/release/adafruit/Ethernet2.svg)](https://github.com/adafruit/Ethernet2/releases/latest)
166-
- [`Ethernet3 library v1.5.5+`](https://github.com/sstaub/Ethernet3) for W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip. [![GitHub release](https://img.shields.io/github/release/sstaub/Ethernet3.svg)](https://github.com/sstaub/Ethernet3/releases/latest)
163+
- [`Ethernet_Generic library v2.1.0+`](https://github.com/khoih-prog/Ethernet_Generic) for W5100, W5200 and W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip. [![GitHub release](https://img.shields.io/github/release/khoih-prog/Ethernet_Generic.svg)](https://github.com/khoih-prog/Ethernet_Generic/releases/latest)
167164
- [`EthernetENC library v2.0.2+`](https://github.com/jandrassy/EthernetENC) for ENC28J60. [![GitHub release](https://img.shields.io/github/release/jandrassy/EthernetENC.svg)](https://github.com/jandrassy/EthernetENC/releases/latest). **New and Better**
168165
- [`UIPEthernet library v2.0.11+`](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60. [![GitHub release](https://img.shields.io/github/release/UIPEthernet/UIPEthernet.svg)](https://github.com/UIPEthernet/UIPEthernet/releases/latest)
169166
7. To use with some examples
@@ -193,7 +190,7 @@ Another way to install is to:
193190

194191
1. Install [VS Code](https://code.visualstudio.com/)
195192
2. Install [PlatformIO](https://platformio.org/platformio-ide)
196-
3. Install [**SAMD_TimerInterrupt** library](https://platformio.org/lib/show/11396/SAMD_TimerInterrupt) or [**SAMD_TimerInterrupt** library](https://platformio.org/lib/show/11412/SAMD_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/11412/SAMD_TimerInterrupt/installation). Search for **SAMD_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
193+
3. Install [**SAMD_TimerInterrupt** library](https://registry.platformio.org/libraries/khoih-prog/SAMD_TimerInterrupt) by using [Library Manager](https://registry.platformio.org/libraries/khoih-prog/SAMD_TimerInterrupt/installation). Search for **SAMD_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
197194
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)
198195

199196
---
@@ -203,13 +200,13 @@ Another way to install is to:
203200

204201
#### 1. For Arduino SAMD boards
205202

206-
***To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards***, you have to copy the whole [Arduino SAMD Packages_Patches](Packages_Patches/arduino/hardware/samd/1.8.12) directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.12).
203+
***To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards***, you have to copy the whole [Arduino SAMD Packages_Patches](Packages_Patches/arduino/hardware/samd/1.8.13) directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.13).
207204

208205
#### For core version v1.8.10+
209206

210-
Supposing the Arduino SAMD version is 1.8.12. Now only one file must be copied into the directory:
207+
Supposing the Arduino SAMD version is 1.8.13. Now only one file must be copied into the directory:
211208

212-
- `~/.arduino15/packages/arduino/hardware/samd/1.8.12/platform.txt`
209+
- `~/.arduino15/packages/arduino/hardware/samd/1.8.13/platform.txt`
213210

214211
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
215212

@@ -242,13 +239,13 @@ Whenever the above-mentioned compiler error issue is fixed with the new Arduino
242239

243240
#### 2. For Adafruit SAMD boards
244241

245-
***To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards***, you have to copy the whole [Adafruit SAMD Packages_Patches](Packages_Patches/adafruit/hardware/samd/1.7.6) directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.6).
242+
***To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards***, you have to copy the whole [Adafruit SAMD Packages_Patches](Packages_Patches/adafruit/hardware/samd/1.7.9) directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.9).
246243

247-
Supposing the Adafruit SAMD core version is 1.7.6. This file must be copied into the directory:
244+
Supposing the Adafruit SAMD core version is 1.7.9. This file must be copied into the directory:
248245

249-
- `~/.arduino15/packages/adafruit/hardware/samd/1.7.6/platform.txt`
250-
- `~/.arduino15/packages/adafruit/hardware/samd/1.7.6/cores/arduino/Print.h`
251-
- `~/.arduino15/packages/adafruit/hardware/samd/1.7.6/cores/arduino/Print.cpp`
246+
- `~/.arduino15/packages/adafruit/hardware/samd/1.7.9/platform.txt`
247+
- `~/.arduino15/packages/adafruit/hardware/samd/1.7.9/cores/arduino/Print.h`
248+
- `~/.arduino15/packages/adafruit/hardware/samd/1.7.9/cores/arduino/Print.cpp`
252249

253250
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz
254251
This file must be copied into the directory:
@@ -540,7 +537,7 @@ While software timer, **programmed for 2s, is activated after 7.937s !!!**. Then
540537

541538
```
542539
Starting ISR_Timer_Complex_WiFiNINA on SAMD_NANO_33_IOT
543-
SAMDTimerInterrupt v1.6.0
540+
SAMDTimerInterrupt v1.7.0
544541
CPU Frequency = 48 MHz
545542
[TISR] SAMDTimerInterrupt: F_CPU (MHz) = 48 , TIMER_HZ = 48
546543
[TISR] TC_Timer::startTimer _Timer = 0x 42002c00 , TC3 = 0x 42002c00
@@ -605,7 +602,7 @@ The following is the sample terminal output when running example [**TimerInterru
605602

606603
```
607604
Starting TimerInterruptTest on ITSYBITSY_M4
608-
SAMDTimerInterrupt v1.6.0
605+
SAMDTimerInterrupt v1.7.0
609606
CPU Frequency = 48 MHz
610607
[TISR] SAMDTimerInterrupt: F_CPU (MHz) = 120 , TIMER_HZ = 48
611608
[TISR] TC_Timer::startTimer _Timer = 0x 0x4101c000 , TC3 = 0x 0x4101c000
@@ -683,7 +680,7 @@ The following is the sample terminal output when running example [**Argument_Non
683680

684681
```
685682
Starting Argument_None on SAMD_NANO_33_IOT
686-
SAMDTimerInterrupt v1.6.0
683+
SAMDTimerInterrupt v1.7.0
687684
CPU Frequency = 48 MHz
688685
[TISR] SAMDTimerInterrupt: F_CPU (MHz) = 48 , TIMER_HZ = 48
689686
[TISR] TC_Timer::startTimer _Timer = 0x 42002c00 , TC3 = 0x 42002c00
@@ -733,7 +730,7 @@ In this example, 16 independent ISR Timers are used, yet utilized just one Hardw
733730

734731
```
735732
Starting ISR_16_Timers_Array on SAMD_NANO_33_IOT
736-
SAMDTimerInterrupt v1.6.0
733+
SAMDTimerInterrupt v1.7.0
737734
CPU Frequency = 48 MHz
738735
[TISR] SAMDTimerInterrupt: F_CPU (MHz) = 48 , TIMER_HZ = 48
739736
[TISR] TC_Timer::startTimer _Timer = 0x 42002c00 , TC3 = 0x 42002c00
@@ -857,7 +854,7 @@ The following is the sample terminal output when running example [Change_Interva
857854

858855
```
859856
Starting Change_Interval on SAMD_NANO_33_IOT
860-
SAMDTimerInterrupt v1.6.0
857+
SAMDTimerInterrupt v1.7.0
861858
CPU Frequency = 48 MHz
862859
[TISR] SAMDTimerInterrupt: F_CPU (MHz) = 48 , TIMER_HZ = 48
863860
[TISR] TC_Timer::startTimer _Timer = 0x 42002c00 , TC3 = 0x 42002c00
@@ -921,7 +918,7 @@ The following is the sample terminal output when running example [RepeatedAttach
921918

922919
```
923920
Starting RepeatedAttachInterrupt_uS on SEEED_XIAO_M0
924-
SAMDTimerInterrupt v1.6.0
921+
SAMDTimerInterrupt v1.7.0
925922
CPU Frequency = 48 MHz
926923
[TISR] _period = 19995 , frequency = 50.01
927924
[TISR] SAMDTimerInterrupt: F_CPU (MHz) = 48 , TIMER_HZ = 48
@@ -1029,6 +1026,7 @@ Submit issues to: [SAMD_TimerInterrupt issues](https://github.com/khoih-prog/SAM
10291026
6. Fix `multiple-definitions` linker error
10301027
7. Add support to many more boards, such as `SAMD21E1xA`, `SAMD21G1xA` and`SAMD21J1xA`
10311028
8. Optimize library code by using `reference-passing` instead of `value-passing`
1029+
9. Optimize code for setInterval() of SAMD21 TC3
10321030

10331031
---
10341032
---
@@ -1044,6 +1042,7 @@ Many thanks for everyone for bug reporting, new feature suggesting, testing and
10441042
5. Thanks to [generationmake](https://github.com/generationmake) to make a PR in [change variable period from unsigned long to float #7](https://github.com/khoih-prog/SAMD_TimerInterrupt/pull/7) leading to new release v1.5.0.
10451043
6. Thanks to [Alexander Golovanov](https://github.com/homeodor) to propose a PR in [Add more SAMD21 #10](https://github.com/khoih-prog/SAMD_TimerInterrupt/pull/10) leading to the support of many new boards in new release v1.6.0
10461044
7. Thanks to [Will Powell](https://github.com/WillPowellUk) to report the bug in [Multiple Definition Error Not fixed by swapping src_cpp or src_h with src #9](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues/9) leading to new release v1.6.0.
1045+
8. Thanks to [Dave Hooper](https://github.com/stripwax) to report the bug and propose the fix in [setInterval on a running timer results in a period significantly longer than the specified period #17](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues/17) leading to new release v1.7.0.
10471046

10481047

10491048
<table>
@@ -1057,6 +1056,7 @@ Many thanks for everyone for bug reporting, new feature suggesting, testing and
10571056
</tr>
10581057
<tr>
10591058
<td align="center"><a href="https://github.com/WillPowellUk"><img src="https://github.com/WillPowellUk.png" width="100px;" alt="WillPowellUk"/><br /><sub><b>Will Powell</b></sub></a><br /></td>
1059+
<td align="center"><a href="https://github.com/stripwax"><img src="https://github.com/stripwax.png" width="100px;" alt="stripwax"/><br /><sub><b>Dave Hooper</b></sub></a><br /></td>
10601060
</tr>
10611061
</table>
10621062

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.7.0](#releases-v170)
1516
* [Releases v1.6.0](#releases-v160)
1617
* [Releases v1.5.0](#releases-v150)
1718
* [Releases v1.4.0](#releases-v140)
@@ -28,6 +29,11 @@
2829

2930
## Changelog
3031

32+
### Releases v1.7.0
33+
34+
1. Optimize code for setInterval() of SAMD21 TC3. Check [setInterval on a running timer results in a period significantly longer than the specified period #17](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues/17)
35+
2. Update `Packages_Patches`
36+
3137
### Releases v1.6.0
3238

3339
1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SAMD_TimerInterrupt",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"keywords": "timing, device, control, timer, interrupt, hardware, isr, isr-based, hardware-timer, isr-timer, isr-based-timer, mission-critical, accuracy, precise, non-blocking, samd, samd21, samd51, nano-33-iot",
55
"description": "This library enables you to use Interrupt from Hardware Timers on SAMD-based boards. It now supports 16 ISR-based timers, while consuming only 1 Hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware timers, using interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's necessary if you need to measure some data requiring better accuracy.",
66
"authors":

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SAMD_TimerInterrupt
2-
version=1.6.0
2+
version=1.7.0
33
author=Khoi Hoang <[email protected]>
44
maintainer=Khoi Hoang <[email protected]>
55
sentence=This library enables you to use Interrupt from Hardware Timers on SAMD-based boards such as SAMD21 Nano-33-IoT, Adafruit SAMD51 Itsy-Bitsy M4, SeeedStudio XIAO, Sparkfun SAMD51_MICROMOD, etc.

platformio/platformio.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ upload_speed = 921600
3636

3737
; Checks for the compatibility with frameworks and dev/platforms
3838
lib_compat_mode = strict
39+
lib_ldf_mode = chain+
40+
;lib_ldf_mode = deep+
3941

4042
lib_deps =
4143

src/SAMDTimerInterrupt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Based on BlynkTimer.h
1717
Author: Volodymyr Shymanskyy
1818
19-
Version: 1.6.0
19+
Version: 1.7.0
2020
2121
Version Modified By Date Comments
2222
------- ----------- ---------- -----------
@@ -29,6 +29,7 @@
2929
1.4.0 K.Hoang 02/06/2021 Fix SAMD21 rare bug caused by not fully init Prescaler
3030
1.5.0 K.Hoang 08/10/2021 Improve frequency precision by using float instead of ulong
3131
1.6.0 K.Hoang 20/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards
32+
1.7.0 K.Hoang 25/04/2022 Optimize code for setInterval() of SAMD21 TC3
3233
*****************************************************************************************************************************/
3334
/*
3435
SAMD21

0 commit comments

Comments
 (0)