Coder Social home page Coder Social logo

teensytimertool's Introduction

Please note: The current version requires Teensyduino 1.59beta or higher. If you use 1.58 or lower please use TeensyTimerTool 1.3.0.

PlatformIO Registry arduino-library-badge

TeensyTimerTool

The TeensyTimerTool is a library that provides a generic, easy to use interface to the hardware timers of the PJRC Teensy boards. In addition, it provides up to 20 highly efficient software timers that use the same interface. All timers can be used in periodic and one-shot mode. Currently the library supports the ARM T3.X and T4.0 boards.

teensytimertool's People

Contributors

imwhocodes avatar luni64 avatar lunoptics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teensytimertool's Issues

Including both TeensyTimerTool and TimeLib.h

I'm playing around with a T4.1 and I want to use the TeensyTimerTool in a project that also will be using the RTC functionality.

I've narrowed down an issue to when both <TimeLib.h> and "TeensyTimerTool.h" are both #included in the project. I tested this with an empty project and get compile issues. Any help on how to get past these compile issues would be great. I can't find anything similar on google.

image

setPeriod() on PeriodicTimer / Direct usage of ITimerChannel

Hi,

Is possible to change the timer period on the fly?

I would like to change the period of the timer without calling timer.begin(...) again.

Let's say that I have a PeriodicTimer running and I want change its period without resetting its internal counter of time already passed

Searching through the source code I found that ITimerChannel has some extra/usefull member function like setPeriod or setCallback but i'm unable to find an actual implementation of the aforementioned class even if it is an attribute of PeriodicTimer

Can I subclass PeriodicTimer to expose timerChannel->setPeriod and timerChannel->setPeriod? Is this safe? or changing period to a running timer is really unsafe / not doable?

Thanks,
Luca

Installation instructions.

There needs to be detailed instructions as to how this library can be integrated into the Arduino software.

Compile errors

Just updated the library with your latest changes to RTC for non T4 boards. Now it is failing to compile at all. Using Ard 2.1 and TeensyDuino 1.58 .. i get this missing file error...

#include "TeensyTimerTool.h"
     using namespace TeensyTimerTool;
     PeriodicTimer t_1;
