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

Commit 23fd55b

Browse files
authored
Update README.md and use allman astyle
1 parent 16c48dd commit 23fd55b

10 files changed

+325
-227
lines changed

CONTRIBUTING.md

+29-5
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-
* `STM32` Core Version (e.g. STM32 core v2.2.0)
18+
* `STM32` Core Version (e.g. STM32 core v2.3.0)
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:
@@ -27,26 +27,50 @@ Please ensure to specify the following:
2727

2828
```
2929
Arduino IDE version: 1.8.19
30-
STM32 Core Version 2.2.0
30+
STM32 Core Version 2.3.0
3131
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
3333
3434
Context:
35-
I encountered a crash while trying to use the Timer Interrupt.
36-
35+
I encountered a crash while using this library
3736
Steps to reproduce:
3837
1. ...
3938
2. ...
4039
3. ...
4140
4. ...
4241
```
4342

43+
### Additional context
44+
45+
Add any other context about the problem here.
46+
47+
---
48+
4449
### Sending Feature Requests
4550

4651
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
4752

4853
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.
4954

55+
---
56+
5057
### Sending Pull Requests
5158

5259
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/
67+
xy@xy-Inspiron-3593:~/Arduino/xy/STM32_TimerInterrupt_GitHub$
68+
```
69+
70+
2. Issue astyle command
71+
72+
```
73+
xy@xy-Inspiron-3593:~/Arduino/xy/STM32_TimerInterrupt_GitHub$ bash utils/restyle.sh
74+
```
75+
76+

README.md

+26-24
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
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/STM32_TimerInterrupt.svg)](http://github.com/khoih-prog/STM32_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+
10+
<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>
11+
<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>
12+
<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>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-STM32_TimerInterrupt/count.svg" title="STM32_TimerInterrupt Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-STM32_TimerInterrupt/count.svg" style="height: 30px;width: 200px;"></a>
14+
1015

1116
---
1217
---
@@ -100,17 +105,17 @@ in loop(), using delay() function as an example. The elapsed time then is very u
100105

101106
#### Why using ISR-based Hardware Timer Interrupt is better
102107

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()`.
104109

105110
So your function **might not be executed, and the result would be disastrous.**
106111

107112
You'd prefer to have your function called, no matter what happening with other functions (busy loop, bug, etc.).
108113

109114
The correct choice is to use a Hardware Timer with **Interrupt** to call your function.
110115

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.
112117

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.
114119

115120
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:
116121

@@ -157,19 +162,16 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
157162
## Prerequisites
158163

