digitalWrite and digitalWriteFast

Wondering what the difference is and is there any reason one would prefer digitalWrite over digitalWriteFast.

I’d look at the results with my scope but my stupid computer is still doing memory test. Wow. Haven’t had to memory test since CP/M days.

@Tentoes, digitalWrite() does pin mode checking to validate the call is correct for the select pin. The digitalWriteFast() does away with the sanity checks in favour of speed. It is often used in ISRs to reduce their execution time - 2us vs 40ns on Gen1 and Gen2 devices. I haven’t characterized the difference in Gen3 devices yet.

1 Like

Thanks.

Sanity check might be needed, but not sure code in an electron can check my sanity.

1 Like