....
//+++++++++++++++++++Setup the main timer loop
   t_1.begin([] { t_1_Callback(); }, 50'000);  // Set timer to 50,000 microseconds (or 0.05sec)
                                                       //   This works out to 20 interrupts/sec
                                                       //   and gives us 20 "ticks" per sec.     

error produced is

c:\Users\mail\Documents\Arduino\libraries\TeensyTimerTool-master\src\config.cpp:12:10: fatal error: TimerModules/RTC/RTC.h: No such file or directory
   12 | #include "TimerModules/RTC/RTC.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~

I'm missing a file in the src folder. Ideas?

Destructor on TCK timer

I'm using a one shot TCK64 timer on Teensy 4.1. I am creating and deleting timers. However, deleting timers doesn't seem to work in that timers don't get released.

It looks like the destructor for TCK timers is defined, but has an empty body. I have also seen that there is a function called removeTImer, but this is never used. Is there any reason why the removeTImer function could not be used in the destructor so that timer slots could be reused.

Thanks,

Carl

[Help] Using timer ticks instead of microseconds ?

Hi,

[sorry if this is not the correct place to post this message, I don't know where else to put it]

I'm a beginner on the Teensy 4.1 microcontroller, and I was very relieved to see that this library exists (so thanks a lot !).
However in order to control several stepper motors with high speeds, using only microseconds as timer intervals isn't very handy for my use of the library.
So is there a way to use nanoseconds, or even timer ticks (which would be ideal), with the general purpose timers timer.trigger(...) function ?

It would be very handy if I could simply set a 32-bit number, at which the timer will trigger the interrupt callback function.
I hope that my question was clear...

Thanks to anyone who will take time to answer,
Maxime.

Protect unsafe usage of `BaseTimer::start` and `BaseTimer::stop`

I know I shouldn't be doing this, but I noticed that BaseTimer::start and BaseTimer::stop use the timerChannel pointer without checking them; I would expect them to return errorCode::notInitialized if it isn't set yet.

Test to reproduce crashes:

#include <TeensyTimerTool.h>

TeensyTimerTool::PeriodicTimer t1;

void begin() {
  t1.start();  // Dies here without progressing (expected seg fault)
  // Rest of code
}

Version 1.1.0 - Using timers in a class does not work

As of 1.1.0 the example code - How to Encapsulate a Timer and its Callback in a Class (https://github.com/luni64/TeensyTimerTool/wiki/Callbacks#how-to-encapsulate-a-timer-and-its-callback-in-a-class) no longer works.

Using lambdas inside classes while capturing [this] fails on latest Arduino IDE (2.0.0) and PlatformIO (v 2.5.4).

Problematic code:

void begin()  // better not initalizie peripherals in constructors
    {
       pinMode(pin, OUTPUT);
        timer.begin([this] { this->blink(); }, period);
   }

Full error log:

in file included from c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/ITimerChannel.h:3:0,
from c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/API/baseTimer.h:5,
from c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/API/oneShotTimer.h:4,
from c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/TeensyTimerTool.h:3,
from D:\Codes\Arduino\code\timer\timertest\Blinker.hpp:2,
from D:\Codes\Arduino\code\timer\timertest\timertest.ino:1:
c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
#warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
^
In file included from D:\Codes\Arduino\code\timer\timertest\timertest.ino:1:0:
D:\Codes\Arduino\code\timer\timertest\Blinker.hpp: In member function 'void Blinker::begin()':
D:\Codes\Arduino\code\timer\timertest\Blinker.hpp:16:54: error: no matching function for call to 'TeensyTimerTool::PeriodicTimer::begin(Blinker::begin()::<lambda()>, unsigned int&)'
In file included from c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/API/oneShotTimer.h:4:0,
from c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/TeensyTimerTool.h:3,
from D:\Codes\Arduino\code\timer\timertest\Blinker.hpp:2,
from D:\Codes\Arduino\code\timer\timertest\timertest.ino:1:
c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/API/baseTimer.h:45:15: note: candidate: template TeensyTimerTool::errorCode TeensyTimerTool::BaseTimer::begin(TeensyTimerTool::callback_t, period_t, bool)
errorCode BaseTimer::begin(callback_t callback, period_t p, bool start)
^
c:\Users\pavel\Documents\Arduino\libraries\TeensyTimerTool\src/API/baseTimer.h:45:15: note: template argument deduction/substitution failed:
In file included from D:\Codes\Arduino\code\timer\timertest\timertest.ino:1:0:
D:\Codes\Arduino\code\timer\timertest\Blinker.hpp:16:54: note: cannot convert 'Blinker::begin()::<lambda()>{((Blinker*)this)}' (type 'Blinker::begin()::<lambda()>') to type 'TeensyTimerTool::callback_t {aka void (*)()}'
exit status 1
Compilation error: exit status 1

Problem with DoubleExposure example

I am trying to modify the DoubleExposure example as my use case is very similar, however I can't compile even the PulseGenerator.h

It returns the following errors

In file included from src/with_library.cpp:1:0:
include/PulseGenerator.h: In constructor 'PulseGenerator::PulseGenerator()':
include/PulseGenerator.h:20:43: error: 'FTM0' is not a member of 'TeensyTimerTool'
 PulseGenerator::PulseGenerator() : timer_(TeensyTimerTool::FTM0) {}
                                           ^
include/PulseGenerator.h: In member function 'void PulseGenerator::begin(const unsigned int&)':
include/PulseGenerator.h:27:46: error: no matching function for call to 'TeensyTimerTool::OneShotTimer::begin(PulseGenerator::begin(const unsigned int&)::<lambda()>)'
   timer_.begin([this]() { this->callback(); });

Note this is w/

  • gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  • platformIO

Full error out

 *  Executing task: platformio run 

Processing teensy41 (platform: teensy; framework: arduino; board: teensy41)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.17.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES: 
 - framework-arduinoteensy @ 1.157.220801 (1.57) 
 - tool-teensy @ 1.157.0 (1.57) 
 - toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 93 compatible libraries
Scanning dependencies...
Dependency Graph
|-- TeensyTimerTool @ 1.1.0
Building in release mode
Compiling .pio/build/teensy41/src/with_library.cpp.o
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/API/Timer.cpp.o
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/API/baseTimer.cpp.o
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/ErrorHandling/error_handler.cpp.o
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/TimerModules/GPT/GPTChannel.cpp.o
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/TimerModules/PIT4/PIT.cpp.o
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/API/baseTimer.h:5,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/API/oneShotTimer.h:4,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TeensyTimerTool.h:3,
                 from include/PulseGenerator.h:4,
                 from src/with_library.cpp:1:
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/TimerModules/TCK/TCK.cpp.o
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/API/timer.h:3,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/API/Timer.cpp:1:
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/TimerModules/TCK/TckChannelBase.cpp.o
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/API/baseTimer.h:5,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/API/baseTimer.cpp:1:
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/ErrorHandling/error_handler.cpp:3:0:
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/TimerModules/TCK/tickCounters.cpp.o
Compiling .pio/build/teensy41/lib188/TeensyTimerTool/config.cpp.o
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/GPT/GPTChannel.h:4,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/GPT/GPTChannel.cpp:3:
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/PIT4/PITChannel.h:4,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/PIT4/PIT.h:3,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/PIT4/PIT.cpp:3:
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/../../ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TckChannelBase.h:3,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TckChannel.h:5,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TCK.h:4,
Compiling .pio/build/teensy41/FrameworkArduino/AudioStream.cpp.o
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TCK.cpp:5:
.pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/../../types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/../../ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TckChannelBase.h:3,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TckChannelBase.cpp:3:
.pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/../../types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
Compiling .pio/build/teensy41/FrameworkArduino/CrashReport.cpp.o
Compiling .pio/build/teensy41/FrameworkArduino/DMAChannel.cpp.o
Compiling .pio/build/teensy41/FrameworkArduino/EventResponder.cpp.o
In file included from src/with_library.cpp:1:0:
include/PulseGenerator.h: In constructor 'PulseGenerator::PulseGenerator()':
include/PulseGenerator.h:20:43: error: 'FTM0' is not a member of 'TeensyTimerTool'
 PulseGenerator::PulseGenerator() : timer_(TeensyTimerTool::FTM0) {}
                                           ^
include/PulseGenerator.h: In member function 'void PulseGenerator::begin(const unsigned int&)':
include/PulseGenerator.h:27:46: error: no matching function for call to 'TeensyTimerTool::OneShotTimer::begin(PulseGenerator::begin(const unsigned int&)::<lambda()>)'
   timer_.begin([this]() { this->callback(); });
                                              ^
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/TeensyTimerTool.h:3:0,
                 from include/PulseGenerator.h:4,
                 from src/with_library.cpp:1:
.pio/libdeps/teensy41/TeensyTimerTool/src/API/oneShotTimer.h:26:15: note: candidate: TeensyTimerTool::errorCode TeensyTimerTool::OneShotTimer::begin(TeensyTimerTool::callback_t)
     errorCode OneShotTimer::begin(callback_t callback)
               ^
.pio/libdeps/teensy41/TeensyTimerTool/src/API/oneShotTimer.h:26:15: note:   no known conversion for argument 1 from 'PulseGenerator::begin(const unsigned int&)::<lambda()>' to 'TeensyTimerTool::callback_t {aka void (*)()}'
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/tickCounters.cpp:4:0:
Compiling .pio/build/teensy41/FrameworkArduino/HardwareSerial.cpp.o
.pio/libdeps/teensy41/TeensyTimerTool/src/types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
In file included from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/../../ITimerChannel.h:3:0,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TckChannelBase.h:3,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TckChannel.h:5,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/TCK.h:4,
                 from .pio/libdeps/teensy41/TeensyTimerTool/src/config.cpp:2:
.pio/libdeps/teensy41/TeensyTimerTool/src/TimerModules/TCK/../../types.h:9:10: warning: #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks" [-Wcpp]
Compiling .pio/build/teensy41/FrameworkArduino/HardwareSerial1.cpp.o
         #warning "can't use staticFunctional with GCC < V7! Fallback to function pointer callbacks"
          ^
*** [.pio/build/teensy41/src/with_library.cpp.o] Error 1
================================================================================ [FAILED] Took 0.72 seconds ================================================================================

Support for RTC timer

Recent forum posts made use of RTC clock interrupt. For perhaps lower freq interrupt periods it could free up other timers.

Running an example that completes in setup() the T_4.0 went to empty loop and I touched it and it was quite warm to touch and internal reported '60C==140F'.

"wfi" doesn't work without a real interrupt [millis_tick is not 'real'] - and adding an intervaltimer with "WFI" dropped it to 45C==113F
https://github.com/Defragster/TeensySketches/blob/main/WFIon1062/WFIon1062.ino

Redid the same with RTC _ISR() from recent forum sketch and it worked with no loss in accuracy to the PPS sketch
https://github.com/Defragster/TeensySketches/blob/main/WFIon1062_RTC/WFIon1062_RTC.ino

Also interesting the PPS sketch showed about 60K clock ticks per half second using WFI instead of 300M - so it really does sleep the processor.

Adding RTC to TimerTool might have value - the rest of this would probably be good for TeensyUser/Wiki ref notes?

Adjust FTM Timer Interval in Real Time?

I need to be able to adjust a FTM timers interval in real time while it is running. I can not find a way to do this. Is this possible? If so how would I go about doing this? I've tried using a one shot timer that triggers it self though a call back using a variable for the delay but when the delay is changed it does not update until the timer is stopped and started again. Not sure why.

Timer is not Accurate in 0.3.2 release

@luni64 @lunOptics
HW:- Teensy 4.0
I was using 0.1.10 Release till date and today I updated to 0.3.2 release.
I see that my code is not working anymore. Here is the example that I was using earlier.
I have this code working with correct timing on 0.1.10 Release + 600/528/150 Mhz

Instead of 10mSec I am gettting this function called at every 1.5uSec Approx.
image

/********************************************************
 * Basic usage of the timer
 * 
 * Generates a timer from the timer pool and
 * starts it with a period of 250ms. 
 * The timer callback simply toggles the built in LED
 * 
 ********************************************************/

#include "TeensyTimerTool.h"

using namespace TeensyTimerTool;
PeriodicTimer t1(PIT);

void vStartTimer()
{
  t1.begin(callback, 10'000); //10mSec
}

void vStopTimer()
{
  t1.begin([] {}, 10'000); //10mSec  
}

void callback()
{
    digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));    
}

void setup()
{
    pinMode(LED_BUILTIN,OUTPUT);   
    vStartTimer();
}

void loop()
{   
}

v0.4.1 not available in the Arduino Library Manager

Hi,

the last release of the TeensyTimerTool that I can see in the Arduino Library Manager is v.0.4.0.

It looks like the order of tagging v0.4.1 and updating the library.json was mixed up. Would be great to have v0.4.1 available in the Library Manager.

Thanks
Arno

Arduino Library Manager

Variable One-Shot Delays (broken?)

This looks like a very promising library to help with a PAL video encoder project I'm working on, but it seems that the TeensyTimerTool isn't letting me use multiple timers or updating the timers I'm using. For example:

#include "TeensyTimerTool.h"


using namespace TeensyTimerTool;


OneShotTimer timer1;
OneShotTimer timer2;


byte ledState = HIGH;


void processVideo()
{
  if (ledState == HIGH)
  {
    ledState = LOW;
    timer2.trigger(2000);
  }
  else
  {
    ledState = HIGH;
    timer1.trigger(1000);
  }
  
  digitalWriteFast(LED_BUILTIN, ledState);
}


void setup()
{
  Serial.begin(115200);
  
  pinMode(LED_BUILTIN, OUTPUT);

  timer1.begin(processVideo);
  timer2.begin(processVideo);
  timer1.trigger(1000);
}


void loop()
{
  
}

From my understanding of the library, the above sketch should light the Teensy 4.0's built-in LED for 1 seconds, turn off for 2 second, and repeat. However, the LED just lights and stays lit.

Can you confirm this as a bug or am I misunderstanding how the library works?

TeensyTimerTool compilation errors 0.58.3 under Arduino IDE2.0.3

TTT V1.2.0 generating errors under Arduino IDE 2.0.3. Also EncoderTool V3.1.0 are generating similar errors. Here is the compiler output.
`In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:10:13: error: redefinition of 'void panic()'
10 | inline void panic() // could be weak to be overriden by a user error handler?
| ^~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:10:13: note: 'void panic()' previously defined here
10 | inline void panic() // could be weak to be overriden by a user error handler?
| ^~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:100:33: error: redefinition of 'constexpr const size_t stdext::inplace_function_detail::InplaceFunctionDefaultCapacity'
100 | static constexpr size_t InplaceFunctionDefaultCapacity = 32;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:100:33: note: 'constexpr const size_t stdext::inplace_function_detail::InplaceFunctionDefaultCapacity' previously defined here
100 | static constexpr size_t InplaceFunctionDefaultCapacity = 32;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:107:15: error: redefinition of 'union stdext::inplace_function_detail::aligned_storage_helper'
107 | union aligned_storage_helper
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:107:15: note: previous definition of 'union stdext::inplace_function_detail::aligned_storage_helper'
107 | union aligned_storage_helper
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:131:16: error: redefinition of default argument for 'unsigned int Align'
131 | struct aligned_storage
| ^~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:130:81: note: original definition appeared here
130 | template <size_t Cap, size_t Align = alignof(aligned_storage_helper)>
| ^
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:149:16: error: redefinition of 'struct stdext::inplace_function_detail::wrapper'
149 | struct wrapper
| ^~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:149:16: note: previous definition of 'struct stdext::inplace_function_detail::wrapper'
149 | struct wrapper
| ^~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:155:16: error: redefinition of 'struct stdext::inplace_function_detail::vtable<R, Args>'
155 | struct vtable
| ^~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:155:16: note: previous definition of 'struct stdext::inplace_function_detail::vtable<R, Args>'
155 | struct vtable
| ^~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:202:9: error: redefinition of 'template<class R, class ... Args> stdext::inplace_function_detail::vtable<R, Args ...> stdext::inplace_function_detail::empty_vtable'
202 | empty_vtable{};
| ^~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:202:9: note: 'template<class R, class ... Args> stdext::inplace_function_detail::vtable<R, Args ...> stdext::inplace_function_detail::empty_vtable<R, Args ...>' previously declared here
202 | empty_vtable{};
| ^~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:205:8: error: redefinition of 'struct stdext::inplace_function_detail::is_valid_inplace_dst<DstCap, DstAlign, SrcCap, SrcAlign>'
205 | struct is_valid_inplace_dst : std::true_type
| ^~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:205:8: note: previous definition of 'struct stdext::inplace_function_detail::is_valid_inplace_dst<DstCap, DstAlign, SrcCap, SrcAlign>'
205 | struct is_valid_inplace_dst : std::true_type
| ^~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:220:8: error: redefinition of 'struct stdext::inplace_function_detail::is_invocable_r_impl< , R, F, Args>'
220 | struct is_invocable_r_impl : std::false_type
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:220:8: note: previous definition of 'struct stdext::inplace_function_detail::is_invocable_r_impl< , R, F, Args>'
220 | struct is_invocable_r_impl : std::false_type
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:225:8: error: redefinition of 'struct stdext::inplace_function_detail::is_invocable_r_impl<decltype ((declval()((declval)()...), void())), void, F, Args ...>'
225 | struct is_invocable_r_impl<
| ^~~~~~~~~~~~~~~~~~~~
226 | decltype(std::declval()(std::declval()...), void()),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227 | void,
| ~~~~~
228 | F,
| ~~
229 | Args...> : std::true_type
| ~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:225:8: note: previous definition of 'struct stdext::inplace_function_detail::is_invocable_r_impl<decltype ((declval()((declval)()...), void())), void, F, Args ...>'
225 | struct is_invocable_r_impl<
| ^~~~~~~~~~~~~~~~~~~~
226 | decltype(std::declval()(std::declval()...), void()),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227 | void,
| ~~~~~
228 | F,
| ~~
229 | Args...> : std::true_type
| ~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:234:8: error: redefinition of 'struct stdext::inplace_function_detail::is_invocable_r_impl<decltype ((declval()((declval)()...), void())), const void, F, Args ...>'
234 | struct is_invocable_r_impl<
| ^~~~~~~~~~~~~~~~~~~~
235 | decltype(std::declval()(std::declval()...), void()),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236 | const void,
| ~~~~~~~~~~~
237 | F,
| ~~
238 | Args...> : std::true_type
| ~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:234:8: note: previous definition of 'struct stdext::inplace_function_detail::is_invocable_r_impl<decltype ((declval()((declval)()...), void())), const void, F, Args ...>'
234 | struct is_invocable_r_impl<
| ^~~~~~~~~~~~~~~~~~~~
235 | decltype(std::declval()(std::declval()...), void()),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236 | const void,
| ~~~~~~~~~~~
237 | F,
| ~~
238 | Args...> : std::true_type
| ~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:243:8: error: redefinition of 'struct stdext::inplace_function_detail::is_invocable_r_impl<decltype (accept(declval()((declval)()...))), R, F, Args ...>'
243 | struct is_invocable_r_impl<
| ^~~~~~~~~~~~~~~~~~~~
244 | decltype(accept(std::declval()(std::declval()...))),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245 | R,
| ~~
246 | F,
| ~~
247 | Args...> : std::true_type
| ~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:243:8: note: previous definition of 'struct stdext::inplace_function_detail::is_invocable_r_impl<decltype (accept(declval()((declval)()...))), R, F, Args ...>'
243 | struct is_invocable_r_impl<
| ^~~~~~~~~~~~~~~~~~~~
244 | decltype(accept(std::declval()(std::declval()...))),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245 | R,
| ~~
246 | F,
| ~~
247 | Args...> : std::true_type
| ~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:263:7: error: redefinition of default argument for 'unsigned int Capacity'
263 | class inplace_function; // unspecified
| ^~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:261:49: note: original definition appeared here
261 | size_t Capacity = inplace_function_detail::InplaceFunctionDefaultCapacity,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:268:12: error: redefinition of 'struct stdext::inplace_function_detail::is_inplace_function< >'
268 | struct is_inplace_function : std::false_type
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:268:12: note: previous definition of 'struct stdext::inplace_function_detail::is_inplace_function< >'
268 | struct is_inplace_function : std::false_type
| ^~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:272:12: error: redefinition of 'struct stdext::inplace_function_detail::is_inplace_function<stdext::inplace_function<Sig, Cap, Align> >'
272 | struct is_inplace_function<inplace_function<Sig, Cap, Align>> : std::true_type
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:272:12: note: previous definition of 'struct stdext::inplace_function_detail::is_inplace_function<stdext::inplace_function<Sig, Cap, Align> >'
272 | struct is_inplace_function<inplace_function<Sig, Cap, Align>> : std::true_type
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/TeensyTimerTool/src/types.h:9,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/ITimerChannel.h:3,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/baseTimer.h:5,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/API/oneShotTimer.h:4,
from /home/bruce/Arduino/libraries/TeensyTimerTool/src/TeensyTimerTool.h:3,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:15,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/TeensyTimerTool/src/inplace_function.h:282:7: error: redefinition of 'class stdext::inplace_function<R(Args ...), Capacity, Alignment>'
282 | class inplace_function<R(Args...), Capacity, Alignment>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/bruce/Arduino/libraries/EncoderTool/src/config.h:26,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderBase.h:6,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlexBase.h:3,
from /home/bruce/Arduino/libraries/EncoderTool/src/Multiplexed/EncPlex74165.h:7,
from /home/bruce/Arduino/libraries/EncoderTool/src/EncoderTool.h:8,
from /home/bruce/Arduino/ELS_IDE2/ELS.h:14,
from /home/bruce/Arduino/ELS_IDE2/ELS_IDE2.ino:1:
/home/bruce/Arduino/libraries/EncoderTool/src/inplace_function.h:282:7: note: previous definition of 'class stdext::inplace_function<R(Args ...), Capacity, Alignment>'
282 | class inplace_function<R(Args...), Capacity, Alignment>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1`

I do have a customer that I need to support. I am setting up a github project and wish for the customer to use IDE2, but the project won't compile now. It was 100% functional under IDE1.8.19 and the countertype branch.

Tick timer not working on Teensy LC

I really like the idea of this library and for my application the tick timer will be perfect. Unless I am doing something wrong I don't think it works on the Teency LC and I believe it is because ARM_DWT_CYCCNT is always 0 on that processor. To test I am using the example HelloOneShot.

Cheers!

OneShotTimer triggering without delay

Hi,
I am trying to use your nice library but have found that the OneShotTimer is trigging straight away ignoring the delay setting.

this is more than likely something I have misunderstood, but my code

#include "Arduino.h"
#include "TeensyTimerTool.h"

using namespace TeensyTimerTool;

void callback();
void OnlyOnce();

OneShotTimer timer1; // generate a timer from the pool (Pool: 2xGPT, 16xTMR(QUAD), 20xTCK)
OneShotTimer timer2;

void callback()
{
    digitalWriteFast(LED_BUILTIN, LOW);  // switch off LED
}

void OnlyOnce()
{
    Serial.println("Only once");
}

void setup()
{
    Serial.begin(115200);
    delay(5000);
    pinMode(LED_BUILTIN,OUTPUT);

    timer1.begin(callback);
    timer2.begin(OnlyOnce);
    timer2.trigger(5min);
    Serial.println("Begin");
}

void loop()
{
    digitalWriteFast(LED_BUILTIN, HIGH);
    timer1.trigger(10'000); // switch of after 10ms

    delay(500);
}

gives the output of:

Only once
Begin

Where I was expecting

Begin
Only once

I am running it on a Teensy 3.6, using Platform IO, TeensyTimerTool library version=0.3.2

Can you see anything I have done wrong?

Regards,

Edit:
I think I figured out what I was doing wrong, I was exciding the maximum period,
running this code solve / answered my question:

#include "Arduino.h"
#include "TeensyTimerTool.h"

using namespace TeensyTimerTool;

void callback();
void OnlyOnce();
void OnlyOnceTCK64();
void empty();

OneShotTimer timer1;  // generate a timer from the pool (Pool: 2xGPT, 16xTMR(QUAD), 20xTCK)
OneShotTimer timer2;
OneShotTimer timer3(TCK64);

PeriodicTimer t1(TCK);
PeriodicTimer t2(TCK64);
PeriodicTimer t3(FTM1);

void callback()
{
    digitalWriteFast(LED_BUILTIN, LOW);  // switch off LED
}

void OnlyOnce()
{
    Serial.printf("%010u", micros());
    Serial.println(" | Only once");
}

void OnlyOnceTCK64()
{
    Serial.printf("%010u", micros());
    Serial.println(" | Only once TCK64");
}

void empty() {}

void setup()
{
    Serial.begin(115200);
    while (!Serial)
        ;
    Serial.printf("%010u", micros());
    Serial.println(" | Serial Done");
    pinMode(LED_BUILTIN, OUTPUT);

    t1.begin(empty, 1'000);
    t2.begin(empty, 1'000);
    t3.begin(empty, 1'000);

    Serial.printf("TCK:           %8.3f seconds\n", t1.getMaxPeriod());
    Serial.printf("TCK64:         %8.3f seconds\n", t2.getMaxPeriod());
    Serial.printf("FTM1:          %8.3f seconds\n", t3.getMaxPeriod());

    timer1.begin(callback);
    timer2.begin(OnlyOnce);
    timer2.trigger(22370);
    timer3.begin(OnlyOnceTCK64);
    timer3.trigger(1min);
    Serial.printf("%010u", micros());
    Serial.println(" | Begin");
}

void loop()
{
    digitalWriteFast(LED_BUILTIN, HIGH);
    timer1.trigger(10'000);  // switch of after 10ms

    delay(500);
}

and now I get and out like:

0001502000 | Serial Done
TCK:             22.370 seconds
TCK64:         4294.967 seconds
FTM1:             0.035 seconds
0001502201 | Begin
0001524563 | Only once
0061502202 | Only once TCK64

I'll close this out, thanks again for the libary.
Regards,

Crashing when beginning timers

I'm trying to write a class which captures a period timer (PIT) and a oneshot timer (GPT1) but there is some weird behavior depending on where the periodic is begin() which I can't quite understand.

My demo code:

HEADER

#pragma once

#include <Arduino.h>
#include <TeensyTimerTool.h>

class Demo
{
private:
  TeensyTimerTool::OneShotTimer one_shot_timer_;
  TeensyTimerTool::PeriodicTimer timer_;
  uint8_t pin_;
  unsigned long interval_;

public:
  Demo(const uint8_t & pin, const unsigned long & interval);
  ~Demo() {}

  void begin();
  void callback();
};

Demo::Demo(const uint8_t & pin, const unsigned long & interval)
: one_shot_timer_(TeensyTimerTool::GPT1),
  timer_(TeensyTimerTool::PIT),
  pin_(pin),
  interval_(interval)
{
  pinMode(pin_, OUTPUT);
}

void Demo::begin()
{
  timer_.begin([this]() { callback(); }, interval_, false);
  timer_.start();
}
void Demo::callback() { digitalWriteFast(pin_, !digitalReadFast(pin_)); }

CPP

#include "demo.hpp"

Demo t1(LED_BUILTIN, 1'000'000);
void setup() { t1.begin(); }

void loop() {}

As it stands this works fine, causing the LED on my teensy4.1 to blink at 1 Hz

Crash 1

Moving the begin line into the constructor, such that the header is changed to:

Demo::Demo(const uint8_t & pin, const unsigned long & interval)
: one_shot_timer_(TeensyTimerTool::GPT1),
  timer_(TeensyTimerTool::PIT),
  pin_(pin),
  interval_(interval)
{
  pinMode(pin_, OUTPUT);
  timer_.begin([this]() { callback(); }, interval_, false);
}

void Demo::begin() { timer_.start(); }

Crash 2

I want to rewrite the begin function to take over more responsibility rather than assigning these things in the constructor. Changing the files as such also causes the LED to no longer blink

#pragma once

#include <Arduino.h>
#include <TeensyTimerTool.h>

class Demo
{
private:
  TeensyTimerTool::OneShotTimer one_shot_timer_;
  TeensyTimerTool::PeriodicTimer timer_;
  uint8_t pin_;
  unsigned long interval_;

public:
  Demo();
  ~Demo() {}

  void begin(const uint8_t & pin, const unsigned long & interval);
  void callback();
};

Demo::Demo() : one_shot_timer_(TeensyTimerTool::GPT1), timer_(TeensyTimerTool::PIT)
{
  pinMode(pin_, OUTPUT);
}

void Demo::begin(const uint8_t & pin, const unsigned long & interval)
{
  pin_ = pin;
  interval_ = interval;

  timer_.begin([this]() { callback(); }, interval_, false);
  timer_.start();
}
void Demo::callback() { digitalWriteFast(pin_, !digitalReadFast(pin_)); }
#include "demo.hpp"

Demo t1;
void setup() { t1.begin(LED_BUILTIN, 1'000'000); }

void loop() {}

Conclusion

Resetting to the original files after uploading either of the crashing setups instantly results in the LED blinking again.

Note this is with the v1.0.0 release of TeensyTimerTool and a teensy 4.1

error: expected '{' before '::' token

Hi @luni64,

I'm having the following error when compiling with arduino-cli:

In file included from /home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.cpp:3:0:
/home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.h:[5](https://github.com/bblanchon/ArduinoContinuousStepper/actions/runs/5952260840/job/16143840558#step:10:6):2[6](https://github.com/bblanchon/ArduinoContinuousStepper/actions/runs/5952260840/job/16143840558#step:10:7): error: expected '{' before '::' token
 namespace TeensyTimerTool::RTC_t
                          ^
/home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.h:5:2[8](https://github.com/bblanchon/ArduinoContinuousStepper/actions/runs/5952260840/job/16143840558#step:10:9): error: 'RTC_t' in namespace '::' does not name a type
 namespace TeensyTimerTool::RTC_t
                            ^
/home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.cpp:6:26: error: expected '{' before '::' token
 namespace TeensyTimerTool::RTC_t
                          ^
/home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.cpp:6:28: error: 'RTC_t' in namespace '::' does not name a type
 namespace TeensyTimerTool::RTC_t
                            ^
/home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.cpp:32:1: error: expected '}' at end of input
 } // namespace TeensyTimerTool::RTC_t
 ^
/home/runner/Arduino/libraries/TeensyTimerTool/src/TimerModules/RTC/RTC.cpp:32:1: error: expected '}' at end of input

Error during build: exit status 1

Nested namespace definitions require C++17; I think it's a bit too early for that.

Best regards,
Benoit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.