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

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
### Release v1.3.0

1. Fix TCB Clock bug. Don't use v1.2.0
  • Loading branch information
khoih-prog committed Apr 17, 2021
1 parent dfdae9b commit 64761c8
Show file tree
Hide file tree
Showing 35 changed files with 184 additions and 129 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Please ensure to specify the following:
Arduino IDE version: 1.8.13
Arduino megaAVR Core Version 1.8.7
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.4.0-71-generic #79-Ubuntu SMP Wed Mar 24 10:56:57 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered a crash while trying to use the Timer Interrupt.
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [Important Notes about ISR](#important-notes-about-isr)
* [Currently supported Boards](#currently-supported-boards)
* [Changelog](#changelog)
* [Release v1.3.0](#release-v130)
* [Release v1.2.0](#release-v120)
* [Release v1.1.0](#release-v110)
* [Initial Release v1.0.0](#initial-release-v100)
Expand Down Expand Up @@ -129,6 +130,11 @@ The catch is your function is now part of an ISR (Interrupt Service Routine), an

## Changelog

### Release v1.3.0

1. Fix TCB Clock bug. Don't use v1.2.0


### Release v1.2.0

1. Selectable **TCB Clock 16MHz, 8MHz or 250KHz** depending on necessary accuracy
Expand Down Expand Up @@ -793,7 +799,7 @@ While software timer, **programmed for 2s, is activated after more than 10.000s
```

Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
megaAVR_TimerInterrupt v1.2.0
megaAVR_TimerInterrupt v1.3.0
CPU Frequency = 16 MHz
TCB Clock Frequency = 250KHz for lower accuracy but longer time
Starting ITimer1 OK, millis() = 6
Expand Down Expand Up @@ -945,7 +951,7 @@ The following is the sample terminal output when running example [Change_Interva
```
Starting Change_Interval on megaAVR Nano Every
megaAVR_TimerInterrupt v1.2.0
megaAVR_TimerInterrupt v1.3.0
CPU Frequency = 16 MHz
TCB Clock Frequency = 250KHz for lower accuracy but longer time
Starting ITimer1 OK, millis() = 1
Expand Down Expand Up @@ -974,7 +980,7 @@ Changing Interval, Timer1 = 100, Timer2 = 200
```
Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
megaAVR_TimerInterrupt v1.2.0
megaAVR_TimerInterrupt v1.3.0
CPU Frequency = 16 MHz
TCB Clock Frequency = 16MHz for highest accuracy
Starting ITimer1 OK, millis() = 6
Expand Down Expand Up @@ -1060,7 +1066,7 @@ Timer : 15, programmed : 80000, actual : 80000
```

Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
megaAVR_TimerInterrupt v1.2.0
megaAVR_TimerInterrupt v1.3.0
CPU Frequency = 16 MHz
TCB Clock Frequency = 8MHz for very high accuracy
Starting ITimer1 OK, millis() = 10
Expand Down Expand Up @@ -1128,7 +1134,7 @@ Timer : 15, programmed : 80000, actual : 80000
```
Starting ISR_16_Timers_Array_Complex on megaAVR Nano Every
megaAVR_TimerInterrupt v1.2.0
megaAVR_TimerInterrupt v1.3.0
CPU Frequency = 16 MHz
TCB Clock Frequency = 250KHz for lower accuracy but longer time
Starting ITimer1 OK, millis() = 11
Expand Down Expand Up @@ -1240,6 +1246,10 @@ Sometimes, the library will only work if you update the board core to the latest

## Releases

### Release v1.3.0

1. Fix TCB Clock bug. Don't use v1.2.0

### Release v1.2.0

1. Selectable **TCB Clock 16MHz, 8MHz or 250KHz** depending on necessary accuracy
Expand Down
3 changes: 2 additions & 1 deletion examples/Argument_Complex/Argument_Complex.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
Expand Down
3 changes: 2 additions & 1 deletion examples/Argument_None/Argument_None.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
Expand Down
3 changes: 2 additions & 1 deletion examples/Argument_Simple/Argument_Simple.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
Expand Down
13 changes: 9 additions & 4 deletions examples/Change_Interval/Change_Interval.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

/*
Expand Down Expand Up @@ -64,10 +65,10 @@


#define TIMER1_INTERVAL_MS 1000UL
#define TIMER2_INTERVAL_MS 2000UL
#define TIMER2_INTERVAL_MS 500UL

volatile uint32_t Timer1Count = 0;
volatile uint32_t Timer2Count = 0;
volatile uint32_t Timer1Count = 1;
volatile uint32_t Timer2Count = 1;

void printResult(uint32_t currTime)
{
Expand Down Expand Up @@ -186,11 +187,15 @@ void loop()

ITimer1.setInterval(TIMER1_INTERVAL_MS * (multFactor + 1), TimerHandler1);

Timer1Count++;

Serial.print(F("Changing Interval, Timer1 = ")); Serial.println(TIMER1_INTERVAL_MS * (multFactor + 1));

#if USE_TIMER_2
ITimer2.setInterval(TIMER2_INTERVAL_MS * (multFactor + 1), TimerHandler2);

Timer2Count++;

Serial.print(F("Changing Interval, Timer2 = ")); Serial.println(TIMER2_INTERVAL_MS * (multFactor + 1));
#endif

Expand Down
3 changes: 2 additions & 1 deletion examples/FakeAnalogWrite/FakeAnalogWrite.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/*
Notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,29 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
// _TIMERINTERRUPT_LOGLEVEL_ from 0 to 4
// Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system.
#define TIMER_INTERRUPT_DEBUG 0
#define _TIMERINTERRUPT_LOGLEVEL_ 0
#define _TIMERINTERRUPT_LOGLEVEL_ 3

// Select USING_16MHZ == true for 16MHz to Timer TCBx => shorter timer, but better accuracy
// Select USING_8MHZ == true for 8MHz to Timer TCBx => shorter timer, but better accuracy
// Select USING_250KHZ == true for 250KHz to Timer TCBx => shorter timer, but better accuracy
// Not select for default 250KHz to Timer TCBx => longer timer, but worse accuracy
#define USING_16MHZ true
#define USING_16MHZ false
#define USING_8MHZ false
#define USING_250KHZ false
#define USING_250KHZ true


#define USE_TIMER_0 false
Expand Down
3 changes: 2 additions & 1 deletion examples/ISR_RPM_Measure/ISR_RPM_Measure.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/* RPM Measuring uses high frequency hardware timer 1Hz == 1ms) to measure the time from of one rotation, in ms
then convert to RPM. One rotation is detected by reading the state of a magnetic REED SW or IR LED Sensor
Expand Down
3 changes: 2 additions & 1 deletion examples/ISR_Switch/ISR_Switch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/****************************************************************************************************************************
ISR_Switch demontrates the use of ISR to avoid being blocked by other CPU-monopolizing task
Expand Down
3 changes: 2 additions & 1 deletion examples/ISR_Timer_Complex/ISR_Timer_Complex.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

/****************************************************************************************************************************
Expand Down
3 changes: 2 additions & 1 deletion examples/ISR_Timer_Switch/ISR_Timer_Switch.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/****************************************************************************************************************************
ISR_Timer_Switch demontrates the use of ISR combining with Timer Interrupt to avoid being blocked by
Expand Down
3 changes: 2 additions & 1 deletion examples/ISR_Timer_Switches/ISR_Timer_Switches.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/****************************************************************************************************************************
ISR_Timer_Switches demontrates the use of ISR combining with Timer Interrupt to avoid being blocked by
Expand Down
3 changes: 2 additions & 1 deletion examples/ISR_Timers_Array_Simple/ISR_Timers_Array_Simple.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
Expand Down
3 changes: 2 additions & 1 deletion examples/RPM_Measure/RPM_Measure.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/* RPM Measuring uses high frequency hardware timer 1Hz == 1ms) to measure the time from of one rotation, in ms
then convert to RPM. One rotation is detected by reading the state of a magnetic REED SW or IR LED Sensor
Expand Down
3 changes: 2 additions & 1 deletion examples/SwitchDebounce/SwitchDebounce.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/
/****************************************************************************************************************************
Switch Debouncing uses high frequency hardware timer 50Hz == 20ms) to measure the time from the SW is pressed,
Expand Down
3 changes: 2 additions & 1 deletion examples/TimerDuration/TimerDuration.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
Expand Down
3 changes: 2 additions & 1 deletion examples/TimerInterruptTest/TimerInterruptTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
Therefore, their executions are not blocked by bad-behaving functions / tasks.
This important feature is absolutely necessary for mission-critical tasks.
Version: 1.2.0
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K.Hoang 01/04/2021 Initial coding to support Arduino megaAVR ATmega4809-based boards (UNO WiFi Rev2, etc.)
1.1.0 K.Hoang 14/04/2021 Fix bug. Don't use v1.0.0
1.2.0 K.Hoang 17/04/2021 Selectable TCB Clock 16MHz, 8MHz or 250KHz depending on necessary accuracy
1.3.0 K.Hoang 17/04/2021 Fix TCB Clock bug. Don't use v1.2.0
*****************************************************************************************************************************/

// These define's must be placed at the beginning before #include "megaAVR_TimerInterrupt.h"
Expand Down
Loading

0 comments on commit 64761c8

Please sign in to comment.