Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to IntervalTimerEx for compatibility with TeensyDuino 1.59 #6

Open
joepasquariello opened this issue Feb 8, 2024 · 2 comments

Comments

@joepasquariello
Copy link

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

@strud
Copy link

strud commented Jul 28, 2024

Hi @joepasquariello

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?

@luni64
Copy link
Owner

luni64 commented Jul 28, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants