As far as I know, clearWatch wouldn't stop those watches (there's a list of JS watches stored in a JsVar).
Would it be a better option to change definition of jshEventCallbacks in jsdevices to a struct
Maybe. I've been trying to avoid things like that though - there are 16 watch targets so with a 32 bit pointer that's 64 bytes of RAM that's then not available to the user. Not a big deal on bigger parts, but when 99.9% of users wouldn't use it, it seems like a bit of a waste (esp on the smaller parts).
I don't think it'd slow anything down noticably - so really it's just whether it's a good idea memory-wise.
Another quick solution would be to just pass the EXTI number into the function as an argument, and then you could work out where everything went yourself (since jshPinWatch will return the EXTI when called).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
As far as I know, clearWatch wouldn't stop those watches (there's a list of JS watches stored in a JsVar).
Maybe. I've been trying to avoid things like that though - there are 16 watch targets so with a 32 bit pointer that's 64 bytes of RAM that's then not available to the user. Not a big deal on bigger parts, but when 99.9% of users wouldn't use it, it seems like a bit of a waste (esp on the smaller parts).
I don't think it'd slow anything down noticably - so really it's just whether it's a good idea memory-wise.
Another quick solution would be to just pass the EXTI number into the function as an argument, and then you could work out where everything went yourself (since
jshPinWatch
will return the EXTI when called).