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

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
### Releases v1.1.1

1. Add example [**Change_Interval**](examples/Change_Interval)
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.
  • Loading branch information
khoih-prog authored Dec 6, 2020
1 parent 5ec7c85 commit 63d2dc3
Show file tree
Hide file tree
Showing 21 changed files with 147 additions and 51 deletions.
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
62 changes: 52 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
---
---

### Releases v1.1.1

1. Add example [**Change_Interval**](examples/Change_Interval)
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.

### Releases v1.0.2

1. Add example [**ISR_16_Timers_Array_Complex**](examples/ISR_16_Timers_Array_Complex) and optimize example [**ISR_16_Timers_Array**](examples/ISR_16_Timers_Array)
Expand All @@ -60,7 +65,7 @@ The catch is **your function is now part of an ISR (Interrupt Service Routine),
---
---

## Prerequisite
## Prerequisites

1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
2. [`Arduino mbed v1.3.0+`](https://www.arduino.cc/en/Guide/NANO33BLE#use-your-arduino-nano-33-ble-on-the-arduino-desktop-ide) for NRF52-based board using mbed-RTOS such as Nano-33-BLE.
Expand Down Expand Up @@ -90,7 +95,7 @@ Another way to install is to:

1. Install [VS Code](https://code.visualstudio.com/)
2. Install [PlatformIO](https://platformio.org/platformio-ide)
3. Install [**NRF52_MBED_TimerInterrupt** library](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt/installation). Search for **NRF52_MBED_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
3. Install [**NRF52_MBED_TimerInterrupt** library](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt) or [**NRF52_MBED_TimerInterrupt** library](https://platformio.org/lib/show/11539/NRF52_MBED_TimerInterrupt) by using [Library Manager](https://platformio.org/lib/show/11489/NRF52_MBED_TimerInterrupt/installation). Search for **NRF52_MBED_TimerInterrupt** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22)
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)

---
Expand Down Expand Up @@ -325,7 +330,7 @@ void setup()
5. [TimerInterruptTest](examples/TimerInterruptTest)
6. [TimerInterruptLEDDemo](examples/TimerInterruptLEDDemo)
7. [FakeAnalogWrite](examples/FakeAnalogWrite)
8. [Change_Interval](examples/Change_Interval)
8. [**Change_Interval**](examples/Change_Interval). New

---
---
Expand Down Expand Up @@ -401,7 +406,7 @@ typedef void (*irqCallback) (void);
/////////////////////////////////////////////////
#define USE_COMPLEX_STRUCT false
#define USE_COMPLEX_STRUCT true
#if USE_COMPLEX_STRUCT
Expand Down Expand Up @@ -606,7 +611,7 @@ void setup()
while (!Serial);
Serial.printf("\nStarting ISR_16_Timers_Array_Complex on %s\n", BOARD_NAME);
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);
// Interval in microsecs
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
Expand Down Expand Up @@ -660,7 +665,7 @@ While software timer, **programmed for 2s, is activated after more than 3.000s i

```
Starting ISR_16_Timers_Array_Complex on Nano 33 BLE
Version : 1.0.2
NRF52_MBED_TimerInterrupt v1.1.1
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 10000
Starting ITimer OK, millis() = 714
Expand Down Expand Up @@ -1132,7 +1137,7 @@ Timer : 15, programmed : 80000, actual : 80009

```
Starting TimerInterruptTest on Nano 33 BLE
Version : v1.0.2
NRF52_MBED_TimerInterrupt v1.1.1
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 1000000
Starting ITimer0 OK, millis() = 5660
Expand Down Expand Up @@ -1163,7 +1168,7 @@ Start ITimer0, millis() = 60680

```
Starting Argument_None on Nano 33 BLE
Version : 1.0.2
NRF52_MBED_TimerInterrupt v1.1.1
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER1
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 500000
Starting ITimer0 OK, millis() = 1519
Expand All @@ -1188,9 +1193,8 @@ Time = 100010, Timer0Count = 197, Timer1Count = 49
4. The following is the sample terminal output when running example [FakeAnalogWrite](examples/FakeAnalogWrite) on **Nano 33 BLE** to demonstrate the usage of PWWM fakeAnalogWrite to simulate PWM analogWrite, but being able to write to many more pins.

```
Starting FakeAnalogWrite on Nano 33 BLE
Version : v1.0.2
NRF52_MBED_TimerInterrupt v1.1.1
NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
NRF52_MBED_TimerInterrupt: _fre = 1000000.00, _count = 100
Starting ITimer OK, millis() = 1811
Expand Down Expand Up @@ -1287,9 +1291,47 @@ Update index 7, pin = 9, input PWM_Value=120, mapped PWM_Value= 124
Test PWM_Value = 120, max = 255
```

---

5. The following is the sample terminal output when running example [Change_Interval](examples/Change_Interval) to demonstrate how to change Timer Interval on-the-fly

```
Starting Change_Interval on Nano 33 BLE
NRF52_MBED_TimerInterrupt v1.1.1
Starting ITimer0 OK, millis() = 801
Starting ITimer1 OK, millis() = 805
Time = 10001, Timer0Count = 18, , Timer1Count = 4
Time = 20002, Timer0Count = 38, , Timer1Count = 9
Changing Interval, Timer0 = 1000, Timer1 = 4000
Time = 30003, Timer0Count = 47, , Timer1Count = 11
Time = 40004, Timer0Count = 57, , Timer1Count = 13
Changing Interval, Timer0 = 500, Timer1 = 2000
Time = 50005, Timer0Count = 76, , Timer1Count = 17
Time = 60006, Timer0Count = 96, , Timer1Count = 22
Changing Interval, Timer0 = 1000, Timer1 = 4000
Time = 70007, Timer0Count = 105, , Timer1Count = 24
Time = 80008, Timer0Count = 115, , Timer1Count = 26
Changing Interval, Timer0 = 500, Timer1 = 2000
Time = 90009, Timer0Count = 134, , Timer1Count = 30
Time = 100010, Timer0Count = 154, , Timer1Count = 35
Changing Interval, Timer0 = 1000, Timer1 = 4000
Time = 110011, Timer0Count = 163, , Timer1Count = 37
Time = 120012, Timer0Count = 173, , Timer1Count = 39
Changing Interval, Timer0 = 500, Timer1 = 2000
Time = 130013, Timer0Count = 192, , Timer1Count = 43
Time = 140014, Timer0Count = 212, , Timer1Count = 48
Changing Interval, Timer0 = 1000, Timer1 = 4000
Time = 150015, Timer0Count = 221, , Timer1Count = 50
Time = 160016, Timer0Count = 231, , Timer1Count = 52
```
---
---

### Releases v1.1.1

1. Add example [**Change_Interval**](examples/Change_Interval)
2. Bump up version to sync with other TimerInterrupt Libraries. Modify Version String.

### Releases v1.0.2

1. Add example [ISR_16_Timers_Array_Complex](examples/ISR_16_Timers_Array_Complex) and optimize example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array)
Expand Down
5 changes: 3 additions & 2 deletions examples/Argument_None/Argument_None.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.2
Version: 1.1.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
1.0.2 K Hoang 23/11/2020 Add and optimize examples
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
*****************************************************************************************************************************/

/*
Expand Down Expand Up @@ -116,7 +117,7 @@ void setup()
delay(100);

Serial.printf("\nStarting Argument_None on %s\n", BOARD_NAME);
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);

// Interval in microsecs
if (ITimer0.attachInterruptInterval(TIMER0_INTERVAL_MS * 1000, TimerHandler0))
Expand Down
21 changes: 11 additions & 10 deletions examples/Change_Interval/Change_Interval.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.2
Version: 1.1.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
1.0.2 K Hoang 23/11/2020 Add and optimize examples
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
*****************************************************************************************************************************/

/*
Expand All @@ -40,7 +41,7 @@
*/

#if !( ARDUINO_ARCH_NRF52840 && TARGET_NAME == ARDUINO_NANO33BLE )
#error This code is designed to run on nRF52-based Nano-33-BLE boards using mbed-RTOS platform! Please check your Tools->Board setting.
#error This code is designed to run on nRF52-based Nano-33-BLE boards using mbed-RTOS platform! Please check your Tools->Board setting.
#endif

// These define's must be placed at the beginning before #include "NRF52TimerInterrupt.h"
Expand All @@ -54,11 +55,11 @@
//#endif

#ifndef LED_BLUE_PIN
#define LED_BLUE_PIN D7
#define LED_BLUE_PIN D7
#endif

#ifndef LED_RED_PIN
#define LED_RED_PIN D8
#define LED_RED_PIN D8
#endif

#define TIMER0_INTERVAL_MS 500 //1000
Expand Down Expand Up @@ -99,7 +100,7 @@ void TimerHandler1(void)

// Flag for checking to be sure ISR is working as Serial.print is not OK here in ISR
Timer1Count++;

//timer interrupt toggles outputPin
digitalWrite(LED_BLUE_PIN, toggle1);
toggle1 = !toggle1;
Expand All @@ -109,15 +110,15 @@ void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LED_BLUE_PIN, OUTPUT);

Serial.begin(115200);
while (!Serial);

delay(100);

Serial.printf("\nStarting Change_Interval on %s\n", BOARD_NAME);
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);

// Interval in microsecs
if (ITimer0.attachInterruptInterval(TIMER0_INTERVAL_MS * 1000, TimerHandler0))
{
Expand Down Expand Up @@ -156,12 +157,12 @@ void loop()
{
//setInterval(unsigned long interval, timerCallback callback)
multFactor = (multFactor + 1) % 2;

ITimer0.setInterval(TIMER0_INTERVAL_MS * 1000 * (multFactor + 1), TimerHandler0);
ITimer1.setInterval(TIMER1_INTERVAL_MS * 1000 * (multFactor + 1), TimerHandler1);

Serial.printf("Changing Interval, Timer0 = %lu, Timer1 = %lu\n", TIMER0_INTERVAL_MS * (multFactor + 1), TIMER1_INTERVAL_MS * (multFactor + 1));

lastChangeTime = currTime;
}
}
Expand Down
14 changes: 10 additions & 4 deletions examples/FakeAnalogWrite/FakeAnalogWrite.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.0.2
Version: 1.1.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
1.0.2 K Hoang 23/11/2020 Add and optimize examples
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
*****************************************************************************************************************************/
/*
Notes:
Expand Down Expand Up @@ -167,6 +168,8 @@ void doingSomething(int index)
{
if (curISRTimerData[index].PWM_Value > 0)
digitalWrite(curISRTimerData[index].pin, 1);
else
digitalWrite(curISRTimerData[index].pin, 0);
}
else if (curISRTimerData[index].countPWM == curISRTimerData[index].PWM_Value)
{
Expand All @@ -188,7 +191,7 @@ void setup()
while (!Serial);

Serial.printf("\nStarting FakeAnalogWrite on %s\n", BOARD_NAME);
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);

// Interval in microsecs
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
Expand Down Expand Up @@ -274,6 +277,9 @@ void fakeAnalogWrite(uint16_t pin, uint16_t value)
curISRTimerData[i].PWM_Value = 0;
}

// Reset countPWM
curISRTimerData[i].countPWM = 0;

return;
}
}
Expand Down Expand Up @@ -328,8 +334,8 @@ void fakeAnalogWrite(uint16_t pin, uint16_t value)
}
}

#define DELAY_BETWEEN_CHANGE_MS 10000L
#define REPEAT_INTERVAL_MS 60000L
#define DELAY_BETWEEN_CHANGE_MS 5000L
#define REPEAT_INTERVAL_MS 10000L

#define DIVIDER 5

Expand Down
5 changes: 3 additions & 2 deletions examples/ISR_16_Timers_Array/ISR_16_Timers_Array.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.2
Version: 1.1.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
1.0.2 K Hoang 23/11/2020 Add and optimize examples
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
*****************************************************************************************************************************/
/*
Notes:
Expand Down Expand Up @@ -255,7 +256,7 @@ void setup()
while (!Serial);

Serial.printf("\nStarting ISR_16_Timers_Array on %s\n", BOARD_NAME);
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);

// Interval in microsecs
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
Based on BlynkTimer.h
Author: Volodymyr Shymanskyy
Version: 1.0.2
Version: 1.1.1
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.1 K Hoang 22/11/2020 Initial coding and sync with NRF52_TimerInterrupt
1.0.2 K Hoang 23/11/2020 Add and optimize examples
1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries
*****************************************************************************************************************************/
/*
Notes:
Expand Down Expand Up @@ -114,7 +115,7 @@ typedef void (*irqCallback) (void);

/////////////////////////////////////////////////

#define USE_COMPLEX_STRUCT false
#define USE_COMPLEX_STRUCT true

#if USE_COMPLEX_STRUCT

Expand Down Expand Up @@ -319,7 +320,7 @@ void setup()
while (!Serial);

Serial.printf("\nStarting ISR_16_Timers_Array_Complex on %s\n", BOARD_NAME);
Serial.printf("Version : v%s\n", NRF52_MBED_TIMER_INTERRUPT_VERSION);
Serial.println(NRF52_MBED_TIMER_INTERRUPT_VERSION);

// Interval in microsecs
if (ITimer.attachInterruptInterval(HW_TIMER_INTERVAL_US, TimerHandler))
Expand Down
Loading

0 comments on commit 63d2dc3

Please sign in to comment.