This Arduino library A5020.zip lets you read delta_x and delta_y plus the surface quality from the ADNS-5020-EN sensor chip. The chip is an optical motion sensor found in e.g. the Logitech Pilot USB/PS2 optical mouse. You will want to read the datasheet from the manufacturer Avago.
For the SPI communication, I could also have used the Wire library which is of better quality. This part I covered only to make it easier to port to some other microcontroller.
Tip: Connect the NRESET pin high and save some wires. Use the reset() method instead.