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

Commit 7487d1c

Browse files
authored
v1.4.0
### Major Releases v1.4.0 1. Add support to **Generic or Sparkfun AVR ATmega_32U4** such as **AVR_MAKEYMAKEY, AVR_PROMICRO, etc.** 2. Add support to **Generic or Sparkfun AVR ATmega_328(P)** such as **ARDUINO_REDBOT, ARDUINO_AVR_DIGITAL_SANDBOX, etc.** 3. Add support to **Generic or Sparkfun AVR ATmega128RFA1** such as **ATMEGA128RFA1_DEV_BOARD, etc.** 4. Add support to **Adafruit AVR ATMEGA_32U4** such as **AVR_FLORA8, AVR_FEATHER32U4, etc.** 5. Add support to **Adafruit AVR ATMEGA_328(P)** such as **AVR_FEATHER328P, AVR_METRO, etc.** 6. Add support to **AVR ATMEGA_16U4, ATMEGA_32U4** such as **Leonardo, YUN, ESPLORA, etc.** 7. Add support to **Sparkfun SAMD21 boards** such as **SparkFun_RedBoard_Turbo, SparkFun_Qwiic_Micro, etc.** 8. Add support to **Sparkfun SAMD51 boards** such as **SparkFun_SAMD51_Thing_Plus, SparkFun_SAMD51_MicroMod, etc.** 9. Update examples
1 parent 4d529e7 commit 7487d1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+772
-166
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Please ensure to specify the following:
2929
Arduino IDE version: 1.8.13
3030
Arduino SAMDUE Core Version 1.6.12
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
32+
Linux xy-Inspiron-3593 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
3333
3434
Context:
3535
I encountered a crash while trying to use the Timer Interrupt.

README.md

Lines changed: 91 additions & 31 deletions
Large diffs are not rendered by default.

