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

Commit 6fe9817

Browse files
authored
v1.8.0 fixes doubling time bug
### Releases v1.8.0 1. Fix doubled time for `ESP32_C3`. Check [Error in the value defined by TIMER0_INTERVAL_MS #28](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/issues/28) 2. Modify examples to avoid using `LED_BUILTIN` / `GPIO2`, `GPIO1` as it can cause crash in some boards, such as `ESP32_C3` 3. Use `allman astyle` and add `utils`
1 parent c593e91 commit 6fe9817

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

README.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/ESP32_C3_TimerInterrupt.svg?)](https://www.ardu-badge.com/ESP32_C3_TimerInterrupt)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/ESP32_C3_TimerInterrupt.svg)](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/releases)
5-
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/master/LICENSE)
5+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/main/LICENSE)
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

99
<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>
1010
<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>
11+
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
12+
<a href="https://profile-counter.glitch.me/khoih-prog-ESP32_C3_TimerInterrupt/count.svg" title="ESP32_C3_TimerInterrupt Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-ESP32_C3_TimerInterrupt/count.svg" style="height: 30px;width: 200px;"></a>
1113

1214
---
1315
---
@@ -130,7 +132,7 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
130132
## Prerequisites
131133

132134
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)
133-
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/)
135+
2. [`ESP32 Core 2.0.5+`](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/)
134136
3. To use with certain example
135137
- [`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.
136138

@@ -150,9 +152,9 @@ You can also use this link [![arduino-library-badge](https://www.ardu-badge.com/
150152
Another way to install is to:
151153

152154
1. Navigate to [**ESP32_C3_TimerInterrupt**](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt) page.
153-
2. Download the latest release `ESP32_C3_TimerInterrupt-master.zip`.
154-
3. Extract the zip file to `ESP32_C3_TimerInterrupt-master` directory
155-
4. Copy whole `ESP32_C3_TimerInterrupt-master` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
155+
2. Download the latest release `ESP32_C3_TimerInterrupt-main.zip`.
156+
3. Extract the zip file to `ESP32_C3_TimerInterrupt-main` directory
157+
4. Copy whole `ESP32_C3_TimerInterrupt-main` folder to Arduino libraries' directory such as `~/Arduino/libraries/`.
156158

157159
### VS Code & PlatformIO
158160

@@ -175,13 +177,13 @@ In Platform IO, to fix the error when using [`LittleFS_esp32 v1.0`](https://gith
175177

176178
from
177179

178-
```
180+
```cpp
179181
//#define CONFIG_LITTLEFS_FOR_IDF_3_2 /* For old IDF - like in release 1.0.4 */
180182
```
181183

182184
to
183185

184-
```
186+
```cpp
185187
#define CONFIG_LITTLEFS_FOR_IDF_3_2 /* For old IDF - like in release 1.0.4 */
186188
```
187189
@@ -198,7 +200,7 @@ The current library implementation, using `xyz-Impl.h` instead of standard `xyz.
198200
199201
You can include these `.hpp` or `.h` files
200202
201-
```
203+
```cpp
202204
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
203205
#include "ESP32_C3_TimerInterrupt.h" //https://github.com/khoih-prog/ESP32_C3_TimerInterrupt
204206
@@ -208,7 +210,7 @@ You can include these `.hpp` or `.h` files
208210

209211
in many files. But be sure to use the following `.h` file **in just 1 `.h`, `.cpp` or `.ino` file**, which must **not be included in any other file**, to avoid `Multiple Definitions` Linker Error
210212

211-
```
213+
```cpp
212214
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
213215
#include "ESP32_C3_ISR_Timer.h" //https://github.com/khoih-prog/ESP32_C3_TimerInterrupt
214216
```
@@ -226,33 +228,33 @@ Please have a look at [**ESP_WiFiManager Issue 39: Not able to read analog port
226228

227229
#### 2. ESP32 ADCs functions
228230

229-
- ADC1 controls ADC function for pins **GPIO32-GPIO39**
230-
- ADC2 controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
231+
- `ADC1` controls ADC function for pins **GPIO32-GPIO39**
232+
- `ADC2` controls ADC function for pins **GPIO0, 2, 4, 12-15, 25-27**
231233

232234
#### 3.. ESP32 WiFi uses ADC2 for WiFi functions
233235

234-
Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master/components/driver/adc_common.c#L61)
236+
Look in file [**adc_common.c**](https://github.com/espressif/esp-idf/blob/master/components/driver/adc_common.c)
235237

236-
> In ADC2, there're two locks used for different cases:
238+
> In `ADC2`, there're two locks used for different cases:
237239
> 1. lock shared with app and Wi-Fi:
238240
> ESP32:
239-
> When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed.
241+
> When Wi-Fi using the `ADC2`, we assume it will never stop, so app checks the lock and returns immediately if failed.
240242
> ESP32S2:
241243
> The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
242244
>
243245
> 2. lock shared between tasks:
244-
> when several tasks sharing the ADC2, we want to guarantee
246+
> when several tasks sharing the `ADC2`, we want to guarantee
245247
> all the requests will be handled.
246248
> Since conversions are short (about 31us), app returns the lock very soon,
247249
> we use a spinlock to stand there waiting to do conversions one by one.
248250
>
249251
> adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
250252
251253

252-
- In order to use ADC2 for other functions, we have to **acquire complicated firmware locks and very difficult to do**
253-
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
254-
- Use ADC1, and pins GPIO32-GPIO39
255-
- If somehow it's a must to use those pins serviced by ADC2 (**GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27**), use the **fix mentioned at the end** of [**ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example**](https://github.com/khoih-prog/ESP_WiFiManager/issues/39) to work with ESP32 WiFi/BlueTooth (BT/BLE).
254+
- In order to use `ADC2` for other functions, we have to **acquire complicated firmware locks and very difficult to do**
255+
- So, it's not advisable to use `ADC2` with WiFi/BlueTooth (BT/BLE).
256+
- Use `ADC1`, and pins `GPIO32-GPIO39`
257+
- If somehow it's a must to use those pins serviced by `ADC2` (**GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27**), use the **fix mentioned at the end** of [**ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example**](https://github.com/khoih-prog/ESP_WiFiManager/issues/39) to work with ESP32 WiFi/BlueTooth (BT/BLE).
256258

257259
---
258260
---
@@ -288,7 +290,7 @@ Before using any Timer, you have to make sure the Timer has not been used by any
288290

289291
Using as follows:
290292

291-
```
293+
```cpp
292294
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
293295
#include "ESP32_C3_TimerInterrupt.h"
294296

@@ -345,7 +347,7 @@ void setup()
345347
346348
### Example [TimerInterruptTest](examples/TimerInterruptTest)
347349
348-
https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/10918f2620be6786c6d8b9447ce4e93ed2c90928/examples/TimerInterruptTest/TimerInterruptTest.ino#L40-L171
350+
https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/c593e912cd7a5c0d48b08cde15704aa916c1b1b9/examples/TimerInterruptTest/TimerInterruptTest.ino#L40-L179
349351
350352
---
351353
---
@@ -358,7 +360,7 @@ The following is the sample terminal output when running example [ISR_16_Timers_
358360
359361
```
360362
Starting ISR_16_Timers_Array_Complex on ESP32C3_DEV
361-
ESP32_C3_TimerInterrupt v1.7.0
363+
ESP32_C3_TimerInterrupt v1.8.0
362364
CPU Frequency = 160 MHz
363365
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 1, TIM_CLOCK_FREQ = 1000000.00
364366
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -512,7 +514,7 @@ The following is the sample terminal output when running example [TimerInterrupt
512514
513515
```
514516
Starting TimerInterruptTest on ESP32C3_DEV
515-
ESP32_C3_TimerInterrupt v1.7.0
517+
ESP32_C3_TimerInterrupt v1.8.0
516518
CPU Frequency = 160 MHz
517519
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 0, TIM_CLOCK_FREQ = 1000000.00
518520
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -545,7 +547,7 @@ The following is the sample terminal output when running example [Change_Interva
545547
546548
```
547549
Starting Change_Interval on ESP32C3_DEV
548-
ESP32_C3_TimerInterrupt v1.7.0
550+
ESP32_C3_TimerInterrupt v1.8.0
549551
CPU Frequency = 160 MHz
550552
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 0, TIM_CLOCK_FREQ = 1000000.00
551553
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -583,7 +585,7 @@ The following is the sample terminal output when running example [Argument_None]
583585
584586
```
585587
Starting Argument_None on ESP32C3_DEV
586-
ESP32_C3_TimerInterrupt v1.7.0
588+
ESP32_C3_TimerInterrupt v1.8.0
587589
CPU Frequency = 160 MHz
588590
[TISR] ESP32_C3_TimerInterrupt: _timerNo = 0, TIM_CLOCK_FREQ = 1000000.00
589591
[TISR] TIMER_BASE_CLK = 80000000, TIMER_DIVIDER = 80
@@ -653,6 +655,9 @@ Submit issues to: [ESP32_C3_TimerInterrupt issues](https://github.com/khoih-prog
653655
10. Suppress errors and warnings for new ESP32 core v2.0.4+
654656
11. Add support to
655657
- ESP32_C3 : LOLIN_C3_MINI, DFROBOT_BEETLE_ESP32_C3, ADAFRUIT_QTPY_ESP32C3, AirM2M_CORE_ESP32C3, XIAO_ESP32C3
658+
12. Use `allman astyle` and add `utils`
659+
660+
656661

657662
---
658663
---
@@ -676,12 +681,12 @@ If you want to contribute to this project:
676681

677682
### License
678683

679-
- The library is licensed under [MIT](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/master/LICENSE)
684+
- The library is licensed under [MIT](https://github.com/khoih-prog/ESP32_C3_TimerInterrupt/blob/main/LICENSE)
680685

681686
---
682687

683688
## Copyright
684689

685-
Copyright 2021- Khoi Hoang
690+
Copyright (C) 2021- Khoi Hoang
686691

687692

0 commit comments

Comments
 (0)