A library to interface to the PAW3102DB optical mouse sensor. It cannot write to the sensor as of yet.

Committer:
Pinski1
Date:
Mon Jun 13 19:03:22 2011 +0000
Revision:
0:dda73f38c264
Initial Release, bugs expected

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pinski1 0:dda73f38c264 1
Pinski1 0:dda73f38c264 2
Pinski1 0:dda73f38c264 3
Pinski1 0:dda73f38c264 4
Pinski1 0:dda73f38c264 5
Pinski1 0:dda73f38c264 6 #ifndef MBED_PAW3102DB_H
Pinski1 0:dda73f38c264 7 #define MBED_PAW3102DB_H
Pinski1 0:dda73f38c264 8
Pinski1 0:dda73f38c264 9 #include "mbed.h"
Pinski1 0:dda73f38c264 10
Pinski1 0:dda73f38c264 11 /* Register Aliases */
Pinski1 0:dda73f38c264 12 #define CONFIGURATION 0x1B
Pinski1 0:dda73f38c264 13 #define OPERATION_MODE2 0x1A
Pinski1 0:dda73f38c264 14 #define IMAGE_QUALITY2 0x19
Pinski1 0:dda73f38c264 15 #define DELTA_Y2 0x18
Pinski1 0:dda73f38c264 16 #define DELTA_X2 0x17
Pinski1 0:dda73f38c264 17 #define MOTION_STATUS 0x16
Pinski1 0:dda73f38c264 18 #define PRODUCT_ID3 0x15
Pinski1 0:dda73f38c264 19 #define PRODUCT_ID2 0x14
Pinski1 0:dda73f38c264 20 #define WRITE_PROTECT 0x12
Pinski1 0:dda73f38c264 21 #define IMAGE_QUALITY 0x04
Pinski1 0:dda73f38c264 22 #define DELTA_X 0x03
Pinski1 0:dda73f38c264 23 #define DELTA_Y 0x02
Pinski1 0:dda73f38c264 24 #define PRODUCT_ID1 0x01
Pinski1 0:dda73f38c264 25 #define OPERATION_MODE1 0x00
Pinski1 0:dda73f38c264 26
Pinski1 0:dda73f38c264 27 class PAW3102DB {
Pinski1 0:dda73f38c264 28 private:
Pinski1 0:dda73f38c264 29 SPIHalfDuplex sensor;
Pinski1 0:dda73f38c264 30 PinName MOSI;
Pinski1 0:dda73f38c264 31 PinName MISO;
Pinski1 0:dda73f38c264 32 PinName SCK;
Pinski1 0:dda73f38c264 33
Pinski1 0:dda73f38c264 34 public:
Pinski1 0:dda73f38c264 35 PAW3102DB(PinName pMOSI, PinName pMISO, PinName pSCK);
Pinski1 0:dda73f38c264 36 unsigned char read(unsigned char address);
Pinski1 0:dda73f38c264 37
Pinski1 0:dda73f38c264 38 signed char getDeltaX(void);
Pinski1 0:dda73f38c264 39 signed char getDeltaY(void);
Pinski1 0:dda73f38c264 40
Pinski1 0:dda73f38c264 41 unsigned short getProductID(void);
Pinski1 0:dda73f38c264 42 unsigned short getResolution(void);
Pinski1 0:dda73f38c264 43
Pinski1 0:dda73f38c264 44 };
Pinski1 0:dda73f38c264 45
Pinski1 0:dda73f38c264 46 #endif