library.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "TimerInterrupt_Generic",
3-
"version": "1.3.2",
4-
"keywords": "timing,device,control,timer,interrupt,hardware,avr,esp8266,esp32,due,sam-due,samd,nrf52,teensy,stm32,mission-critical,accuracy,precise,non-blocking,isr,isr-based,hardware-timer,mbed,nano-33-ble",
3+
"version": "1.4.0",
4+
"keywords": "timing,device,control,timer,interrupt,hardware,avr,mega, nano, uno, leonardo, yun, yun-mini, esplora, gemma, atmega, feather, adafruit, 16u4, 32u4, atmega328p, atmega128, atmega168, atmega2560, atmega1280, atmega16u4, atmega32u4, atmegang, atmega8,esp8266,esp32,due,sam-due,samd,samd21,samd51,nrf52,teensy,stm32,mission-critical,accuracy,precise,non-blocking,isr,isr-based,hardware-timer,mbed,nano-33-ble,adafruit,sparkfun,arduino,generic",
55
"description": "This library enables you to use Interrupt from Hardware Timers on supported boards such as AVR, ESP8266, ESP32, SAMD, SAM DUE, nRF52, STM32F/L/H/G/WB/MP1, Teensy, Nano-33-BLE, etc. These hardware timers, using interrupt, still work even if other functions are blocking. 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. 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":
77
{

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=TimerInterrupt_Generic
2-
version=1.3.2
2+
version=1.4.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 supported Arduino boards such as AVR, ESP8266, ESP32, SAMD, SAM DUE, nRF52, STM32F/L/H/G/WB/MP1, Teensy, Nano-33-BLE, etc.

src/AVRTimerInterrupt_Generic.h

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
Built by Khoi Hoang https://github.com/khoih-prog/TimerInterrupt_Generic
2727
Licensed under MIT license
2828
29-
Version: 1.3.2
29+
Version: 1.4.0
3030
3131
Version Modified By Date Comments
3232
------- ----------- ---------- -----------
@@ -35,6 +35,7 @@
3535
1.3.0 K Hoang 01/12/2020 Add Mbed Mano-33-BLE Library. Add support to AVR UNO, Nano, Arduino Mini, Ethernet, BT. etc.
3636
1.3.1 K.Hoang 09/12/2020 Add complex examples and board Version String. Fix SAMD bug.
3737
1.3.2 K.Hoang 06/01/2021 Fix warnings. Optimize examples to reduce memory usage
38+
1.4.0 K.Hoang 02/04/2021 Add support to Arduino, Adafruit, Sparkfun AVR 32u4, 328P, 128128RFA1 and Sparkfun SAMD
3839
*****************************************************************************************************************************/
3940

4041

@@ -48,7 +49,7 @@
4849
#endif
4950

5051
#ifndef TIMER_INTERRUPT_VERSION
51-
#define TIMER_INTERRUPT_VERSION "TimerInterrupt v1.2.0"
52+
#define TIMER_INTERRUPT_VERSION "TimerInterrupt v1.4.1"
5253
#endif
5354

5455
#include <avr/interrupt.h>
@@ -513,7 +514,11 @@ class TimerInterrupt
513514

514515
// 16 bit timers from here
515516
#if defined(TCCR1B)
517+
#if ( TIMER_INTERRUPT_USING_ATMEGA_32U4 )
518+
if (_timer == 1)
519+
#else
516520
else if (_timer == 1)
521+
#endif
517522
{
518523
TCCR1B = (TCCR1B & andMask) | _prescalerIndex; //prescalarbits;
519524

@@ -774,7 +779,11 @@ class TimerInterrupt
774779

775780
// 16 bit timers from here
776781
#if defined(TCCR1B)
782+
#if ( TIMER_INTERRUPT_USING_ATMEGA_32U4 )
783+
if (_timer == 1)
784+
#else
777785
else if (_timer == 1)
786+
#endif
778787
{
779788
TCCR1B = (TCCR1B & andMask);
780789

@@ -819,7 +828,11 @@ class TimerInterrupt
819828

820829
// 16 bit timers from here
821830
#if defined(TCCR1B)
831+
#if ( TIMER_INTERRUPT_USING_ATMEGA_32U4 )
832+
if (_timer == 1)
833+
#else
822834
else if (_timer == 1)
835+
#endif
823836
{
824837
TCCR1B = (TCCR1B & andMask) | _prescalerIndex; //prescalarbits;
825838

@@ -937,6 +950,47 @@ class TimerInterrupt
937950

938951
}; // class TimerInterrupt
939952

953+
//////////////////////////////////////////////
954+
955+
// To be sure not used Timers are disabled
956+
#if !defined(USE_TIMER_1)
957+
#define USE_TIMER_1 false
958+
#endif
959+
960+
#if !defined(USE_TIMER_2)
961+
#define USE_TIMER_2 false
962+
#elif ( USE_TIMER_2 && TIMER_INTERRUPT_USING_ATMEGA_32U4 )
963+
#undef USE_TIMER_2
964+
#define USE_TIMER_2 false
965+
#warning Timer2 is disabled for ATMEGA_32U4
966+
#endif
967+
968+
#if !defined(USE_TIMER_3)
969+
#define USE_TIMER_3 false
970+
#elif ( USE_TIMER_3 && TIMER_INTERRUPT_USING_ATMEGA_32U4 )
971+
#undef USE_TIMER_3
972+
#define USE_TIMER_3 false
973+
#warning Timer3 is disabled for ATMEGA_32U4
974+
#endif
975+
976+
#if !defined(USE_TIMER_4)
977+
#define USE_TIMER_4 false
978+
#elif ( USE_TIMER_4 && TIMER_INTERRUPT_USING_ATMEGA_32U4 )
979+
#undef USE_TIMER_4
980+
#define USE_TIMER_4 false
981+
#warning Timer4 is disabled for ATMEGA_32U4
982+
#endif
983+
984+
#if !defined(USE_TIMER_5)
985+
#define USE_TIMER_5 false
986+
#elif ( USE_TIMER_5 && TIMER_INTERRUPT_USING_ATMEGA_32U4 )
987+
#undef USE_TIMER_5
988+
#define USE_TIMER_5 false
989+
#warning Timer5 is disabled for ATMEGA_32U4
990+
#endif
991+
992+
//////////////////////////////////////////////
993+
940994
#if USE_TIMER_1
941995
#ifndef TIMER1_INSTANTIATED
942996
// To force pre-instatiate only once

src/ESP32TimerInterrupt_Generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Built by Khoi Hoang https://github.com/khoih-prog/TimerInterrupt_Generic
2626
Licensed under MIT license
2727
28-
Version: 1.3.2
28+
Version: 1.4.0
2929
3030
Version Modified By Date Comments
3131
------- ----------- ---------- -----------
@@ -34,6 +34,7 @@
3434
1.3.0 K Hoang 01/12/2020 Add Mbed Mano-33-BLE Library. Add support to AVR UNO, Nano, Arduino Mini, Ethernet, BT. etc.
3535
1.3.1 K.Hoang 09/12/2020 Add complex examples and board Version String. Fix SAMD bug.
3636
1.3.2 K.Hoang 06/01/2021 Fix warnings. Optimize examples to reduce memory usage
37+
1.4.0 K.Hoang 02/04/2021 Add support to Arduino, Adafruit, Sparkfun AVR 32u4, 328P, 128128RFA1 and Sparkfun SAMD
3738
*****************************************************************************************************************************/
3839

3940
#pragma once

src/ESP8266TimerInterrupt_Generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
Built by Khoi Hoang https://github.com/khoih-prog/TimerInterrupt_Generic
2525
Licensed under MIT license
2626
27-
Version: 1.3.2
27+
Version: 1.4.0
2828
2929
Version Modified By Date Comments
3030
------- ----------- ---------- -----------
@@ -33,6 +33,7 @@
3333
1.3.0 K Hoang 01/12/2020 Add Mbed Mano-33-BLE Library. Add support to AVR UNO, Nano, Arduino Mini, Ethernet, BT. etc.
3434
1.3.1 K.Hoang 09/12/2020 Add complex examples and board Version String. Fix SAMD bug.
3535
1.3.2 K.Hoang 06/01/2021 Fix warnings. Optimize examples to reduce memory usage
36+
1.4.0 K.Hoang 02/04/2021 Add support to Arduino, Adafruit, Sparkfun AVR 32u4, 328P, 128128RFA1 and Sparkfun SAMD
3637
*****************************************************************************************************************************/
3738

3839
#pragma once

src/ISR_Timer-Impl_Generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Built by Khoi Hoang https://github.com/khoih-prog/TimerInterrupt_Generic
2020
Licensed under MIT license
2121
22-
Version: 1.3.2
22+
Version: 1.4.0
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.3.0 K Hoang 01/12/2020 Add Mbed Mano-33-BLE Library. Add support to AVR UNO, Nano, Arduino Mini, Ethernet, BT. etc.
2929
1.3.1 K.Hoang 09/12/2020 Add complex examples and board Version String. Fix SAMD bug.
3030
1.3.2 K.Hoang 06/01/2021 Fix warnings. Optimize examples to reduce memory usage
31+
1.4.0 K.Hoang 02/04/2021 Add support to Arduino, Adafruit, Sparkfun AVR 32u4, 328P, 128128RFA1 and Sparkfun SAMD
3132
*****************************************************************************************************************************/
3233

3334
#pragma once

src/ISR_Timer_Generic.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Built by Khoi Hoang https://github.com/khoih-prog/TimerInterrupt_Generic
2020
Licensed under MIT license
2121
22-
Version: 1.3.2
22+
Version: 1.4.0
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.3.0 K Hoang 01/12/2020 Add Mbed Mano-33-BLE Library. Add support to AVR UNO, Nano, Arduino Mini, Ethernet, BT. etc.
2929
1.3.1 K.Hoang 09/12/2020 Add complex examples and board Version String. Fix SAMD bug.
3030
1.3.2 K.Hoang 06/01/2021 Fix warnings. Optimize examples to reduce memory usage
31+
1.4.0 K.Hoang 02/04/2021 Add support to Arduino, Adafruit, Sparkfun AVR 32u4, 328P, 128128RFA1 and Sparkfun SAMD
3132
*****************************************************************************************************************************/
3233

3334
#pragma once
@@ -36,7 +37,7 @@
3637
#define ISR_TIMER_GENERIC_H
3738

3839
#if !defined(TIMER_INTERRUPT_GENERIC_VERSION)
39-
#define TIMER_INTERRUPT_GENERIC_VERSION "TimerInterrupt_Generic v1.3.2"
40+
#define TIMER_INTERRUPT_GENERIC_VERSION "TimerInterrupt_Generic v1.4.0"
4041
#endif
4142

4243
#include <stddef.h>

src/NRF52TimerInterrupt_Generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Built by Khoi Hoang https://github.com/khoih-prog/TimerInterrupt_Generic
2020
Licensed under MIT license
2121
22-
Version: 1.3.2
22+
Version: 1.4.0
2323
2424
Version Modified By Date Comments
2525
------- ----------- ---------- -----------
@@ -28,6 +28,7 @@
2828
1.3.0 K Hoang 01/12/2020 Add Mbed Mano-33-BLE Library. Add support to AVR UNO, Nano, Arduino Mini, Ethernet, BT. etc.
2929
1.3.1 K.Hoang 09/12/2020 Add complex examples and board Version String. Fix SAMD bug.
3030
1.3.2 K.Hoang 06/01/2021 Fix warnings. Optimize examples to reduce memory usage
31+
1.4.0 K.Hoang 02/04/2021 Add support to Arduino, Adafruit, Sparkfun AVR 32u4, 328P, 128128RFA1 and Sparkfun SAMD
3132
*****************************************************************************************************************************/
3233
/*
3334
nRF52 has 5 Hardware TIMERs: NRF_TIMER0-NRF_TIMER4

0 commit comments

Comments
 (0)