arduino/Arduino — pull request #1127 by tigercat (2012-11-21 18:37:23+00:00)
Title: Tigercat

Pin SHIFT Mode Support
I'm using Firmata quite a bit and needed to do some shifting out of an Arduino pin. I noticed there was mention in the code of a SHIFT mode, so I guessed at the author's intentions and implemented a shift mode for shifting in our out. It supports shifting 1-4 bytes either MSB first or last (with a dedicated clock output pin), and shifting in or out. The way it's implemented, there's some room in the parameters to support shifting a specific number of bits within a byte. I don't need fractional byte shifting now and wasn't sure if this would be an acceptable patch, so didn't spend additional time on it (but I would, if there's interest).

The patch makes 32 bit shifting about 35x faster than when using DIGITAL_MESSAGEs. I've tested it on a Mega, Uno, and Diecimila.