Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __LIB_ADNS7530__
00015 #define __LIB_ADNS7530__
00016 #include <stdint.h>
00017 #include <stdbool.h>
00018
00019
00020 #define ADNS7530_NORMAL_OPERATION 0x00
00021 #define ADNS7530_FORCE_REST1 0x10
00022 #define ADNS7530_FORCE_REST2 0x20
00023 #define ADNS7530_FORCE_REST3 0x30
00024
00025
00026 #define ADNS7530_FORCE_AWAKE 0x08
00027 #define ADNS7530_2MS_RUN_RATE 0x00
00028 #define ADNS7530_3MS_RUN_RATE 0x01
00029 #define ADNS7530_4MS_RUN_RATE 0x02
00030 #define ADNS7530_5MS_RUN_RATE 0x03
00031 #define ADNS7530_6MS_RUN_RATE 0x04
00032 #define ADNS7530_7MS_RUN_RATE 0x05
00033 #define ADNS7530_8MS_RUN_RATE 0x06
00034 #define ADNS7530_RES1600CPI 0x60
00035 #define ADNS7530_RES1200CPI 0x40
00036 #define ADNS7530_RES800CPI 0x20
00037 #define ADNS7530_RES400CPI 0x00
00038
00039 #define ADNS7530_POWERUPRESET_INIT 0x5A
00040
00041 #define ADNS7530_LASERCTRL0_DEBUG 0xC0 // Address 0x1a
00042 #define ADNS7530_LASERCTRL1_DEBUG 0x00 // Address 0x1f
00043 #define ADNS7530_LSRPWRCFG0_DEBUG 0x80 // Address 0x1c, 0x41
00044 #define ADNS7530_LSRPWRCFG1_DEBUG 0x7F // Address 0x1d, 0xbe
00045
00046
00047 #define ADNS7530_PRODUCTID_ADDR 0x00
00048 #define ADNS7530_REVISIONID_ADDR 0x01
00049 #define ADNS7530_MOTION_ADDR 0x02
00050 #define ADNS7530_DELTAX_L_ADDR 0x03
00051 #define ADNS7530_DELTAY_L_ADDR 0x04
00052 #define ADNS7530_DELTAXY_H_ADDR 0x05
00053 #define ADNS7530_SQUAL_ADDR 0x06
00054 #define ADNS7530_SHUTTER_UPPER_ADDR 0x07
00055 #define ADNS7530_SHUTTER_LOWER_ADDR 0x08
00056 #define ADNS7530_MAXIMUM_PIXEL_ADDR 0x09
00057 #define ADNS7530_PIXEL_SUM_ADDR 0x0A
00058 #define ADNS7530_MINIMUM_PIXEL_ADDR 0x0B
00059 #define ADNS7530_CRC0_ADDR 0x0C
00060 #define ADNS7530_CRC1_ADDR 0x0D
00061 #define ADNS7530_CRC2_ADDR 0x0E
00062 #define ADNS7530_CRC3_ADDR 0x0F
00063 #define ADNS7530_SELFTEST_ADDR 0x10
00064
00065 #define ADNS7530_CONFIG2_BITS_ADDR 0x12
00066 #define ADNS7530_RUN_DOWNSHIFT_ADDR 0x13
00067 #define ADNS7530_REST1_RATE_ADDR 0x14
00068 #define ADNS7530_REST1_DOWNSHITF_ADDR 0x15
00069 #define ADNS7530_REST2_RATE_ADDR 0x16
00070 #define ADNS7530_REST2_DOWNSHITF_ADDR 0x17
00071 #define ADNS7530_REST3_RATE_ADDR 0x18
00072
00073 #define ADNS7530_LASERCTRL0_ADDR 0x1A
00074 #define ADNS7530_LSRPWRCFG0_ADDR 0x1C
00075 #define ADNS7530_LSRPWRCFG1_ADDR 0x1D
00076 #define ADNS7530_LASERCTRL1_ADDR 0x1F
00077
00078 #define ADNS7530_OBSERVATION_ADDR 0x2E
00079
00080 #define ADNS7530_PIXEL_GRAB_ADDR 0x35
00081
00082 #define ADNS7530_POWERUPRESET_ADDR 0x3A
00083 #define ADNS7530_SHUTDOWN_ADDR 0x3B
00084
00085 #define ADNS7530_AUTO_RUN_ADDR 0x3D
00086 #define ADNS7530_INVERSEREVISIONID_ADDR 0x3E
00087 #define ADNS7530_INVERSEPRODUCTID_ADDR 0x3F
00088
00089 #define ADNS7530_MOTIONBURST_ADDR 0x42
00090
00091
00092 #define ADNS7530_WRITE 0x80
00093 #define ADNS7530_READ 0x00
00094 #define ADNS7530_DUMMYDATA 0xFF
00095
00096 void hal_adns7530_enable(void);
00097 void hal_adns7530_disable(void);
00098 uint8_t hal_adns7530_readRegister(uint8_t regAddress);
00099 void hal_adns7530_writeRegister(uint8_t regAddress, uint8_t innData);
00100 void hal_adns7530_init();
00101 bool hal_adns7530_readMotionBurst(int16_t *deltaX, int16_t *deltaY);
00102 void hal_adns7530_mod_cpi();
00103
00104 #endif