Not much can be done about that I guess... Having writePort function would at least allow people to skip the individual pins if they wanted.
digitalWrite could probably be modified such that it could detect objects with a write function, and could then call it. Same with digitalRead, pinMode, etc. It would add to code size, but probably wouldn't hurt execution speed as much. It's still unlikely to help with things like software SPI and OneWire, as they use a 'fast path' for writing to pins.
I'd be happy to add this - it may not even require writing a new function.
We could have a go at changing these. I did some quick tests, and .write is actually ~5% faster and uses less code space than digitalWrite, so changing it would make sense (unless you needed to digitalWrite arrays.
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.
Well, it seems sensible - just my 2p, but:
writePort
function would at least allow people to skip the individual pins if they wanted.digitalWrite
could probably be modified such that it could detect objects with awrite
function, and could then call it. Same withdigitalRead
,pinMode
, etc. It would add to code size, but probably wouldn't hurt execution speed as much. It's still unlikely to help with things like software SPI and OneWire, as they use a 'fast path' for writing to pins..write
is actually ~5% faster and uses less code space thandigitalWrite
, so changing it would make sense (unless you needed todigitalWrite
arrays.