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

Commit

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

1. Add better debug feature.
2. Optimize code and examples to reduce RAM usage
3. Add Table of Contents
  • Loading branch information
khoih-prog authored Jan 11, 2021
1 parent d988189 commit f9ee49b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ Before using any Timer, you have to make sure the Timer has not been used by any

### 1. Using only Hardware Timer directly

#### 1.1 Init Hardware Timer
### 1.1 Init Hardware Timer

```
// You can select Teensy Hardware Timer from TEENSY_TIMER_1 or TEENSY_TIMER_3
Expand All @@ -355,7 +355,7 @@ Before using any Timer, you have to make sure the Timer has not been used by any
TeensyTimer ITimer0(TEENSY_TIMER_1);
```

#### 1.2 Set Hardware Timer Interval and attach Timer Interrupt Handler function
### 1.2 Set Hardware Timer Interval and attach Timer Interrupt Handler function

Use one of these functions with **interval in unsigned long milliseconds**

Expand Down Expand Up @@ -438,7 +438,7 @@ void setup()

The 16 ISR_based Timers, designed for long timer intervals, only support using **unsigned long millisec intervals**. If you have to use much higher frequency or sub-millisecond interval, you have to use the Hardware Timers directly as in [1.3 Set Hardware Timer Frequency and attach Timer Interrupt Handler function](#13-set-hardware-timer-frequency-and-attach-timer-interrupt-handler-function)

#### 2.2 Init Hardware Timer and ISR-based Timer
### 2.2 Init Hardware Timer and ISR-based Timer

```
// You can select Teensy Hardware Timer from TEENSY_TIMER_1 or TEENSY_TIMER_3
Expand All @@ -451,7 +451,7 @@ TeensyTimer ITimer(TEENSY_TIMER_1);
Teensy_ISR_Timer ISR_Timer;
```

#### 2.3 Set Hardware Timer Interval and attach Timer Interrupt Handler functions
### 2.3 Set Hardware Timer Interval and attach Timer Interrupt Handler functions

```
void TimerHandler(void)
Expand Down
17 changes: 10 additions & 7 deletions src/TeensyTimerInterrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

#pragma once

#ifndef TEENSYTIMERINTERRUPT_H
#define TEENSYTIMERINTERRUPT_H

#if !( defined(CORE_TEENSY) || defined(TEENSYDUINO) )
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#endif
Expand Down Expand Up @@ -116,7 +119,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -232,7 +235,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -457,7 +460,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -601,7 +604,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -828,7 +831,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -962,7 +965,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -1098,4 +1101,4 @@ ISR(TIMER3_OVF_vect)

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


#endif // TEENSYTIMERINTERRUPT_H
17 changes: 10 additions & 7 deletions src_cpp/TeensyTimerInterrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

#pragma once

#ifndef TEENSYTIMERINTERRUPT_H
#define TEENSYTIMERINTERRUPT_H

#if !( defined(CORE_TEENSY) || defined(TEENSYDUINO) )
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#endif
Expand Down Expand Up @@ -116,7 +119,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -232,7 +235,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -457,7 +460,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -601,7 +604,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -828,7 +831,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -962,7 +965,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -1098,4 +1101,4 @@ ISR(TIMER3_OVF_vect)

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


#endif // TEENSYTIMERINTERRUPT_H
17 changes: 10 additions & 7 deletions src_h/TeensyTimerInterrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

#pragma once

#ifndef TEENSYTIMERINTERRUPT_H
#define TEENSYTIMERINTERRUPT_H

#if !( defined(CORE_TEENSY) || defined(TEENSYDUINO) )
#error This code is designed to run on Teensy platform! Please check your Tools->Board setting.
#endif
Expand Down Expand Up @@ -116,7 +119,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -232,7 +235,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -457,7 +460,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -601,7 +604,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -828,7 +831,7 @@ class TeensyTimerInterrupt
}

// frequency (in hertz) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool setFrequency(float frequency, timerCallback callback) __attribute__((always_inline))
{
return setInterval((float) (1000000.0f / frequency), callback);
Expand Down Expand Up @@ -962,7 +965,7 @@ class TeensyTimerInterrupt
}

// interval (in microseconds) and duration (in milliseconds). Duration = 0 or not specified => run indefinitely
// No params and duration now. To be addes in the future by adding similar functions here or to NRF52-hal-timer.c
// No params and duration now. To be added in the future by adding similar functions here or to NRF52-hal-timer.c
bool attachInterruptInterval(unsigned long interval, timerCallback callback) __attribute__((always_inline))
{
return setInterval(interval, callback);
Expand Down Expand Up @@ -1098,4 +1101,4 @@ ISR(TIMER3_OVF_vect)

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


#endif // TEENSYTIMERINTERRUPT_H

0 comments on commit f9ee49b

Please sign in to comment.