• I was wondering if I could write it in inlineC

    yes

    to speed up the thing.

    Not sure your example would benefit from it. you can configure pins for output once and not each time and then you just set five of them, that doesn't look like expensive operation, see also https://www.espruino.com/Performance if speed is important.

    Anyway fastest way to do this is to write OUT,OUTSET or OUTCLR GPIO register directly from javascript via poke32 command. So you can prepare the value and write all pins via single write (OUT) or two writes (OUTCLR,OUTSET). See the help here

    So e.g. to clear pins 23456 via single write you'd write value 4+8+16+32+64 to OUTCLR via poke32(124,0x50000000+0x50c) or to set them to 1 you'd write same value to 0x50000508. When writing OUT register you'd need to take care of pins you don't want to change by reading the value before.

About

Avatar for fanoush @fanoush started