Having user definable mappings called by library functions

Boards based on ESP32, ESP8266, and (I believe) STM32 support passing an argument to an ISR. It's supplied in the attach.Interrupt() function as a 'void *'.

It can be done using some template trickery. See This Post.

Also, ESP32, ESP8266, and STM32 support it using std::function.