Skip to content

Changes to IntervalTimerEx for compatibility with TeensyDuino 1.59 #6

@joepasquariello

Description

@joepasquariello

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions