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

Commit 14ef8f6

Browse files
authored
v1.0.1
### Releases v1.0.1 1. Add complicated example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array) utilizing and demonstrating the full usage of 16 independent ISR Timers.
1 parent 4f18f71 commit 14ef8f6

File tree

23 files changed

+878
-257
lines changed

23 files changed

+878
-257
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
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.13) or Platform.io version
18-
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.9, Adafruit SAMD core v1.6.3)
18+
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.9, Adafruit SAMD core v1.6.4, Seeed Studio 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:

README.md

Lines changed: 159 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
## Features
1313

14-
This library enables you to use Interrupt from Hardware Timers on an SAMD-based board.
14+
This library enables you to use Interrupt from Hardware Timers on an SAMD-based board, such as SAMD21 Nano-33-IoT, Adafruit SAMD51 Itsy-Bitsy M4, etc.
15+
16+
As **Hardware Timers are rare, and very precious assets** of any board, this library now enables you to use up to **16 ISR-based Timers, while consuming only 1 Hardware Timer**. Timers' interval is very long (**ulong millisecs**).
1517

1618
### Why do we need this Hardware Timer Interrupt?
1719

1820
Imagine you have a system with a **mission-critical** function, measuring water level and control the sump pump or doing something much more important. You normally use a software timer to poll, or even place the function in loop(). But what if another function is **blocking** the loop() or setup().
1921

20-
So your function **might not be executed, and the result would be disastrous.**
22+
So your function **might not be executed on-time or not at all, and the result would be disastrous.**
2123

2224
You'd prefer to have your function called, no matter what happening with other functions (busy loop, bug, etc.).
2325

@@ -42,6 +44,10 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
4244
---
4345
---
4446

47+
### Releases v1.0.1
48+
49+
1. Add complicated example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array) utilizing and demonstrating the full usage of 16 independent ISR Timers.
50+
4551
### Releases v1.0.0
4652

4753
1. Permit up to 16 super-long-time, super-accurate ISR-based timers to avoid being blocked
@@ -61,16 +67,17 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
6167

6268
1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
6369
2. [`Arduino SAMD core v1.8.9+`](https://www.arduino.cc/en/Guide/ArduinoM0) for SAMD ARM Cortex-M0+ boards (Nano 33 IoT, etc.).
64-
3. [`Adafruit SAMD core v1.6.3+`](https://www.adafruit.com/) for SAMD ARM Cortex-M0+ and M4 boards (Itsy-Bitsy M4, etc.)
65-
4. [`Seeeduino SAMD core v1.7.9+`](https://www.seeedstudio.com/) for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.)
70+
3. [`Adafruit SAMD core v1.6.4+`](https://www.adafruit.com/) for SAMD ARM Cortex-M0+ and M4 boards (Itsy-Bitsy M4, etc.)
71+
4. [`Seeeduino SAMD core v1.8.1+`](https://www.seeedstudio.com/) for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.)
6672
5. [`Blynk library 0.6.1+`](https://github.com/blynkkk/blynk-library) to use with certain example.
6773
6. To use with certain example, depending on which Ethernet card you're using:
6874
- [`Ethernet library v2.0.0+`](https://www.arduino.cc/en/Reference/Ethernet) for W5100, W5200 and W5500.
6975
- [`Ethernet2 library v1.0.4+`](https://github.com/khoih-prog/Ethernet2) for W5500 (Deprecated, use Arduino Ethernet library).
7076
- [`Ethernet3 library v1.5.3+`](https://github.com/sstaub/Ethernet3) for W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip.
7177
- [`EthernetLarge library v2.0.0+`](https://github.com/OPEnSLab-OSU/EthernetLarge) for W5100, W5200 and W5500. ***Ready*** from v1.0.1.
7278
- [`UIPEthernet library v2.0.9+`](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60.
73-
79+
7. To use with certain example
80+
- [`SimpleTimer library`](https://github.com/schinken/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
7481
---
7582
---
7683

@@ -125,22 +132,22 @@ These files must be copied into the directory:
125132

126133
Whenever the above-mentioned compiler error issue is fixed with the new Arduino SAMD release, you don't need to copy the `Arduino.h` file anymore.
127134

128-
2. **To be able to automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards**, you have to copy the file [Adafruit SAMD platform.txt](Packages_Patches/adafruit/hardware/samd/1.6.3) into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.6.3).
135+
2. **To be able to automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards**, you have to copy the file [Adafruit SAMD platform.txt](Packages_Patches/adafruit/hardware/samd/1.6.4) into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.6.4).
129136

130-
Supposing the Adafruit SAMD core version is 1.6.3. This file must be copied into the directory:
137+
Supposing the Adafruit SAMD core version is 1.6.4. This file must be copied into the directory:
131138

132-
- `~/.arduino15/packages/adafruit/hardware/samd/1.6.3/platform.txt`
139+
- `~/.arduino15/packages/adafruit/hardware/samd/1.6.4/platform.txt`
133140

134141
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz
135142
This file must be copied into the directory:
136143

137144
- `~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/platform.txt`
138145

139-
3. **To be able to automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards**, you have to copy the file [Seeeduino SAMD platform.txt](Packages_Patches/Seeeduino/hardware/samd/1.7.9) into Adafruit samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.7.9).
146+
3. **To be able to automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards**, you have to copy the file [Seeeduino SAMD platform.txt](Packages_Patches/Seeeduino/hardware/samd/1.8.1) into Adafruit samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.8.1).
140147

141-
Supposing the Seeeduino SAMD core version is 1.7.9. This file must be copied into the directory:
148+
Supposing the Seeeduino SAMD core version is 1.8.1. This file must be copied into the directory:
142149

143-
- `~/.arduino15/packages/Seeeduino/hardware/samd/1.7.9/platform.txt`
150+
- `~/.arduino15/packages/Seeeduino/hardware/samd/1.8.1/platform.txt`
144151

145152
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz
146153
This file must be copied into the directory:
@@ -366,13 +373,14 @@ void setup()
366373
### Examples:
367374

368375
1. [Argument_None](examples/Argument_None)
369-
2. [ISR_RPM_Measure](examples/ISR_RPM_Measure)
370-
3. [ISR_Timer_Complex_Ethernet](examples/ISR_Timer_Complex_Ethernet)
371-
4. [ISR_Timer_Complex_WiFiNINA](examples/ISR_Timer_Complex_WiFiNINA)
372-
5. [RPM_Measure](examples/RPM_Measure)
373-
6. [SwitchDebounce](examples/SwitchDebounce)
374-
7. [TimerInterruptTest](examples/TimerInterruptTest)
375-
8. [TimerInterruptLEDDemo](examples/TimerInterruptLEDDemo)
376+
2. [ISR_16_Timers_Array](examples/ISR_16_Timers_Array)
377+
3. [ISR_RPM_Measure](examples/ISR_RPM_Measure)
378+
4. [ISR_Timer_Complex_Ethernet](examples/ISR_Timer_Complex_Ethernet)
379+
5. [ISR_Timer_Complex_WiFiNINA](examples/ISR_Timer_Complex_WiFiNINA)
380+
6. [RPM_Measure](examples/RPM_Measure)
381+
7. [SwitchDebounce](examples/SwitchDebounce)
382+
8. [TimerInterruptTest](examples/TimerInterruptTest)
383+
9. [TimerInterruptLEDDemo](examples/TimerInterruptLEDDemo)
376384

377385

378386
---
@@ -654,7 +662,7 @@ While software timer, **programmed for 2s, is activated after 7.937s !!!**. Then
654662

655663
```
656664
Starting ISR_Timer_Complex_WiFiNINA on SAMD_NANO_33_IOT
657-
Version : 1.0.0
665+
Version : 1.0.1
658666
F_CPU (MHz) = 48, TIMER_HZ = 48
659667
TC_Timer::startTimer _Timer = 0x42002c00, TC3 = 0x42002c00
660668
Starting ITimer OK, millis() = 810
@@ -716,7 +724,7 @@ blynkDoingSomething2s: Delta programmed ms = 2000, actual = 3002
716724

717725
```
718726
Starting TimerInterruptTest on ITSYBITSY_M4
719-
Version : 1.0.0
727+
Version : 1.0.1
720728
F_CPU (MHz) = 120, TIMER_HZ = 48
721729
TC_Timer::startTimer _Timer = 0x4101c000, TC3 = 0x4101c000
722730
Starting ITimer1 OK, millis() = 1820
@@ -791,7 +799,7 @@ ITimer0: millis() = 91018, delta = 1000
791799

792800
```
793801
Starting Argument_None on SAMD_NANO_33_IOT
794-
Version : 1.0.0
802+
Version : 1.0.1
795803
F_CPU (MHz) = 48, TIMER_HZ = 48
796804
TC_Timer::startTimer _Timer = 0x42002c00, TC3 = 0x42002c00
797805
Starting ITimer1 OK, millis() = 910
@@ -825,11 +833,139 @@ ITimer0: millis() = 10910, delta = 500
825833
ITimer1: millis() = 10911, delta = 2000
826834
ITimer0: millis() = 11410, delta = 500
827835
ITimer0: millis() = 11910, delta = 500
836+
```
837+
838+
4. The following is the sample terminal output when running example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array) on **Arduino SAMD21 SAMD_NANO_33_IOT** to demonstrate the accuracy of ISR Hardware Timer, **especially when system is very busy or blocked**. The 16 independent ISR timers are **programmed to be activated repetitively after certain intervals, is activated exactly after that programmed interval !!!**
839+
840+
While software timer, **programmed for 2s, is activated after 10.000s in loop()!!!**.
841+
842+
In this example, 16 independent ISR Timers are used, yet utilized just one Hardware Timer. The Timer Intervals and Function Pointers are stored in arrays to facilitate the code modification.
828843

844+
845+
```
846+
Starting ISR_16_Timers_Array on SAMD_NANO_33_IOT
847+
Version : 1.0.1
848+
CPU Frequency = 48 MHz
849+
F_CPU (MHz) = 48, TIMER_HZ = 48
850+
TC_Timer::startTimer _Timer = 0x42002c00, TC3 = 0x42002c00
851+
Starting ITimer OK, millis() = 1421
852+
1s: Delta ms = 1000, ms = 2421
853+
1s: Delta ms = 1000, ms = 3421
854+
2s: Delta ms = 2000, ms = 3421
855+
1s: Delta ms = 1000, ms = 4421
856+
3s: Delta ms = 3000, ms = 4421
857+
1s: Delta ms = 1000, ms = 5421
858+
2s: Delta ms = 2000, ms = 5421
859+
4s: Delta ms = 4000, ms = 5421
860+
1s: Delta ms = 1000, ms = 6421
861+
5s: Delta ms = 5000, ms = 6421
862+
1s: Delta ms = 1000, ms = 7421
863+
2s: Delta ms = 2000, ms = 7421
864+
3s: Delta ms = 3000, ms = 7421
865+
6s: Delta ms = 6000, ms = 7421
866+
1s: Delta ms = 1000, ms = 8421
867+
7s: Delta ms = 7000, ms = 8421
868+
1s: Delta ms = 1000, ms = 9421
869+
2s: Delta ms = 2000, ms = 9421
870+
4s: Delta ms = 4000, ms = 9421
871+
8s: Delta ms = 8000, ms = 9421
872+
1s: Delta ms = 1000, ms = 10421
873+
3s: Delta ms = 3000, ms = 10421
874+
9s: Delta ms = 9000, ms = 10421
875+
1s: Delta ms = 1000, ms = 11421
876+
2s: Delta ms = 2000, ms = 11421
877+
5s: Delta ms = 5000, ms = 11421
878+
10s: Delta ms = 10000, ms = 11421
879+
simpleTimerDoingSomething2s: Delta programmed ms = 2000, actual = 10000
880+
1s: Delta ms = 1000, ms = 12421
881+
11s: Delta ms = 11000, ms = 12421
882+
1s: Delta ms = 1000, ms = 13421
883+
2s: Delta ms = 2000, ms = 13421
884+
3s: Delta ms = 3000, ms = 13421
885+
4s: Delta ms = 4000, ms = 13421
886+
6s: Delta ms = 6000, ms = 13421
887+
12s: Delta ms = 12000, ms = 13421
888+
1s: Delta ms = 1000, ms = 14421
889+
13s: Delta ms = 13000, ms = 14421
890+
1s: Delta ms = 1000, ms = 15421
891+
2s: Delta ms = 2000, ms = 15421
892+
7s: Delta ms = 7000, ms = 15421
893+
14s: Delta ms = 14000, ms = 15421
894+
1s: Delta ms = 1000, ms = 16421
895+
3s: Delta ms = 3000, ms = 16421
896+
5s: Delta ms = 5000, ms = 16421
897+
15s: Delta ms = 15000, ms = 16421
898+
1s: Delta ms = 1000, ms = 17421
899+
2s: Delta ms = 2000, ms = 17421
900+
4s: Delta ms = 4000, ms = 17421
901+
8s: Delta ms = 8000, ms = 17421
902+
16s: Delta ms = 16000, ms = 17421
903+
1s: Delta ms = 1000, ms = 18421
904+
1s: Delta ms = 1000, ms = 19421
905+
2s: Delta ms = 2000, ms = 19421
906+
3s: Delta ms = 3000, ms = 19421
907+
6s: Delta ms = 6000, ms = 19421
908+
9s: Delta ms = 9000, ms = 19421
909+
1s: Delta ms = 1000, ms = 20421
910+
1s: Delta ms = 1000, ms = 21421
911+
2s: Delta ms = 2000, ms = 21421
912+
4s: Delta ms = 4000, ms = 21421
913+
5s: Delta ms = 5000, ms = 21421
914+
10s: Delta ms = 10000, ms = 21421
915+
simpleTimerDoingSomething2s: Delta programmed ms = 2000, actual = 10000
916+
1s: Delta ms = 1000, ms = 22421
917+
3s: Delta ms = 3000, ms = 22421
918+
7s: Delta ms = 7000, ms = 22421
919+
1s: Delta ms = 1000, ms = 23421
920+
2s: Delta ms = 2000, ms = 23421
921+
11s: Delta ms = 11000, ms = 23421
922+
1s: Delta ms = 1000, ms = 24421
923+
1s: Delta ms = 1000, ms = 25421
924+
2s: Delta ms = 2000, ms = 25421
925+
3s: Delta ms = 3000, ms = 25421
926+
4s: Delta ms = 4000, ms = 25421
927+
6s: Delta ms = 6000, ms = 25421
928+
8s: Delta ms = 8000, ms = 25421
929+
12s: Delta ms = 12000, ms = 25421
930+
1s: Delta ms = 1000, ms = 26421
931+
5s: Delta ms = 5000, ms = 26421
932+
1s: Delta ms = 1000, ms = 27421
933+
2s: Delta ms = 2000, ms = 27421
934+
13s: Delta ms = 13000, ms = 27421
935+
1s: Delta ms = 1000, ms = 28421
936+
3s: Delta ms = 3000, ms = 28421
937+
9s: Delta ms = 9000, ms = 28421
938+
1s: Delta ms = 1000, ms = 29421
939+
2s: Delta ms = 2000, ms = 29421
940+
4s: Delta ms = 4000, ms = 29421
941+
7s: Delta ms = 7000, ms = 29421
942+
14s: Delta ms = 14000, ms = 29421
943+
1s: Delta ms = 1000, ms = 30421
944+
1s: Delta ms = 1000, ms = 31421
945+
2s: Delta ms = 2000, ms = 31421
946+
3s: Delta ms = 3000, ms = 31421
947+
5s: Delta ms = 5000, ms = 31421
948+
6s: Delta ms = 6000, ms = 31421
949+
10s: Delta ms = 10000, ms = 31421
950+
15s: Delta ms = 15000, ms = 31421
951+
simpleTimerDoingSomething2s: Delta programmed ms = 2000, actual = 10000
952+
1s: Delta ms = 1000, ms = 32421
953+
1s: Delta ms = 1000, ms = 33421
954+
2s: Delta ms = 2000, ms = 33421
955+
4s: Delta ms = 4000, ms = 33421
956+
8s: Delta ms = 8000, ms = 33421
957+
16s: Delta ms = 16000, ms = 33421
958+
1s: Delta ms = 1000, ms = 34421
959+
3s: Delta ms = 3000, ms = 34421
960+
11s: Delta ms = 11000, ms = 34421
829961
```
830962
---
831963
---
832964

965+
### Releases v1.0.1
966+
967+
1. Add complicated example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array) utilizing and demonstrating the full usage of 16 independent ISR Timers.
968+
833969
### Releases v1.0.0
834970

835971
1. Permit up to 16 super-long-time, super-accurate ISR-based timers to avoid being blocked
@@ -842,7 +978,6 @@ ITimer0: millis() = 11910, delta = 500
842978
- **Adafruit SAM51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.)**.
843979
- **Seeeduino SAMD21/SAMD51 boards (SEEED_WIO_TERMINAL, SEEED_FEMTO_M0, SEEED_XIAO_M0, Wio_Lite_MG126, WIO_GPS_BOARD, SEEEDUINO_ZERO, SEEEDUINO_LORAWAN, SEEED_GROVE_UI_WIRELESS, etc.)**
844980

845-
846981
---
847982
---
848983

@@ -855,12 +990,11 @@ Submit issues to: [SAMD_TimerInterrupt issues](https://github.com/khoih-prog/SAM
855990
## TO DO
856991

857992
1. Search for bug and improvement.
858-
2. Similar features for remaining Arduino boards such as SAMD21, SAMD51, SAM-DUE, nRF52
993+
2. Similar features for remaining Arduino boards such as SAM-DUE
859994

860995

861996
## DONE
862997

863-
For current version v1.0.0
864998

865999
1. Basic hardware timers for SAMD21 and SAMD51.
8661000
2. More hardware-initiated software-enabled timers
@@ -888,6 +1022,7 @@ Many thanks for everyone for bug reporting, new feature suggesting, testing and
8881022
## Contributing
8891023

8901024
If you want to contribute to this project:
1025+
8911026
- Report bugs and errors
8921027
- Ask for enhancements
8931028
- Create issues and pull requests

examples/Argument_None/Argument_None.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
Based on BlynkTimer.h
2020
Author: Volodymyr Shymanskyy
2121
22-
Version: 1.0.0
22+
Version: 1.0.1
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
26-
1.0.0 K Hoang 30/10/2020 Initial coding
26+
1.0.0 K Hoang 30/10/2020 Initial coding
27+
1.0.1 K Hoang 06/11/2020 Add complicated example ISR_16_Timers_Array using all 16 independent ISR Timers.
2728
*****************************************************************************************************************************/
2829

2930
/*

0 commit comments

Comments
 (0)