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

Commit 2b9553a

Browse files
authored
v1.4.0 to fix multiple-definitions linker error
### Releases v1.4.0 1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories 2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project. 3. Fix `reattachInterrupt()` bug. Check [bugfix: reattachInterrupt() pass wrong frequency value to setFrequency() #19](khoih-prog/ESP8266TimerInterrupt#19) 4. Optimize library code by using `reference-passing` instead of `value-passing` 5. Update all examples
1 parent bbfcd2f commit 2b9553a

24 files changed

+1022
-895
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1414

1515
Please ensure to specify the following:
1616

17-
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
18-
* Arduino `mbed` Core Version (e.g. Arduino `mbed` core v1.3.2 or Arduino `mbed_nano` core v2.4.1 )
17+
* 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.6.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:
@@ -26,10 +26,10 @@ Please ensure to specify the following:
2626
### Example
2727

2828
```
29-
Arduino IDE version: 1.8.16
30-
Arduino mbed_nano` core v2.4.1
29+
Arduino IDE version: 1.8.19
30+
Arduino mbed_nano` core v2.6.1
3131
OS: Ubuntu 20.04 LTS
32-
Linux xy-Inspiron-3593 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
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
3333
3434
Context:
3535
I encountered a crash while trying to use the Timer Interrupt.

README.md

Lines changed: 159 additions & 164 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 9 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.4.0](#releases-v140)
1516
* [Releases v1.3.0](#releases-v130)
1617
* [Releases v1.2.1](#releases-v121)
1718
* [Releases v1.2.0](#releases-v120)
@@ -24,6 +25,14 @@
2425

2526
## Changelog
2627

28+
### Releases v1.4.0
29+
30+
1. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories
31+
2. Add example [multiFileProject](examples/multiFileProject) to demo for multiple-file project.
32+
3. Fix `reattachInterrupt()` bug. Check [bugfix: reattachInterrupt() pass wrong frequency value to setFrequency() #19](https://github.com/khoih-prog/ESP8266TimerInterrupt/pull/19)
33+
4. Optimize library code by using `reference-passing` instead of `value-passing`
34+
5. Update all examples
35+
2736
### Releases v1.3.0
2837

2938
1. Don't use NRF_TIMER_1 because of [ArduinoCore-mbed mbed_nano core v2.0.0+](https://github.com/arduino/ArduinoCore-mbed)

examples/Argument_None/Argument_None.ino

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315

3416
/*
@@ -52,8 +34,9 @@
5234
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5335
// For Nano33-BLE, don't use Serial.print() in ISR as system will definitely hang.
5436
#define TIMER_INTERRUPT_DEBUG 1
55-
#define _TIMERINTERRUPT_LOGLEVEL_ 0
37+
#define _TIMERINTERRUPT_LOGLEVEL_ 3
5638

39+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
5740
#include "NRF52_MBED_TimerInterrupt.h"
5841

5942
//#ifndef LED_BUILTIN

examples/Change_Interval/Change_Interval.ino

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315

3416
/*
@@ -52,8 +34,9 @@
5234
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5335
// For Nano33-BLE, don't use Serial.print() in ISR as system will definitely hang.
5436
#define TIMER_INTERRUPT_DEBUG 0
55-
#define _TIMERINTERRUPT_LOGLEVEL_ 0
37+
#define _TIMERINTERRUPT_LOGLEVEL_ 3
5638

39+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
5740
#include "NRF52_MBED_TimerInterrupt.h"
5841

5942
//#ifndef LED_BUILTIN

examples/FakeAnalogWrite/FakeAnalogWrite.ino

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315
/*
3416
Notes:
@@ -51,28 +33,29 @@
5133
*/
5234

5335
#if !( ARDUINO_ARCH_NRF52840 && TARGET_NAME == ARDUINO_NANO33BLE )
54-
#error This code is designed to run on nRF52-based Nano-33-BLE boards using mbed-RTOS platform! Please check your Tools->Board setting.
36+
#error This code is designed to run on nRF52-based Nano-33-BLE boards using mbed-RTOS platform! Please check your Tools->Board setting.
5537
#endif
5638

5739
// These define's must be placed at the beginning before #include "NRF52TimerInterrupt.h"
5840
// _TIMERINTERRUPT_LOGLEVEL_ from 0 to 4
5941
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
6042
// For Nano33-BLE, don't use Serial.print() in ISR as system will definitely hang.
6143
#define TIMER_INTERRUPT_DEBUG 1
62-
#define _TIMERINTERRUPT_LOGLEVEL_ 0
44+
#define _TIMERINTERRUPT_LOGLEVEL_ 3
6345

46+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6447
#include "NRF52_MBED_TimerInterrupt.h"
6548

6649
#ifndef LED_BUILTIN
67-
#define LED_BUILTIN D13
50+
#define LED_BUILTIN D13
6851
#endif
6952

7053
#ifndef LED_BLUE
71-
#define LED_BLUE D7
54+
#define LED_BLUE D7
7255
#endif
7356

7457
#ifndef LED_RED
75-
#define LED_RED D8
58+
#define LED_RED D8
7659
#endif
7760

7861
// For PWM_Value from 0-255.You can change to 1024 or 2048

examples/ISR_16_Timers_Array/ISR_16_Timers_Array.ino

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315
/*
3416
Notes:
@@ -61,8 +43,10 @@
6143
#define TIMER_INTERRUPT_DEBUG 1
6244
#define _TIMERINTERRUPT_LOGLEVEL_ 0
6345

46+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6447
#include "NRF52_MBED_TimerInterrupt.h"
6548

49+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6650
#include "NRF52_MBED_ISR_Timer.h"
6751

6852
#include <SimpleTimer.h> // https://github.com/jfturcot/SimpleTimer

examples/ISR_16_Timers_Array_Complex/ISR_16_Timers_Array_Complex.ino

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315
/*
3416
Notes:
@@ -59,10 +41,12 @@
5941
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
6042
// For Nano33-BLE, don't use Serial.print() in ISR as system will definitely hang.
6143
#define TIMER_INTERRUPT_DEBUG 0
62-
#define _TIMERINTERRUPT_LOGLEVEL_ 0
44+
#define _TIMERINTERRUPT_LOGLEVEL_ 3
6345

46+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6447
#include "NRF52_MBED_TimerInterrupt.h"
6548

49+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6650
#include "NRF52_MBED_ISR_Timer.h"
6751

6852
#include <SimpleTimer.h> // https://github.com/jfturcot/SimpleTimer

examples/SwitchDebounce/SwitchDebounce.ino

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315
/*
3416
Notes:
@@ -59,6 +41,7 @@
5941
#define TIMER_INTERRUPT_DEBUG 0
6042
#define _TIMERINTERRUPT_LOGLEVEL_ 0
6143

44+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6245
#include "NRF52_MBED_TimerInterrupt.h"
6346

6447
//#ifndef LED_BUILTIN

examples/TimerInterruptLEDDemo/TimerInterruptLEDDemo.ino

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,6 @@
1111
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
1212
Therefore, their executions are not blocked by bad-behaving functions / tasks.
1313
This important feature is absolutely necessary for mission-critical tasks.
14-
15-
Based on SimpleTimer - A timer library for Arduino.
16-
17-
Copyright (c) 2010 OTTOTECNICA Italy
18-
19-
Based on BlynkTimer.h
20-
Author: Volodymyr Shymanskyy
21-
22-
Version: 1.3.0
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
27-
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
29-
1.2.0 K.Hoang 11/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage
30-
1.2.1 K.Hoang 04/05/2021 Add mbed_nano to list of compatible architectures
31-
1.3.0 K.Hoang 09/09/2021 Don't use NRF_TIMER_1 because of mbed_nano core v2.0.0+
3214
*****************************************************************************************************************************/
3315

3416
/*
@@ -54,8 +36,10 @@
5436
#define TIMER_INTERRUPT_DEBUG 0
5537
#define _TIMERINTERRUPT_LOGLEVEL_ 0
5638

39+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
5740
#include "NRF52_MBED_TimerInterrupt.h"
5841

42+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
5943
#include "NRF52_MBED_ISR_Timer.h"
6044

6145
//#ifndef LED_BUILTIN

0 commit comments

Comments
 (0)