10 Commits
Author SHA1 Message Date
Khoi Hoang 45c4aca9e9 Update README.md 2022-12-04 21:53:27 -05:00
Khoi Hoang fbac2f8a3b Update changelog.md 2022-12-04 21:53:06 -05:00
Khoi Hoang df10f8d531 Update README.md and use allman astyle 2022-11-18 21:55:30 -05:00
Khoi Hoang f9b2692779 Update .github 2022-11-18 21:54:50 -05:00
Khoi Hoang 7db4a62cb4 Fix Codespell complaints 2022-11-17 21:55:16 -05:00
Khoi Hoang 1dfedfeb81 Add files via upload 2022-11-17 20:48:03 -05:00
Khoi Hoang 511ab8846e Update .github 2022-11-17 19:16:54 -05:00
Khoi Hoang 3414e92753 Add files via upload 2022-11-17 19:16:40 -05:00
Khoi Hoang d238261964 For allman astyle 2022-11-11 18:09:46 -05:00
Khoi Hoang 848a1d5b7e Update platformio.ini for arduino-pico core 2022-11-11 18:09:29 -05:00
18 changed files with 449 additions and 212 deletions
+7
View File
@@ -0,0 +1,7 @@
# See: https://github.com/codespell-project/codespell#using-a-config-file
[codespell]
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
ignore-words-list = ,
check-filenames =
check-hidden =
skip = ./.git,./src,./examples,./Packages_Patches,./LibraryPatches
+34 -4
View File
@@ -36,7 +36,7 @@ If applicable, add screenshots to help explain your problem.
Please ensure to specify the following:
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `RP2040` Core Version (e.g. RP2040 core v2.5.4)
* `RP2040` Core Version (e.g. RP2040 core v2.6.3)
* `RP2040` Board type (e.g. RASPBERRY_PI_PICO, RASPBERRY_PI_PICO_W, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc.)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
@@ -49,14 +49,13 @@ Please ensure to specify the following:
```
Arduino IDE version: 1.8.19
RP2040 core v2.5.4
RP2040 core v2.6.3
RASPBERRY_PI_PICO Module
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
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
Context:
I encountered a crash while using this library
Steps to reproduce:
1. ...
2. ...
@@ -67,3 +66,34 @@ Steps to reproduce:
### Additional context
Add any other context about the problem here.
---
### Sending Feature Requests
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/RPI_PICO_TimerInterrupt/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
---
### Sending Pull Requests
Pull Requests with changes and fixes are also welcome!
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
1. Change directory to the library GitHub
```
xy@xy-Inspiron-3593:~$ cd Arduino/xy/RPI_PICO_TimerInterrupt_GitHub/
xy@xy-Inspiron-3593:~/Arduino/xy/RPI_PICO_TimerInterrupt_GitHub$
```
2. Issue astyle command
```
xy@xy-Inspiron-3593:~/Arduino/xy/RPI_PICO_TimerInterrupt_GitHub$ bash utils/restyle.sh
```
+10
View File
@@ -0,0 +1,10 @@
# See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file
version: 2
updates:
# Configure check for outdated GitHub Actions actions in workflows.
# See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot
- package-ecosystem: github-actions
directory: / # Check the repository's workflows under /.github/workflows/
schedule:
interval: daily
+1 -1
View File
@@ -24,7 +24,7 @@ markComment: >
for your contributions.
unmarkComment: >
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it opening the future.
closeComment: >
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.
+2 -2
View File
@@ -4,8 +4,8 @@ jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install -g bats
+28
View File
@@ -0,0 +1,28 @@
name: Check Arduino
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
pull_request:
schedule:
# Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint.
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Arduino Lint
uses: arduino/arduino-lint-action@v1
with:
compliance: specification
library-manager: update
# Always use this setting for official repositories. Remove for 3rd party projects.
official: true
project-type: library
+16
View File
@@ -0,0 +1,16 @@
name: Report Size Deltas
on:
schedule:
- cron: '*/5 * * * *'
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Comment size deltas reports to PRs
uses: arduino/report-size-deltas@v1
with:
# The name of the workflow artifact created by the "Compile Examples" workflow
sketches-reports-source: sketches-reports
+22
View File
@@ -0,0 +1,22 @@
name: Spell Check
on:
pull_request:
push:
schedule:
# run every Tuesday at 3 AM UTC
- cron: "0 3 * * 2"
workflow_dispatch:
repository_dispatch:
jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# See: https://github.com/codespell-project/actions-codespell/blob/master/README.md
- name: Spell check
uses: codespell-project/actions-codespell@master
+29 -4
View File
@@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `RP2040` Core Version (e.g. RP2040 core v2.5.4)
* `RP2040` Core Version (e.g. RP2040 core v2.6.3)
* `RP2040` Board type (e.g. RASPBERRY_PI_PICO, RASPBERRY_PI_PICO_W, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc.)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
@@ -28,27 +28,52 @@ Please ensure to specify the following:
```
Arduino IDE version: 1.8.19
RP2040 core v2.5.4
RP2040 core v2.6.3
RASPBERRY_PI_PICO Module
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
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
Context:
I encountered a crash while using this library
Steps to reproduce:
1. ...
2. ...
3. ...
4. ...
```
### Additional context
Add any other context about the problem here.
---
### Sending Feature Requests
Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful.
There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/RPI_PICO_TimerInterrupt/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them.
---
### Sending Pull Requests
Pull Requests with changes and fixes are also welcome!
Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux)
1. Change directory to the library GitHub
```
xy@xy-Inspiron-3593:~$ cd Arduino/xy/RPI_PICO_TimerInterrupt_GitHub/
xy@xy-Inspiron-3593:~/Arduino/xy/RPI_PICO_TimerInterrupt_GitHub$
```
2. Issue astyle command
```
xy@xy-Inspiron-3593:~/Arduino/xy/RPI_PICO_TimerInterrupt_GitHub$ bash utils/restyle.sh
```
+16 -9
View File
@@ -6,9 +6,11 @@
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/RPI_PICO_TimerInterrupt.svg)](http://github.com/khoih-prog/RPI_PICO_TimerInterrupt/issues)
<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>
<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>
---
---
@@ -87,7 +89,7 @@ This library enables you to use Interrupt from Hardware Timers on on RP2040-base
As **Hardware Timers are rare, and very precious assets** of any board, this library now enables you to use up to **16 ISR-based Timers, while consuming only 1 Hardware Timer**. Timers' interval is very long (**ulong millisecs**).
Now with these new **16 ISR-based timers**, the maximum interval is **practically unlimited** (limited only by unsigned long miliseconds) while **the accuracy is nearly perfect** compared to software timers.
Now with these new **16 ISR-based timers**, the maximum interval is **practically unlimited** (limited only by unsigned long milliseconds) while **the accuracy is nearly perfect** compared to software timers.
The most important feature is they're ISR-based timers. Therefore, their executions are **not blocked by bad-behaving functions / tasks**. This important feature is absolutely necessary for mission-critical tasks.
@@ -98,11 +100,11 @@ Being ISR-based timers, their executions are not blocked by bad-behaving functio
This non-being-blocked important feature is absolutely necessary for mission-critical tasks.
You'll see blynkTimer Software is blocked while system is connecting to WiFi / Internet / Blynk, as well as by blocking task
in loop(), using delay() function as an example. The elapsed time then is very unaccurate
in `loop()`, using delay() function as an example. The elapsed time then is very unaccurate
### Why using ISR-based Hardware Timer Interrupt is better
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().
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()`.
So your function **might not be executed, and the result would be disastrous.**
@@ -110,14 +112,15 @@ You'd prefer to have your function called, no matter what happening with other f
The correct choice is to use a Hardware Timer with **Interrupt** to call your function.
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.
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.
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.
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.
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:
[**HOWTO Attach Interrupt**](https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/)
---
### Currently supported Boards
@@ -140,9 +143,13 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
## Prerequisites
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)
2. [`Earle Philhower's arduino-pico core v2.5.4+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
3. To use with certain example
- [`SimpleTimer library`](https://github.com/jfturcot/SimpleTimer) for [ISR_Timers_Array_Simple](examples/ISR_Timers_Array_Simple) and [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex) examples.
2. [`Earle Philhower's arduino-pico core v2.6.3+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest)
3. To use with certain example, depending on which Ethernet card you're using:
- [`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)
- [`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**
- [`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)
4. To use with certain example
- [`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.
---
@@ -249,7 +256,7 @@ The RPI_PICO system timer peripheral provides a global microsecond timebase for
---
Now with these new `16 ISR-based timers` (while consuming only **1 hardware timer**), the maximum interval is practically unlimited (limited only by unsigned long miliseconds). The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers Therefore, their executions are not blocked by bad-behaving functions / tasks.
Now with these new `16 ISR-based timers` (while consuming only **1 hardware timer**), the maximum interval is practically unlimited (limited only by unsigned long milliseconds). The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
The `ISR_Timer_Complex` example will demonstrate the nearly perfect accuracy compared to software timers by printing the actual elapsed millisecs of each type of timers.
+5
View File
@@ -6,6 +6,11 @@
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/RPI_PICO_TimerInterrupt.svg)](http://github.com/khoih-prog/RPI_PICO_TimerInterrupt/issues)
<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>
<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>
---
---
+13 -3
View File
@@ -22,6 +22,7 @@
;default_envs = ESP32
;default_envs = SAMD
default_envs = pico
;default_envs = mbed_pico
;default_envs = NRF52
;default_envs = STM32
;default_envs = portenta_h7_m7
@@ -38,7 +39,6 @@ upload_speed = 921600
;monitor_port = COM11
; Checks for the compatibility with frameworks and dev/platforms
; To adjust as necessary
lib_compat_mode = strict
lib_ldf_mode = chain+
;lib_ldf_mode = deep+
@@ -49,7 +49,7 @@ lib_deps =
build_flags =
; set your debug output (default=Serial)
; -D DEBUG_ESP_PORT=Serial
; comment the folowing line to enable WiFi debugging
; comment the following line to enable WiFi debugging
; -D NDEBUG
[env:portenta_h7_m7]
@@ -64,7 +64,17 @@ framework = arduino
[env:pico]
; ============================================================
; Just a sample
; Just a sample for arduino-pice core
; You have to research and fix if there is issue
; ============================================================
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
[env:mbed_pico]
; ============================================================
; Just a sample for mbed_rp2040 and mbed_nano cores
; You have to research and fix if there is issue
; ============================================================
platform = raspberrypi
+1
View File
@@ -181,6 +181,7 @@ int RPI_PICO_ISR_Timer::setupTimer(const float& d, void* f, void* p, bool h, con
}
freeTimer = findFirstFreeSlot();
if (freeTimer < 0)
{
return -1;
+70
View File
@@ -0,0 +1,70 @@
# Code formatting rules for Arduino libraries, modified from for KH libraries:
#
# https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf
#
# astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino
--mode=c
--lineend=linux
--style=allman
# -r or -R
#--recursive
# -c => Converts tabs into spaces
convert-tabs
# -s2 => 2 spaces indentation
--indent=spaces=2
# -t2 => tab =2 spaces
#--indent=tab=2
# -C
--indent-classes
# -S
--indent-switches
# -xW
--indent-preproc-block
# -Y => indent classes, switches (and cases), comments starting at column 1
--indent-col1-comments
# -M120 => maximum of 120 spaces to indent a continuation line
--max-continuation-indent=120
# -xC120 => maxcodelength will break a line if the code exceeds # characters
--max-code-length=120
# -f =>
--break-blocks
# -p => put a space around operators
--pad-oper
# -xg => Insert space padding after commas
--pad-comma
# -H => put a space after if/for/while
pad-header
# -xb => Break one line headers (e.g. if/for/while)
--break-one-line-headers
# -c => Converts tabs into spaces
#--convert-tabs
# if you like one-liners, keep them
#keep-one-line-statements
# -xV
--attach-closing-while
#unpad-paren
# -xp
remove-comment-prefix
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
for dir in . ; do
find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \;
done