The setWatch() accepts an optional options object that feel like what you are looking for: the repeat property of the options controls whether it is a one single shot or multiples. I would not go as far as @Gordon outlined. I would only give the timers names (may be that's what @Gordon means with user) and then let the known pattern take care of things... Like we have ports / pins named, why can we not have timers named? ...T1, T2, T3,... and then use, for example, setWatch(callbackFunction,T3,{repeat: true}); to invoke callbackFunction when T3 overflows in counting mode...
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.
The
setWatch()
accepts an optionaloptions
object that feel like what you are looking for: therepeat
property of the options controls whether it is a one single shot or multiples. I would not go as far as @Gordon outlined. I would only give the timers names (may be that's what @Gordon means withuser
) and then let the known pattern take care of things... Like we have ports / pins named, why can we not have timers named? ...T1
,T2
,T3
,... and then use, for example,setWatch(callbackFunction,T3,{repeat: true});
to invokecallbackFunction
whenT3
overflows in counting mode...