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

Commit 64a5b1e

Browse files
authored
v1.6.0 to suppress errors and warnings
### Releases v1.6.0 1. Suppress errors and warnings for new ESP32 core v2.0.4+
1 parent 06ea22b commit 64a5b1e

12 files changed

+96
-224
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 4 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-
* `ESP32` Core Version (e.g. ESP32 core v2.0.2)
18+
* `ESP32` Core Version (e.g. ESP32 core v2.0.4)
1919
* `ESP32-C3` Board type (e.g. ESP32C3_DEV Module, etc.)
2020
* Contextual information (e.g. what you were trying to achieve)
2121
* Simplest possible steps to reproduce
@@ -28,10 +28,10 @@ Please ensure to specify the following:
2828

2929
```
3030
Arduino IDE version: 1.8.19
31-
ESP32 Core Version v2.0.2
32-
ESP32S2_DEV Module
31+
ESP32 Core Version v2.0.4
32+
ESP32C3_DEV Module
3333
OS: Ubuntu 20.04 LTS
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
34+
Linux xy-Inspiron-3593 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3535
3636
Context:
3737
I encountered a crash while using TimerInterrupt.
@@ -52,3 +52,4 @@ There are usually some outstanding feature requests in the [existing issues list
5252
### Sending Pull Requests
5353

5454
Pull Requests with changes and fixes are also welcome!
55+

README.md

Lines changed: 19 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
77
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/ESP32_C3_TimerInterrupt.svg)](http://github.com/khoih-prog/ESP32_C3_TimerInterrupt/issues)
88

9-
<a href="https://www.buymeacoffee.com/khoihprog6" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
9+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
10+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
1011

1112
---
1213
---
@@ -128,7 +129,7 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
128129
## Prerequisites
129130

130131
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)
131-
2. [`ESP32 Core 2.0.2+`](https://github.com/espressif/arduino-esp32) for ESP32-S2-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
132+
2. [`ESP32 Core 2.0.4+`](https://github.com/espressif/arduino-esp32) for ESP32-S2-based boards. [![Latest release](https://img.shields.io/github/release/espressif/arduino-esp32.svg)](https://github.com/espressif/arduino-esp32/releases/latest/)
132133
3. To use with certain example
133134
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array](examples/ISR_16_Timers_Array) and [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex) examples.
134135

@@ -156,7 +157,7 @@ Another way to install is to:
156157

157158
1. Install [VS Code](https://code.visualstudio.com/)
158159
2. Install [PlatformIO](https://platformio.org/platformio-ide)
159-
3. Install [**ESP32_C3_TimerInterrupt** library](https://platformio.org/lib/show/12622/ESP32_C3_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/12622/ESP32_C3_TimerInterrupt/installation). Search for **ESP32_C3_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
160+
3. Install [**ESP32_C3_TimerInterrupt** library](https://registry.platformio.org/libraries/khoih-prog/ESP32_C3_TimerInterrupt) by using [Library Manager](https://registry.platformio.org/libraries/khoih-prog/ESP32_C3_TimerInterrupt/installation). Search for **ESP32_C3_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
160161
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)
161162

162163

@@ -343,144 +344,8 @@ void setup()
343344

344345
### Example [TimerInterruptTest](examples/TimerInterruptTest)
345346

346-
```
347-
#if !( ARDUINO_ESP32C3_DEV )
348-
#error This code is intended to run on the ESP32_C3 platform! Please check your Tools->Board setting.
349-
#endif
350-
351-
// These define's must be placed at the beginning before #include "TimerInterrupt_Generic.h"
352-
// _TIMERINTERRUPT_LOGLEVEL_ from 0 to 4
353-
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
354-
#define TIMER_INTERRUPT_DEBUG 0
355-
#define _TIMERINTERRUPT_LOGLEVEL_ 4
356-
357-
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
358-
#include "ESP32_C3_TimerInterrupt.h"
359-
360-
#ifndef LED_BUILTIN
361-
#define LED_BUILTIN 2 // Pin D2 mapped to pin GPIO2/ADC12 of ESP32, control on-board LED
362-
#endif
347+
https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/06ea22be5dd44b06b3778b6c999eb845294334cc/examples/TimerInterruptTest/TimerInterruptTest.ino#L40-L175
363348

