Fast alternative to digitalRead/digitalWrite

I can't improve the speed since functions like pin.high() and pin.low() compile to a single sbi or cbi instruction for low address I/O ports. All ports on the 328 and ports A-G on the Mega are low address. These instructions execute in 2 cycles or 125 ns on a 16 MHz cpu.

I have added software SPI which runs at about 2 MHz. This library supports all SPI modes for MSB first. It would be easy to add an option for LSB first.

I have not posted the latest version as a standalone library. The latest version of DigitalPin with SoftSPI is used in the new 20120719 version of SdFat. The files DigitalPin.h and SoftSPI.h are in the SdFat/utility folder and SdFat is here Google Code Archive - Long-term storage for Google Code Project Hosting..

I have also written a software I2C library based on the DigitalPin library that runs at 400 kHz. I plan to post this I2C library soon.