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

Commit

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

1. Add complicated example [ISR_16_Timers_Array](examples/ISR_16_Timers_Array) utilizing and demonstrating the full usage of 16 independent ISR Timers.
  • Loading branch information
khoih-prog authored Nov 6, 2020
1 parent 4ae9f46 commit 80e3572
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 160 deletions.
107 changes: 27 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,17 @@ uint32_t TimerInterval[NUMBER_ISR_TIMERS] =
typedef void (*irqCallback) (void);
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
void printStatus(uint16_t index, unsigned long deltaMillis, unsigned long currentMillis)
{
Serial.print(TimerInterval[index]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
}
#endif
// In Teensy, avoid doing something fancy in ISR, for example complex Serial.print with String() argument
// The pure simple Serial.prints here are just for demonstration and testing. Must be eliminate in working environment
// Or you can get this run-time error / crash
Expand All @@ -387,11 +398,7 @@ void doingSomething0()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[0]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(0, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -405,11 +412,7 @@ void doingSomething1()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[1]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(1, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -423,11 +426,7 @@ void doingSomething2()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[2]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(2, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -441,11 +440,7 @@ void doingSomething3()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[3]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(3, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -459,11 +454,7 @@ void doingSomething4()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[4]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(4, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -477,11 +468,7 @@ void doingSomething5()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[5]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(5, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -495,11 +482,7 @@ void doingSomething6()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[6]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(6, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -513,11 +496,7 @@ void doingSomething7()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[7]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(7, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -531,11 +510,7 @@ void doingSomething8()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[8]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(8, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -549,11 +524,7 @@ void doingSomething9()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[9]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(9, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -567,11 +538,7 @@ void doingSomething10()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[10]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(10, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -588,11 +555,7 @@ void doingSomething11()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[11]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(11, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -609,11 +572,7 @@ void doingSomething12()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[12]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(12, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -627,11 +586,7 @@ void doingSomething13()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[13]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(13, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -645,11 +600,7 @@ void doingSomething14()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[14]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(14, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand All @@ -663,11 +614,7 @@ void doingSomething15()
unsigned long deltaMillis = currentMillis - previousMillis;
#if (TEENSY_TIMER_INTERRUPT_DEBUG > 0)
Serial.print(TimerInterval[15]/1000);
Serial.print("s: Delta ms = ");
Serial.print(deltaMillis);
Serial.print(", ms = ");
Serial.println(currentMillis);
printStatus(15, deltaMillis, currentMillis);
#endif
previousMillis = currentMillis;
Expand Down
Loading

0 comments on commit 80e3572

Please sign in to comment.