159164
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)
160-
2. [`Arduino Core for STM32 v2.2.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32F/L/H/G/WB/MP1 boards. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
161-
3. [`Blynk library 1.0.1+`](https://github.com/blynkkk/blynk-library/releases). [![Latest release](https://img.shields.io/github/release/blynkkk/blynk-library.svg)](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. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)
166+
3. [`Blynk library 1.1.0+`](https://github.com/blynkkk/blynk-library/releases). [![Latest release](https://img.shields.io/github/release/blynkkk/blynk-library.svg)](https://github.com/blynkkk/blynk-library/releases/latest/) to use with certain example.
162167
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). [![GitHub release](https://img.shields.io/github/release/stm32duino/STM32Ethernet.svg)](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). [![GitHub release](https://img.shields.io/github/release/stm32duino/STM32Ethernet.svg)](https://github.com/stm32duino/STM32Ethernet/releases/latest)
164169
- [`LwIP library v2.1.2+`](https://github.com/stm32duino/LwIP) for built-in LAN8742A Ethernet on (Nucleo-144, Discovery). [![GitHub release](https://img.shields.io/github/release/stm32duino/LwIP.svg)](https://github.com/stm32duino/LwIP/releases/latest)
165170
5. For W5x00 Ethernet:
166-
- [`Ethernet library v2.0.0+`](https://github.com/arduino-libraries/Ethernet) for W5100, W5200 and W5500. [![GitHub release](https://img.shields.io/github/release/arduino-libraries/Ethernet.svg)](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. [![GitHub release](https://img.shields.io/github/release/adafruit/Ethernet2.svg)](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. [![GitHub release](https://img.shields.io/github/release/sstaub/Ethernet3.svg)](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. [![GitHub release](https://img.shields.io/github/release/khoih-prog/Ethernet_Generic.svg)](https://github.com/khoih-prog/Ethernet_Generic/releases/latest)
170172
6. For ENC28J60 Ethernet:
171-
- [`EthernetENC library v2.0.2+`](https://github.com/jandrassy/EthernetENC) for ENC28J60. [![GitHub release](https://img.shields.io/github/release/jandrassy/EthernetENC.svg)](https://github.com/jandrassy/EthernetENC/releases/latest). **New and Better**
172-
- [`UIPEthernet library v2.0.11+`](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60. [![GitHub release](https://img.shields.io/github/release/UIPEthernet/UIPEthernet.svg)](https://github.com/UIPEthernet/UIPEthernet/releases/latest)
173+
- [`EthernetENC library v2.0.3+`](https://github.com/jandrassy/EthernetENC) for ENC28J60. [![GitHub release](https://img.shields.io/github/release/jandrassy/EthernetENC.svg)](https://github.com/jandrassy/EthernetENC/releases/latest). **New and Better**
174+
- [`UIPEthernet library v2.0.12+`](https://github.com/UIPEthernet/UIPEthernet) for ENC28J60. [![GitHub release](https://img.shields.io/github/release/UIPEthernet/UIPEthernet.svg)](https://github.com/UIPEthernet/UIPEthernet/releases/latest)
173175

174176
7. To use with certain example
175177
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_16_Timers_Array example](examples/ISR_16_Timers_Array).
@@ -196,7 +198,7 @@ Another way to install is to:
196198

197199
1. Install [VS Code](https://code.visualstudio.com/)
198200
2. Install [PlatformIO](https://platformio.org/platformio-ide)
199-
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)
200202
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)
201203

202204
---
@@ -275,13 +277,13 @@ The current library implementation, using `xyz-Impl.h` instead of standard `xyz.
275277

276278
You can use
277279

278-
```
280+
```cpp
279281
#include <STM32_ISR_Timer.hpp> //https://github.com/khoih-prog/STM32_TimerInterrupt
280282
```
281283

282284
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
283285

284-
```
286+
```cpp
285287
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
286288
#include <STM32_ISR_Timer.h> //https://github.com/khoih-prog/STM32_TimerInterrupt
287289
```
@@ -324,7 +326,7 @@ To be sure which Timer is available for the board you're using, check the Core P
324326

325327
The information will be as follows:
326328

327-
```
329+
```cpp
328330
typedef struct
329331
{
330332
__IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */
@@ -359,7 +361,7 @@ typedef struct
359361

360362
and
361363

362-
```
364+
```cpp
363365
#define PERIPH_BASE 0x40000000UL /*!< Base address of : AHB/ABP Peripherals
364366
/*!< Peripheral memory map */
365367
#define APB1PERIPH_BASE PERIPH_BASE
@@ -415,7 +417,7 @@ The `ISR_Timer_Complex` example will demonstrate the nearly perfect accuracy com
415417
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.
416418
This non-being-blocked important feature is absolutely necessary for mission-critical tasks.
417419
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
419421

420422
---
421423
---
@@ -428,14 +430,14 @@ Before using any Timer, you have to make sure the Timer has not been used by any
428430

429431
#### 1.1 Init Hardware Timer
430432

431-
```
433+
```cpp
432434
// Init STM32 timer TIM1
433435
STM32Timer ITimer0(TIM1);
434436
```
435437
436438
#### 1.2 Set Hardware Timer Interval and attach Timer Interrupt Handler function
437439
438-
```
440+
```cpp
439441
void TimerHandler0(void)
440442
{
441443
// Doing something here inside ISR
@@ -459,7 +461,7 @@ void setup()
459461

460462
#### 2.1 Init Hardware Timer and ISR-based Timer
461463

462-
```
464+
```cpp
463465
// Init STM32 timer TIM1
464466
STM32Timer ITimer(TIM1);
465467

@@ -470,7 +472,7 @@ STM32_ISR_Timer ISR_Timer;
470472
471473
#### 2.2 Set Hardware Timer Interval and attach Timer Interrupt Handler functions
472474
473-
```
475+
```cpp
474476
void TimerHandler(void)
475477
{
476478
ISR_Timer.run();
@@ -551,7 +553,7 @@ void setup()
551553

552554
### Example [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex)
553555

554-
```
556+
```cpp
555557
#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
556558
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
557559
defined(STM32WB) || defined(STM32MP1) || defined(STM32L5) )

changelog.md

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
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/STM32_TimerInterrupt.svg)](http://github.com/khoih-prog/STM32_TimerInterrupt/issues)
88

9+
10+
<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>
11+
<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>
12+
<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>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-STM32_TimerInterrupt/count.svg" title="STM32_TimerInterrupt Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-STM32_TimerInterrupt/count.svg" style="height: 30px;width: 200px;"></a>
14+
15+
916
---
1017
---
1118

platformio/platformio.ini

+4-17
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,14 @@ upload_speed = 921600
2828

2929
; Checks for the compatibility with frameworks and dev/platforms
3030
lib_compat_mode = strict
31+
lib_ldf_mode = chain+
32+
;lib_ldf_mode = deep+
3133

3234
lib_deps =
3335
; PlatformIO 4.x
34-
; STM32duino LwIP@~2.1.2
35-
; STM32duino STM32Ethernet@~1.2.0
36-
; UIPEthernet@~2.0.8
37-
; Ethernet@>=2.0.0
38-
; EthernetLarge@>=2.0.0
39-
; Ethernet2@>=1.0.4
40-
; Ethernet3@>=1.5.5
41-
; EthernetENC@>=2.0.2
36+
4237
; PlatformIO 5.x
43-
stm32duino/STM32duino LwIP@~2.1.2
44-
stm32duino/STM32duino STM32Ethernet@~1.2.0
45-
UIPEthernet/UIPEthernet@~2.0.8
46-
PaulStoffregen/Ethernet@>=2.0.0
47-
PaulStoffregen/EthernetLarge@>=2.0.0
48-
adafruit/Ethernet2@>=1.0.4
49-
sstaub/Ethernet3@>=1.5.5
50-
jandrassy/EthernetENC@>=2.0.2
51-
38+
5239
build_flags =
5340
; set your build_flags
5441

0 commit comments

Comments
 (0)