6 void ReadAccRegister(uint8_t reg
, uint8_t *data
);
7 void WriteAccRegister(uint8_t reg
, uint8_t data
);
8 void STK8xxx_Suspend_mode();
9 bool STK8xxx_Check_chipid();
11 void STK8xxx_Anymotion_init();
12 void STK8xxx_Sigmotion_init();
13 void STK8xxx_Disable_Motion();
14 int STK8xxx_Initialization();
15 int STK8xxx_Get_Sensitivity();
16 void STK8xxx_Getregister_data(float *X_DataOut
, float *Y_DataOut
, float *Z_DataOut
);
19 #define STK8xxx_SLAVE_ADDRESS 0x18
21 #define STK_REG_CHIPID 0x00
22 /* STK8321 or STK8323 CHIP ID = 0x23 */
23 #define STK8xxx_CHIPID_VAL 0x23
24 #define STK8327_CHIPID_VAL 0x26
26 /* S or R resolution = 10 bit */
27 #define STK8BA50_X_CHIPID_VAL 0x86
28 #define STK8BA5X_CHIPID_VAL 0x87
30 #define STK8xxx_REG_POWMODE 0x11
31 #define STK8xxx_VAL_SLEEP_05 0b0000
32 #define STK8xxx_VAL_SLEEP_1 0b0110
33 #define STK8xxx_VAL_SLEEP_2 0b0111
34 #define STK8xxx_VAL_SLEEP_4 0b1000
35 #define STK8xxx_VAL_SLEEP_6 0b1001
36 #define STK8xxx_VAL_SLEEP_10 0b1010
37 #define STK8xxx_VAL_SLEEP_25 0b1011
38 #define STK8xxx_VAL_SLEEP_50 0b1100
39 #define STK8xxx_VAL_SLEEP_100 0b1101
40 #define STK8xxx_VAL_SLEEP_500 0b1110
41 #define STK8xxx_VAL_SLEEP_1000 0b1111
42 #define STK8xxx_VAL_LOWPOWER bit(6)
43 #define STK8xxx_VAL_SUSPEND bit(7)
45 #define STK8xxx_REG_RANGESEL 0x0F
46 #define STK8xxx_RANGE_2G 0x03
47 #define STK8xxx_RANGE_4G 0x05
48 #define STK8xxx_RANGE_8G 0x08
50 #define STK8xxx_REG_XOUT1 0x02
51 #define STK8xxx_REG_XOUT2 0x03
52 #define STK8xxx_REG_YOUT1 0x04
53 #define STK8xxx_REG_YOUT2 0x05
54 #define STK8xxx_REG_ZOUT1 0x06
55 #define STK8xxx_REG_ZOUT2 0x07
57 #define STK8xxx_REG_BWSEL 0x10
58 #define STK8xxx_VAL_BW_7_81 0b01000
59 #define STK8xxx_VAL_BW_15_63 0b01001
60 #define STK8xxx_VAL_BW_31_25 0b01010
61 #define STK8xxx_VAL_BW_62_5 0b01011
62 #define STK8xxx_VAL_BW_125 0b01100
63 #define STK8xxx_VAL_BW_250 0b01101
64 #define STK8xxx_VAL_BW_500 0b01110
65 #define STK8xxx_VAL_BW_1000 0b01111
67 #define STK8xxx_REG_SWRST 0x14
68 #define STK8xxx_VAL_RST_DFLTS 0xB6
70 #define STK8xxx_REG_INTEN1 0x16
71 #define STK8xxx_VAL_SLP_EN_X bit(0)
72 #define STK8xxx_VAL_SLP_EN_Y bit(1)
73 #define STK8xxx_VAL_SLP_EN_Z bit(2)
75 #define STK8xxx_REG_INTCFG1 0x20
76 #define STK8xxx_VAL_INT_LV bit(0)
77 #define STK8xxx_VAL_INT_OD bit(1)
79 #define STK8xxx_REG_SLOPETHD 0x28
80 #define STK8xxx_VAL_SLP_DFLT 150 // 0x14
82 #define STK8xxx_REG_SIGMOT2 0x2A
83 #define STK8xxx_VAL_SKIP_TIME bit(0)
84 #define STK8xxx_VAL_SIG_MOT_EN bit(1)
85 #define STK8xxx_VAL_ANY_MOT_EN bit(2)
87 #define STK8xxx_REG_INTMAP1 0x19
88 #define STK8xxx_VAL_SIGMOT2INT1 bit(0)
89 #define STK8xxx_VAL_ANYMOT2INT1 bit(2)
91 #define STK8xxx_REG_INTFCFG 0x34
92 #define STK8xxx_VAL_I2C_WDT_SEL bit(1)
93 #define STK8xxx_VAL_I2C_WDT_EN bit(2)