Actually ARM assembler isn't that painful. Most of it is done for you already here under 'Accessing IO' and 'Loops', so it's almost copy+paste.
But yes, you could poke the IO address. However at the moment that's still a function call via the JS interpreter which will take quite a bit of time (it should be faster than digitalWrite though) - If I changed the compiler to handle peek and poke with known values as low-level operations it'd be crazy fast though. It's just finding time ;)
Another thing to try if you're playing around is bind. You could do:
var A = digitalWrite.bind(undefined,B2,1);
var B = digitalWrite.bind(undefined,B2,0);
// ...
A();
B();
or
var A = B2.set.bind(B2);
var B = B2.reset.bind(B2);
// ...
A();
B();
I haven't tried, but they could be a smidge faster.
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.
Actually ARM assembler isn't that painful. Most of it is done for you already here under 'Accessing IO' and 'Loops', so it's almost copy+paste.
But yes, you could poke the IO address. However at the moment that's still a function call via the JS interpreter which will take quite a bit of time (it should be faster than digitalWrite though) - If I changed the compiler to handle peek and poke with known values as low-level operations it'd be crazy fast though. It's just finding time ;)
Another thing to try if you're playing around is
bind
. You could do:or
I haven't tried, but they could be a smidge faster.