364-
// Don't use PIN_D1 in core v2.0.0 and v2.0.1. Check https://github.com/espressif/arduino-esp32/issues/5868
365-
#define PIN_D2 2 // Pin D2 mapped to pin GPIO2/ADC12/TOUCH2/LED_BUILTIN of ESP32
366-
#define PIN_D3 3 // Pin D3 mapped to pin GPIO3/RX0 of ESP32
367-
368-
// With core v2.0.0+, you can't use Serial.print/println in ISR or crash.
369-
// and you can't use float calculation inside ISR
370-
// Only OK in core v1.0.6-
371-
bool IRAM_ATTR TimerHandler0(void * timerNo)
372-
{
373-
static bool toggle0 = false;
374-
375-
//timer interrupt toggles pin LED_BUILTIN
376-
digitalWrite(LED_BUILTIN, toggle0);
377-
toggle0 = !toggle0;
378-
379-
return true;
380-
}
381-
382-
bool IRAM_ATTR TimerHandler1(void * timerNo)
383-
{
384-
static bool toggle1 = false;
385-
386-
//timer interrupt toggles outputPin
387-
digitalWrite(PIN_D3, toggle1);
388-
toggle1 = !toggle1;
389-
390-
return true;
391-
}
392-
393-
#define TIMER0_INTERVAL_MS 1000
394-
#define TIMER0_DURATION_MS 5000
395-
396-
#define TIMER1_INTERVAL_MS 3000
397-
#define TIMER1_DURATION_MS 15000
398-
399-
// Init ESP32 timer 0 and 1
400-
ESP32Timer ITimer0(0);
401-
ESP32Timer ITimer1(1);
402-
403-
void setup()
404-
{
405-
pinMode(LED_BUILTIN, OUTPUT);
406-
pinMode(PIN_D3, OUTPUT);
407-
408-
Serial.begin(115200);
409-
while (!Serial);
410-
411-
delay(100);
412-
413-
Serial.print(F("\nStarting TimerInterruptTest on ")); Serial.println(ARDUINO_BOARD);
414-
Serial.println(ESP32_C3_TIMER_INTERRUPT_VERSION);
415-
Serial.print(F("CPU Frequency = ")); Serial.print(F_CPU / 1000000); Serial.println(F(" MHz"));
416-
417-
// Using ESP32 => 80 / 160 / 240MHz CPU clock ,
418-
// For 64-bit timer counter
419-
// For 16-bit timer prescaler up to 1024
420-
421-
// Interval in microsecs
422-
if (ITimer0.attachInterruptInterval(TIMER0_INTERVAL_MS * 1000, TimerHandler0))
423-
{
424-
Serial.print(F("Starting ITimer0 OK, millis() = ")); Serial.println(millis());
425-
}
426-
else
427-
Serial.println(F("Can't set ITimer0. Select another freq. or timer"));
428-
429-
// Interval in microsecs
430-
if (ITimer1.attachInterruptInterval(TIMER1_INTERVAL_MS * 1000, TimerHandler1))
431-
{
432-
Serial.print(F("Starting ITimer1 OK, millis() = ")); Serial.println(millis());
433-
}
434-
else
435-
Serial.println(F("Can't set ITimer1. Select another freq. or timer"));
436-
437-
Serial.flush();
438-
}
439-
440-
void loop()
441-
{
442-
static unsigned long lastTimer0 = 0;
443-
static unsigned long lastTimer1 = 0;
444-
445-
static bool timer0Stopped = false;
446-
static bool timer1Stopped = false;
447-
448-
if (millis() - lastTimer0 > TIMER0_DURATION_MS)
449-
{
450-
lastTimer0 = millis();
451-
452-
if (timer0Stopped)
453-
{
454-
Serial.print(F("Start ITimer0, millis() = ")); Serial.println(millis());
455-
ITimer0.restartTimer();
456-
}
457-
else
458-
{
459-
Serial.print(F("Stop ITimer0, millis() = ")); Serial.println(millis());
460-
ITimer0.stopTimer();
461-
}
462-
timer0Stopped = !timer0Stopped;
463-
}
464-
465-
if (millis() - lastTimer1 > TIMER1_DURATION_MS)
466-
{
467-
lastTimer1 = millis();
468-
469-
if (timer1Stopped)
470-
{
471-
Serial.print(F("Start ITimer1, millis() = ")); Serial.println(millis());
472-
ITimer1.restartTimer();
473-
}
474-
else
475-
{
476-
Serial.print(F("Stop ITimer1, millis() = ")); Serial.println(millis());
477-
ITimer1.stopTimer();
478-
}
479-
480-
timer1Stopped = !timer1Stopped;
481-
}
482-
}
483-
```
484349
---
485350
---
486351

@@ -492,7 +357,7 @@ The following is the sample terminal output when running example [ISR_16_Timers_
492357

493358
```
494359
Starting ISR_16_Timers_Array_Complex on ESP32C3_DEV
495-
ESP32_C3_TimerInterrupt v1.5.0
360+
ESP32_C3_TimerInterrupt v1.6.0
496361
CPU Frequency = 160 MHz
497362
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 1, TIM_CLOCK_FREQ = 1000000.00
498363
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -646,7 +511,7 @@ The following is the sample terminal output when running example [TimerInterrupt
646511

647512
```
648513
Starting TimerInterruptTest on ESP32C3_DEV
649-
ESP32_C3_TimerInterrupt v1.5.0
514+
ESP32_C3_TimerInterrupt v1.6.0
650515
CPU Frequency = 160 MHz
651516
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 0, TIM_CLOCK_FREQ = 1000000.00
652517
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -679,7 +544,7 @@ The following is the sample terminal output when running example [Change_Interva
679544

680545
```
681546
Starting Change_Interval on ESP32C3_DEV
682-
ESP32_C3_TimerInterrupt v1.5.0
547+
ESP32_C3_TimerInterrupt v1.6.0
683548
CPU Frequency = 160 MHz
684549
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 0, TIM_CLOCK_FREQ = 1000000.00
685550
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -717,7 +582,7 @@ The following is the sample terminal output when running example [Argument_None]
717582

718583
```
719584
Starting Argument_None on ESP32C3_DEV
720-
ESP32_C3_TimerInterrupt v1.5.0
585+
ESP32_C3_TimerInterrupt v1.6.0
721586
CPU Frequency = 160 MHz
722587
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 0, TIM_CLOCK_FREQ = 1000000.00
723588
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -775,16 +640,16 @@ Submit issues to: [ESP32_C3_TimerInterrupt issues](https://github.com/khoih-prog
775640

776641
## DONE
777642

778-
1. Basic hardware timers for ESP32_C3.
779-
2. More hardware-initiated software-enabled timers
780-
3. Longer time interval
781-
4. Similar features for remaining Arduino boards such as SAMD21, SAMD51, SAM-DUE, nRF52, ESP8266, STM32, etc.
782-
5. Fix compiler errors due to conflict to some libraries.
783-
6. Add complex examples.
784-
7. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories
785-
8. Avoid deprecated functions.
786-
9. Optimize library code by using `reference-passing` instead of `value-passing`
787-
643+
1. Basic hardware timers for ESP32_C3.
644+
2. More hardware-initiated software-enabled timers
645+
3. Longer time interval
646+
4. Similar features for remaining Arduino boards such as SAMD21, SAMD51, SAM-DUE, nRF52, ESP8266, STM32, etc.
647+
5. Fix compiler errors due to conflict to some libraries.
648+
6. Add complex examples.
649+
7. Fix `multiple-definitions` linker error. Drop `src_cpp` and `src_h` directories
650+
8. Avoid deprecated functions.
651+
9. Optimize library code by using `reference-passing` instead of `value-passing`
652+
10. Suppress errors and warnings for new ESP32 core v2.0.4+
788653

789654
---
790655
---

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
## Table of Contents
1414

1515
* [Changelog](#changelog)
16+
* [Releases v1.6.0](#releases-v160)
1617
* [Releases v1.5.0](#releases-v150)
1718
* [Releases v1.4.0](#releases-v140)
1819

@@ -21,6 +22,10 @@
2122

2223
## Changelog
2324

25+
### Releases v1.6.0
26+
27+
1. Suppress errors and warnings for new ESP32 core v2.0.4+
28+
2429
### Releases v1.5.0
2530

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

examples/Argument_None/Argument_None.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
bool IRAM_ATTR TimerHandler0(void * timerNo)
6060
{
6161
static bool toggle0 = false;
62-
static bool started = false;
6362

6463
//timer interrupt toggles pin LED_BUILTIN
6564
digitalWrite(LED_BUILTIN, toggle0);
@@ -71,7 +70,6 @@ bool IRAM_ATTR TimerHandler0(void * timerNo)
7170
bool IRAM_ATTR TimerHandler1(void * timerNo)
7271
{
7372
static bool toggle1 = false;
74-
static bool started = false;
7573

7674
//timer interrupt toggles outputPin
7775
digitalWrite(PIN_D1, toggle1);

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ESP32_C3_TimerInterrupt",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"keywords": "timing, device, control, timer, interrupt, timer-interrupt, hardware, isr, isr-based, hardware-timer, isr-timer, isr-based-timer, mission-critical, accuracy, precise, non-blocking, esp32, esp32-c3",
55
"description": "This library enables you to use Interrupt from Hardware Timers on an ESP32-C3-based board. 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=ESP32_C3_TimerInterrupt
2-
version=1.5.0
2+
version=1.6.0
33
author=Khoi Hoang <khoih.prog@gmail.com>
44
maintainer=Khoi Hoang <khoih.prog@gmail.com>
55
sentence=This library enables you to use Interrupt from Hardware Timers on an ESP32-C3-based board

platformio/platformio.ini

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

2828
; Checks for the compatibility with frameworks and dev/platforms
2929
lib_compat_mode = strict
30+
lib_ldf_mode = chain+
31+
;lib_ldf_mode = deep+
3032

3133
lib_deps =
3234

src/ESP32_C3_ISR_Timer-Impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
Based on BlynkTimer.h
2525
Author: Volodymyr Shymanskyy
2626
27-
Version: 1.5.0
27+
Version: 1.6.0
2828
2929
Version Modified By Date Comments
3030
------- ----------- ---------- -----------
3131
1.4.0 K Hoang 29/07/2021 Initial coding. Sync with ESP32_S2_TimerInterrupt v1.4.0
3232
1.5.0 K.Hoang 23/01/2022 Avoid deprecated functions. Fix `multiple-definitions` linker error
33+
1.6.0 K Hoang 10/08/2022 Suppress errors and warnings for new ESP32 core
3334
*****************************************************************************************************************************/
3435

3536
#pragma once

src/ESP32_C3_ISR_Timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
Based on BlynkTimer.h
2525
Author: Volodymyr Shymanskyy
2626
27-
Version: 1.5.0
27+
Version: 1.6.0
2828
2929
Version Modified By Date Comments
3030
------- ----------- ---------- -----------
3131
1.4.0 K Hoang 29/07/2021 Initial coding. Sync with ESP32_S2_TimerInterrupt v1.4.0
3232
1.5.0 K.Hoang 23/01/2022 Avoid deprecated functions. Fix `multiple-definitions` linker error
33+
1.6.0 K Hoang 10/08/2022 Suppress errors and warnings for new ESP32 core
3334
*****************************************************************************************************************************/
3435

3536
#pragma once

src/ESP32_C3_ISR_Timer.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
Based on BlynkTimer.h
2525
Author: Volodymyr Shymanskyy
2626
27-
Version: 1.5.0
27+
Version: 1.6.0
2828
2929
Version Modified By Date Comments
3030
------- ----------- ---------- -----------
3131
1.4.0 K Hoang 29/07/2021 Initial coding. Sync with ESP32_S2_TimerInterrupt v1.4.0
3232
1.5.0 K.Hoang 23/01/2022 Avoid deprecated functions. Fix `multiple-definitions` linker error
33+
1.6.0 K Hoang 10/08/2022 Suppress errors and warnings for new ESP32 core
3334
*****************************************************************************************************************************/
3435

3536
#pragma once
@@ -42,13 +43,13 @@
4243
#endif
4344

4445
#ifndef ESP32_C3_TIMER_INTERRUPT_VERSION
45-
#define ESP32_C3_TIMER_INTERRUPT_VERSION "ESP32_C3_TimerInterrupt v1.5.0"
46+
#define ESP32_C3_TIMER_INTERRUPT_VERSION "ESP32_C3_TimerInterrupt v1.6.0"
4647

4748
#define ESP32_C3_TIMER_INTERRUPT_VERSION_MAJOR 1
48-
#define ESP32_C3_TIMER_INTERRUPT_VERSION_MINOR 5
49+
#define ESP32_C3_TIMER_INTERRUPT_VERSION_MINOR 6
4950
#define ESP32_C3_TIMER_INTERRUPT_VERSION_PATCH 0
5051

51-
#define ESP32_C3_TIMER_INTERRUPT_VERSION_INT 1005000
52+
#define ESP32_C3_TIMER_INTERRUPT_VERSION_INT 1006000
5253
#endif
5354

5455
#include "TimerInterrupt_Generic_Debug.h"
@@ -129,7 +130,7 @@ class ESP32_ISR_Timer
129130
int setTimer(const unsigned long& d, timer_callback_p f, void* p, const unsigned& n);
130131

131132
// updates interval of the specified timer
132-
bool changeInterval(unsigned numTimer, const unsigned long& d);
133+
bool changeInterval(const unsigned &numTimer, const unsigned long& d);
133134

134135
// destroy the specified timer
135136
void deleteTimer(const unsigned& numTimer);

0 commit comments

Comments
 (0)