digitalWrite and digitalWriteFast


#1

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.


#2

@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.


#3

Thanks.

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