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

Commit 245f19b

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 6. Update `Packages_Patches`
1 parent 3a6514c commit 245f19b

27 files changed

+493
-489
lines changed

CONTRIBUTING.md

+5-5
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-
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_portenta core v2.4.1)
17+
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18+
* `ArduinoCore-mbed` Core Version (e.g. `ArduinoCore-mbed` mbed_portenta core v2.6.1)
1919
* `Portenta_H7` Board type (e.g. Portenta_H7 Rev2 ABX00042, etc.)
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -27,11 +27,11 @@ Please ensure to specify the following:
2727
### Example
2828

2929
```
30-
Arduino IDE version: 1.8.16
31-
`ArduinoCore-mbed` mbed_portenta core v2.4.1
30+
Arduino IDE version: 1.8.19
31+
`ArduinoCore-mbed` mbed_portenta core v2.6.1
3232
Portenta_H7 Rev2 ABX00042
3333
OS: Ubuntu 20.04 LTS
34-
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
34+
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
3535
3636
Context:
3737
I encountered a crash while using TimerInterrupt.

README.md

+91-97
Large diffs are not rendered by default.

changelog.md

+10-8
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.1](#Releases-v131)
1617
* [Releases v1.3.0](#Releases-v130)
1718
* [Initial Releases v1.2.1](#Initial-Releases-v121)
@@ -21,6 +22,15 @@
2122

2223
## Changelog
2324

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

2636
1. Fix warnings in PWM examples
@@ -36,11 +46,3 @@
3646
3. Using cpp code besides Impl.h code to use if Multiple-Definition linker error.
3747
4. Bump version to v1.2.1 to sync with [STM32_TimerInterrupt library](https://github.com/khoih-prog/STM32_TimerInterrupt)
3848

39-
---
40-
---
41-
42-
## Copyright
43-
44-
Copyright 2021- Khoi Hoang
45-
46-

examples/Argument_None/Argument_None.ino

+1-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015

3116
/*
@@ -49,6 +34,7 @@
4934
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5035
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5136

37+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5238
#include "Portenta_H7_TimerInterrupt.h"
5339

5440
#define LED_OFF HIGH

examples/Change_Interval/Change_Interval.ino

+1-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015

3116
/*
@@ -49,6 +34,7 @@
4934
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5035
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5136

37+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5238
#include "Portenta_H7_TimerInterrupt.h"
5339

5440
#define LED_OFF HIGH

examples/ISR_16_Timers_Array/ISR_16_Timers_Array.ino

+3-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015
/*
3116
Notes:
@@ -49,7 +34,10 @@
4934
#define TIMER_INTERRUPT_DEBUG 1
5035
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5136

37+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5238
#include "Portenta_H7_TimerInterrupt.h"
39+
40+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
5341
#include "Portenta_H7_ISR_Timer.h"
5442

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

examples/ISR_16_Timers_Array_Complex/ISR_16_Timers_Array_Complex.ino

+3-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015
/*
3116
Notes:
@@ -56,7 +41,10 @@
5641
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5742
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5843

44+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5945
#include "Portenta_H7_TimerInterrupt.h"
46+
47+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
6048
#include "Portenta_H7_ISR_Timer.h"
6149

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

examples/PWM/PWM_Multi/PWM_Multi.ino

+1-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015
/*
3116
In cores/arduino/stm32/PeripheralPins.h => #define PinMap_PWM PinMap_TIM
@@ -131,6 +116,7 @@
131116
#error For Portenta_H7 only
132117
#endif
133118

119+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
134120
#include "Portenta_H7_TimerInterrupt.h"
135121

136122
#define LED_ON LOW

examples/PWM/PWM_Multi_Args/PWM_Multi_Args.ino

+1-17
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015

3116
/*
@@ -128,12 +113,11 @@
128113
*/
129114
//
130115

131-
132-
133116
#if !( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
134117
#error For Portenta_H7 only
135118
#endif
136119

120+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
137121
#include "Portenta_H7_TimerInterrupt.h"
138122

139123
#define LED_ON LOW

examples/SwitchDebounce/SwitchDebounce.ino

+1-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015
/*
3116
Notes:
@@ -54,6 +39,7 @@
5439
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5540
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5641

42+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5743
#include "Portenta_H7_TimerInterrupt.h"
5844

5945
#define LED_OFF HIGH

examples/TimerInterruptLEDDemo/TimerInterruptLEDDemo.ino

+3-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015

3116
/*
@@ -49,7 +34,10 @@
4934
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
5035
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5136

37+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5238
#include "Portenta_H7_TimerInterrupt.h"
39+
40+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
5341
#include "Portenta_H7_ISR_Timer.h"
5442

5543
#define LED_OFF HIGH

examples/TimerInterruptTest/TimerInterruptTest.ino

+1-15
Original file line numberDiff line numberDiff line change
@@ -11,21 +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.1
23-
24-
Version Modified By Date Comments
25-
------- ----------- ---------- -----------
26-
1.2.1 K.Hoang 15/09/2021 Initial coding for Portenta_H7
27-
1.3.0 K.Hoang 17/09/2021 Add PWM features and examples
28-
1.3.1 K.Hoang 21/09/2021 Fix warnings in PWM examples
2914
*****************************************************************************************************************************/
3015
/*
3116
Notes:
@@ -48,6 +33,7 @@
4833
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
4934
#define _TIMERINTERRUPT_LOGLEVEL_ 4
5035

36+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
5137
#include "Portenta_H7_TimerInterrupt.h"
5238

5339
#define LED_OFF HIGH
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.cpp
3+
For Portenta_H7 boards
4+
Written by Khoi Hoang
5+
6+
Built by Khoi Hoang https://github.com/khoih-prog/Portenta_H7_TimerInterrupt
7+
Licensed under MIT license
8+
9+
Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by
10+
unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks.
11+
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
12+
Therefore, their executions are not blocked by bad-behaving functions / tasks.
13+
This important feature is absolutely necessary for mission-critical tasks.
14+
*****************************************************************************************************************************/
15+
16+
// To demo how to include files in multi-file Projects
17+
18+
#include "multiFileProject.h"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/****************************************************************************************************************************
2+
multiFileProject.h
3+
For Portenta_H7 boards
4+
Written by Khoi Hoang
5+
6+
Built by Khoi Hoang https://github.com/khoih-prog/Portenta_H7_TimerInterrupt
7+
Licensed under MIT license
8+
9+
Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by
10+
unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks.
11+
The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers
12+
Therefore, their executions are not blocked by bad-behaving functions / tasks.
13+
This important feature is absolutely necessary for mission-critical tasks.
14+
*****************************************************************************************************************************/
15+
16+
// To demo how to include files in multi-file Projects
17+
18+
#pragma once
19+
20+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
21+
//#include "Portenta_H7_TimerInterrupt.h"
22+
23+
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
24+
#include "Portenta_H7_ISR_Timer.hpp"

0 commit comments

Comments
 (0)