PICkit 2 as SPI protocol analyzer
Recently I was investigating the optical sensor on a Razer mouse. Avago has many optical sensor datasheets on their website, but this mouse uses the ADNS-3088 sensor, which isn’t there. The sensor connects with an SPI port.

Since I don’t have a logic analyzer capable of analyzing SPI traffic, I decided to write my own. I used the PICkit 2 as my hardware and SDCC as the compiler. The code is here. See the README for usage and techinical details.
After all this trouble, I found that the ADNS-3088 is addressed identically to the ADNS-3080, which I have a datasheet for. The firmware that the mouse downloads is identical to the firmware on Avago’s website.