CZEMacLeod
Member
Whilst researching solutions and looking at the best outcome for my project, I found this pull request for another Arduino core (STM32) which seems to address this issue.
I was wondering if perhaps a similar change would be entertained on the Teensyduino core to enable/facilitate this scenario, perhaps using some optional compilation defines to determine behaviour if there is any speed or memory impact.
The basic premise is to allow attachInterrupt to accept std:function<void(void)> in order to bind an object's method to an interrupt.
The pull request is https://github.com/stm32duino/Arduino_Core_STM32/pull/159 and the code changes are https://github.com/stm32duino/Arduino_Core_STM32/commit/baa22b033f5abf01e5dd9ddf8443e9b6d1ac64c8
(not mine)
I don't know how similar or how much work it would take to make these changes but I can see it making life a lot easier for some library writers and enable code to be more compatible across target boards.
I was wondering if perhaps a similar change would be entertained on the Teensyduino core to enable/facilitate this scenario, perhaps using some optional compilation defines to determine behaviour if there is any speed or memory impact.
The basic premise is to allow attachInterrupt to accept std:function<void(void)> in order to bind an object's method to an interrupt.
The pull request is https://github.com/stm32duino/Arduino_Core_STM32/pull/159 and the code changes are https://github.com/stm32duino/Arduino_Core_STM32/commit/baa22b033f5abf01e5dd9ddf8443e9b6d1ac64c8
(not mine)
I don't know how similar or how much work it would take to make these changes but I can see it making life a lot easier for some library writers and enable code to be more compatible across target boards.