You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 29, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+29-5
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
15
15
Please ensure to specify the following:
16
16
17
17
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
18
-
*`STM32` Core Version (e.g. STM32 core v2.2.0)
18
+
*`STM32` Core Version (e.g. STM32 core v2.3.0)
19
19
* Contextual information (e.g. what you were trying to achieve)
20
20
* Simplest possible steps to reproduce
21
21
* Anything that might be relevant in your opinion, such as:
@@ -27,26 +27,50 @@ Please ensure to specify the following:
27
27
28
28
```
29
29
Arduino IDE version: 1.8.19
30
-
STM32 Core Version 2.2.0
30
+
STM32 Core Version 2.3.0
31
31
OS: Ubuntu 20.04 LTS
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
32
+
Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
33
33
34
34
Context:
35
-
I encountered a crash while trying to use the Timer Interrupt.
36
-
35
+
I encountered a crash while using this library
37
36
Steps to reproduce:
38
37
1. ...
39
38
2. ...
40
39
3. ...
41
40
4. ...
42
41
```
43
42
43
+
### Additional context
44
+
45
+
Add any other context about the problem here.
46
+
47
+
---
48
+
44
49
### Sending Feature Requests
45
50
46
51
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
47
52
48
53
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/STM32_TimerInterrupt/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
49
54
55
+
---
56
+
50
57
### Sending Pull Requests
51
58
52
59
Pull Requests with changes and fixes are also welcome!
60
+
61
+
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
62
+
63
+
1. Change directory to the library GitHub
64
+
65
+
```
66
+
xy@xy-Inspiron-3593:~$ cd Arduino/xy/STM32_TimerInterrupt_GitHub/
<ahref="https://www.buymeacoffee.com/khoihprog6"target="_blank"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"alt="Buy Me A Coffee"style="height: 60px!important;width: 217px!important;" ></a>
9
+
10
+
<ahref="https://www.buymeacoffee.com/khoihprog6"title="Donate to my libraries using BuyMeACoffee"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"alt="Donate to my libraries using BuyMeACoffee"style="height: 50px!important;width: 181px!important;" ></a>
11
+
<ahref="https://www.buymeacoffee.com/khoihprog6"title="Donate to my libraries using BuyMeACoffee"><imgsrc="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>
@@ -100,17 +105,17 @@ in loop(), using delay() function as an example. The elapsed time then is very u
100
105
101
106
#### Why using ISR-based Hardware Timer Interrupt is better
102
107
103
-
Imagine you have a system with a **mission-critical** function, measuring water level and control the sump pump or doing something much more important. You normally use a software timer to poll, or even place the function in loop(). But what if another function is **blocking** the loop() or setup().
108
+
Imagine you have a system with a **mission-critical** function, measuring water level and control the sump pump or doing something much more important. You normally use a software timer to poll, or even place the function in `loop()`. But what if another function is **blocking** the `loop()` or `setup()`.
104
109
105
110
So your function **might not be executed, and the result would be disastrous.**
106
111
107
112
You'd prefer to have your function called, no matter what happening with other functions (busy loop, bug, etc.).
108
113
109
114
The correct choice is to use a Hardware Timer with **Interrupt** to call your function.
110
115
111
-
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.
116
+
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.
112
117
113
-
Functions using normal software timers, relying on loop() and calling millis(), won't work if the loop() or setup() is blocked by certain operation. For example, certain function is blocking while it's connecting to WiFi or some services.
118
+
Functions using normal software timers, relying on `loop()` and calling `millis()`, won't work if the `loop()` or `setup()` is blocked by certain operation. For example, certain function is blocking while it's connecting to WiFi or some services.
114
119
115
120
The catch is **your function is now part of an ISR (Interrupt Service Routine), and must be lean / mean, and follow certain rules.** More to read on:
116
121
@@ -157,19 +162,16 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
157
162
## Prerequisites
158
163
159
164
1.[`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [](https://github.com/arduino/Arduino/releases/latest)
160
-
2.[`Arduino Core for STM32 v2.2.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
161
-
3.[`Blynk library 1.0.1+`](https://github.com/blynkkk/blynk-library/releases). [](https://github.com/blynkkk/blynk-library/releases/latest/) to use with certain example.
165
+
2.[`Arduino Core for STM32 v2.3.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
166
+
3.[`Blynk library 1.1.0+`](https://github.com/blynkkk/blynk-library/releases). [](https://github.com/blynkkk/blynk-library/releases/latest/) to use with certain example.
162
167
4. For built-in LAN8742A Ethernet:
163
-
-[`STM32Ethernet library v1.2.0+`](https://github.com/stm32duino/STM32Ethernet) for built-in LAN8742A Ethernet on (Nucleo-144, Discovery). [](https://github.com/stm32duino/STM32Ethernet/releases/latest)
168
+
-[`STM32Ethernet library v1.3.0+`](https://github.com/stm32duino/STM32Ethernet) for built-in LAN8742A Ethernet on (Nucleo-144, Discovery). [](https://github.com/stm32duino/STM32Ethernet/releases/latest)
164
169
-[`LwIP library v2.1.2+`](https://github.com/stm32duino/LwIP) for built-in LAN8742A Ethernet on (Nucleo-144, Discovery). [](https://github.com/stm32duino/LwIP/releases/latest)
165
170
5. For W5x00 Ethernet:
166
-
-[`Ethernet library v2.0.0+`](https://github.com/arduino-libraries/Ethernet) for W5100, W5200 and W5500. [](https://github.com/arduino-libraries/Ethernet/releases/latest)
167
-
-[`EthernetLarge library v2.0.0+`](https://github.com/OPEnSLab-OSU/EthernetLarge) for W5100, W5200 and W5500.
168
-
-[`Ethernet2 library v1.0.4+`](https://github.com/khoih-prog/Ethernet2) for W5500. [](https://github.com/adafruit/Ethernet2/releases/latest)
169
-
-[`Ethernet3 library v1.5.5+`](https://github.com/sstaub/Ethernet3) for W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip. [](https://github.com/sstaub/Ethernet3/releases/latest)
171
+
-[`Ethernet_Generic library v2.7.1+`](https://github.com/khoih-prog/Ethernet_Generic) for W5100, W5200 and W5500. [](https://github.com/khoih-prog/Ethernet_Generic/releases/latest)
170
172
6. For ENC28J60 Ethernet:
171
-
-[`EthernetENC library v2.0.2+`](https://github.com/jandrassy/EthernetENC) for ENC28J60. [](https://github.com/jandrassy/EthernetENC/releases/latest). **New and Better**
172
-
-[`UIPEthernet library v2.0.11+`](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60. [](https://github.com/UIPEthernet/UIPEthernet/releases/latest)
173
+
-[`EthernetENC library v2.0.3+`](https://github.com/jandrassy/EthernetENC) for ENC28J60. [](https://github.com/jandrassy/EthernetENC/releases/latest). **New and Better**
174
+
-[`UIPEthernet library v2.0.12+`](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60. [](https://github.com/UIPEthernet/UIPEthernet/releases/latest)
173
175
174
176
7. To use with certain example
175
177
-[`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
3. Install [**STM32_TimerInterrupt** library](https://platformio.org/lib/show/11381/STM32_TimerInterrupt) or [**STM32_TimerInterrupt** library](https://platformio.org/lib/show/11419/STM32_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/11381/STM32_TimerInterrupt/installation). Search for **STM32_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
201
+
3. Install [**STM32_TimerInterrupt** library](https://registry.platformio.org/libraries/khoih-prog/STM32_TimerInterrupt) by using [Library Manager](https://registry.platformio.org/libraries/khoih-prog/STM32_TimerInterrupt/installation). Search for **STM32_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
200
202
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)
201
203
202
204
---
@@ -275,13 +277,13 @@ The current library implementation, using `xyz-Impl.h` instead of standard `xyz.
in many files. But be sure to use the following `#include <STM32_ISR_Timer.h>`**in just 1 `.h`, `.cpp` or `.ino` file**, which must **not be included in any other file**, to avoid `Multiple Definitions` Linker Error
283
285
284
-
```
286
+
```cpp
285
287
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
@@ -324,7 +326,7 @@ To be sure which Timer is available for the board you're using, check the Core P
324
326
325
327
The information will be as follows:
326
328
327
-
```
329
+
```cpp
328
330
typedefstruct
329
331
{
330
332
__IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */
@@ -359,7 +361,7 @@ typedef struct
359
361
360
362
and
361
363
362
-
```
364
+
```cpp
363
365
#definePERIPH_BASE 0x40000000UL /*!< Base address of : AHB/ABP Peripherals
364
366
/*!< Peripheral memory map */
365
367
#defineAPB1PERIPH_BASE PERIPH_BASE
@@ -415,7 +417,7 @@ The `ISR_Timer_Complex` example will demonstrate the nearly perfect accuracy com
415
417
Being ISR-based timers, their executions are not blocked by bad-behaving functions / tasks, such as connecting to WiFi, Internet and Blynk services. You can also have many `(up to 16)` timers to use.
416
418
This non-being-blocked important feature is absolutely necessary for mission-critical tasks.
417
419
You'll see blynkTimer Software is blocked while system is connecting to WiFi / Internet / Blynk, as well as by blocking task
418
-
in loop(), using delay() function as an example. The elapsed time then is very unaccurate
420
+
in `loop()`, using `delay()` function as an example. The elapsed time then is very unaccurate
419
421
420
422
---
421
423
---
@@ -428,14 +430,14 @@ Before using any Timer, you have to make sure the Timer has not been used by any
428
430
429
431
#### 1.1 Init Hardware Timer
430
432
431
-
```
433
+
```cpp
432
434
// Init STM32 timer TIM1
433
435
STM32Timer ITimer0(TIM1);
434
436
```
435
437
436
438
#### 1.2 Set Hardware Timer Interval and attach Timer Interrupt Handler function
437
439
438
-
```
440
+
```cpp
439
441
void TimerHandler0(void)
440
442
{
441
443
// Doing something here inside ISR
@@ -459,7 +461,7 @@ void setup()
459
461
460
462
#### 2.1 Init Hardware Timer and ISR-based Timer
461
463
462
-
```
464
+
```cpp
463
465
// Init STM32 timer TIM1
464
466
STM32Timer ITimer(TIM1);
465
467
@@ -470,7 +472,7 @@ STM32_ISR_Timer ISR_Timer;
470
472
471
473
#### 2.2 Set Hardware Timer Interval and attach Timer Interrupt Handler functions
472
474
473
-
```
475
+
```cpp
474
476
void TimerHandler(void)
475
477
{
476
478
ISR_Timer.run();
@@ -551,7 +553,7 @@ void setup()
551
553
552
554
### Example [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex)
<ahref="https://www.buymeacoffee.com/khoihprog6"title="Donate to my libraries using BuyMeACoffee"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"alt="Donate to my libraries using BuyMeACoffee"style="height: 50px!important;width: 181px!important;" ></a>
11
+
<ahref="https://www.buymeacoffee.com/khoihprog6"title="Donate to my libraries using BuyMeACoffee"><imgsrc="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>
0 commit comments