Changes to IntervalTimerEx for compatibility with TeensyDuino 1.59
Opened this issue · 2 comments
Hi Luni, IntervalTimerEx in the EncSim library needs changes for compatibility with your latest update to IntervalTimer in Teensy cores. I don't know if you want to keep support for USE_CPP11_CALLBACKS, but I assumed you did, and I modified my own copy of EncSim to support TEENSYDUINO >= 159, your existing USE_CPP11_CALLBACKS, and and the original callback_t = void ()(void);
The changes are pretty simple. In IntervalTimerEx.h, I added a definition of your latest callback_t for TEENSYDUINO >= 159, and then elsewhere in the H and CPP files, conditionals based on USE_CPP11_CALLBACKS were changed to ((TEENSYDUINO >= 159) || defined(USE_CPP11_CALLBACKS)). There was one place where you used an explicit callback type, and I changed that to callback_t.
Here is the modified conditional logic from the top of the H file, with the #include and callback_t copied from cores\Teensy4\IntervalTimer.h in TD 1.59b6.:
#if (TEENSYDUINO >= 159)
#include "inplace_function.h"
using callback_t = teensy::inplace_function<void(void), 16>;
using relay_t = void (*)();
#elif defined(USE_CPP11_CALLBACKS)
#include
using callback_t = std::function<void()>;
using relay_t = void (*)();
#else
using callback_t = void ()(void);
using relay_t = void (*)();
#endif
I'm having all sorts of issues getting this to work..
The specifc error I'm getting is:
no declaration matches 'bool IntervalTimerEx::begin(std::function<void()>, period_t)'
I have implemented your recommended changes but still having this problem. Running Teensyduino 159 and PlatformIO.
Are you able to share the cpp and h files you are using that are working?
Can you post a minimal example of the code which doesn't work? Which version of the EncoderTool are you using? There should be no workarounds necessary!