![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
I don't finish configuring this program.
ADNS3080.h@0:9beaad87014d, 2014-05-08 (annotated)
- Committer:
- ryosuke
- Date:
- Thu May 08 12:59:25 2014 +0000
- Revision:
- 0:9beaad87014d
- Child:
- 1:46abb3b9347d
This program is test program for ADNS3080 Optical Flow sensor.; But, I do not finish configuring this program.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryosuke | 0:9beaad87014d | 1 | #ifndef ADNS3080_H |
ryosuke | 0:9beaad87014d | 2 | #define ADNS3080_H |
ryosuke | 0:9beaad87014d | 3 | |
ryosuke | 0:9beaad87014d | 4 | #include "mbed.h" |
ryosuke | 0:9beaad87014d | 5 | |
ryosuke | 0:9beaad87014d | 6 | //Register map |
ryosuke | 0:9beaad87014d | 7 | #define ADNS3080_PRODUCT_ID 0x00 |
ryosuke | 0:9beaad87014d | 8 | #define ADNS3080_REVISION_ID 0x01 |
ryosuke | 0:9beaad87014d | 9 | #define ADNS3080_MOTION 0x02 |
ryosuke | 0:9beaad87014d | 10 | #define ADNS3080_DELTA_X 0x03 |
ryosuke | 0:9beaad87014d | 11 | #define ADNS3080_DELTA_Y 0x04 |
ryosuke | 0:9beaad87014d | 12 | #define ADNS3080_SQUAL 0x05 |
ryosuke | 0:9beaad87014d | 13 | #define ADNS3080_PIXEL_SUM 0x06 |
ryosuke | 0:9beaad87014d | 14 | #define ADNS3080_MAXIMUM_PIXEL 0x07 |
ryosuke | 0:9beaad87014d | 15 | #define ADNS3080_CONFIGURATION_BITS 0x0a |
ryosuke | 0:9beaad87014d | 16 | #define ADNS3080_EXTENDED_CONFIG 0x0b |
ryosuke | 0:9beaad87014d | 17 | #define ADNS3080_DATA_OUT_LOWER 0x0c |
ryosuke | 0:9beaad87014d | 18 | #define ADNS3080_DATA_OUT_UPPER 0x0d |
ryosuke | 0:9beaad87014d | 19 | #define ADNS3080_SHUTTER_LOWER 0x0e |
ryosuke | 0:9beaad87014d | 20 | #define ADNS3080_SHUTTER_UPPER 0x0f |
ryosuke | 0:9beaad87014d | 21 | #define ADNS3080_FRAME_PERIOD_LOWER 0x10 |
ryosuke | 0:9beaad87014d | 22 | #define ADNS3080_FRAME_PERIOD_UPPER 0x11 |
ryosuke | 0:9beaad87014d | 23 | #define ADNS3080_MOTION_CLEAR 0x12 |
ryosuke | 0:9beaad87014d | 24 | #define ADNS3080_FRAME_CAPTURE 0x13 |
ryosuke | 0:9beaad87014d | 25 | #define ADNS3080_SROM_ENABLE 0x14 |
ryosuke | 0:9beaad87014d | 26 | #define ADNS3080_FRAME_PERIOD_MAX_BOUND_LOWER 0x19 |
ryosuke | 0:9beaad87014d | 27 | #define ADNS3080_FRAME_PERIOD_MAX_BOUND_UPPER 0x1a |
ryosuke | 0:9beaad87014d | 28 | #define ADNS3080_FRAME_PERIOD_MIN_BOUND_LOWER 0x1b |
ryosuke | 0:9beaad87014d | 29 | #define ADNS3080_FRAME_PERIOD_MIN_BOUND_UPPER 0x1c |
ryosuke | 0:9beaad87014d | 30 | #define ADNS3080_SHUTTER_MAX_BOUND_LOWER 0x1d |
ryosuke | 0:9beaad87014d | 31 | #define ADNS3080_SHUTTER_MAX_BOUND_UPPER 0x1e |
ryosuke | 0:9beaad87014d | 32 | #define ADNS3080_SROM_ID 0x1f |
ryosuke | 0:9beaad87014d | 33 | #define ADNS3080_OBSERVATION 0x3d |
ryosuke | 0:9beaad87014d | 34 | #define ADNS3080_INVERSE_PRODUCT_ID 0x3f |
ryosuke | 0:9beaad87014d | 35 | #define ADNS3080_PIXEL_BURST 0x40 |
ryosuke | 0:9beaad87014d | 36 | #define ADNS3080_MOTION_BURST 0x50 |
ryosuke | 0:9beaad87014d | 37 | #define ADNS3080_SROM_LOAD 0x60 |
ryosuke | 0:9beaad87014d | 38 | |
ryosuke | 0:9beaad87014d | 39 | #define ADNS3080_SPI_READ 0x00 |
ryosuke | 0:9beaad87014d | 40 | #define ADNS3080_SPI_WRITE 0x80 |
ryosuke | 0:9beaad87014d | 41 | |
ryosuke | 0:9beaad87014d | 42 | |
ryosuke | 0:9beaad87014d | 43 | |
ryosuke | 0:9beaad87014d | 44 | class ADNS3080{ |
ryosuke | 0:9beaad87014d | 45 | public: |
ryosuke | 0:9beaad87014d | 46 | |
ryosuke | 0:9beaad87014d | 47 | ADNS3080(PinName mosi, PinName miso, PinName sck, PinName cs); |
ryosuke | 0:9beaad87014d | 48 | |
ryosuke | 0:9beaad87014d | 49 | int getProdID(void); |
ryosuke | 0:9beaad87014d | 50 | int getRevID(void); |
ryosuke | 0:9beaad87014d | 51 | int getMotion(void); |
ryosuke | 0:9beaad87014d | 52 | signed char getDelta_X(void); |
ryosuke | 0:9beaad87014d | 53 | signed char getDelta_Y(void); |
ryosuke | 0:9beaad87014d | 54 | int getInverProdID(void); |
ryosuke | 0:9beaad87014d | 55 | |
ryosuke | 0:9beaad87014d | 56 | private: |
ryosuke | 0:9beaad87014d | 57 | |
ryosuke | 0:9beaad87014d | 58 | SPI spi_; |
ryosuke | 0:9beaad87014d | 59 | DigitalOut nCS_; |
ryosuke | 0:9beaad87014d | 60 | |
ryosuke | 0:9beaad87014d | 61 | int ReadRegister(int address); |
ryosuke | 0:9beaad87014d | 62 | |
ryosuke | 0:9beaad87014d | 63 | void WriteRegister(int address, char data); |
ryosuke | 0:9beaad87014d | 64 | }; |
ryosuke | 0:9beaad87014d | 65 | |
ryosuke | 0:9beaad87014d | 66 | #endif |