Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/Pmods/PmodACL2/ADXL362.h

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ADXL362.h
3 * @brief Header file of ADXL362 Driver.
4 * @author ATofan ([email protected])
5 ********************************************************************************
6 * Copyright 2012(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 ********************************************************************************
40 * SVN Revision: $WCREV$
41 *******************************************************************************/
42 #ifndef ADXL362_H_
43 #define ADXL362_H_
44
45 #include "xparameters.h"
46 #include "system_config.h"
47
48 /******************************************************************************/
49 /* ADXL362 */
50 /******************************************************************************/
51 // ADXL362 Registers
52 #define ADXL362_DEVID_AD 0x00
53 #define ADXL362_DEVID_MST 0x01
54 #define ADXL362_PARTID 0x02
55 #define ADXL362_REVID 0x03
56 #define ADXL362_XDATA 0x08
57 #define ADXL362_YDATA 0x09
58 #define ADXL362_ZDATA 0x0A
59 #define ADXL362_STATUS 0x0B
60 #define ADXL362_FIFO_ENTRIES_L 0x0C
61 #define ADXL362_FIFO_ENTRIES_H 0x0D
62 #define ADXL362_XDATA_L 0x0E
63 #define ADXL362_XDATA_H 0x0F
64 #define ADXL362_YDATA_L 0x10
65 #define ADXL362_YDATA_H 0x11
66 #define ADXL362_ZDATA_L 0x12
67 #define ADXL362_ZDATA_H 0x13
68 #define ADXL362_TEMP_L 0x14
69 #define ADXL362_TEMP_H 0x15
70 #define ADXL362_SOFT_RESET 0x1F
71 #define ADXL362_THRESH_ACT_L 0x20
72 #define ADXL362_THRESH_ACT_H 0x21
73 #define ADXL362_TIME_ACT 0x22
74 #define ADXL362_THRESH_INACT_L 0x23
75 #define ADXL362_THRESH_INACT_H 0x24
76 #define ADXL362_TIME_INACT_H 0x25
77 #define ADXL362_TIM_INACT_L 0x26
78 #define ADXL362_ACT_INACT_CTL 0x27
79 #define ADXL362_FIFO_CONTROL 0x28
80 #define ADXL362_FIFO_SAMPLES 0x29
81 #define ADXL362_INTMAP1 0x2A
82 #define ADXL362_INTMAP2 0x2B
83 #define ADXL362_FILTER_CTL 0x2C
84 #define ADXL362_POWER_CTL 0x2D
85 #define ADXL362_SELF_TEST 0x2E
86
87 // Register specific bits
88 // Device ID Register 0x00 - Read value should be 0xAD
89
90 // Device ID Register 0x01 - Read value should be 0x1D
91
92 // Part ID Register 0x02 - Read value should be 0xF2
93
94 // Silicon Revision ID Register 0x03 - Read value should be 0x01
95
96 // X-AXIS Data Register 0x08 - Used to read 8 MSB in Power conscious applications
97
98 // Y-AXIS Data Register 0x09 - Used to read 8 MSB in Power conscious applications
99
100 // Z-AXIS Data Register 0x0A - Used to read 8 MSB in Power conscious applications
101
102 // Status Register 0x0B
103 #define ADXL362_ERR_USER_REGS 7
104 #define ADXL362_AWAKE 6
105 #define ADXL362_INACT 5
106 #define ADXL362_ACT 4
107 #define ADXL362_FIFO_OVERRUN 3
108 #define ADXL362_FIFO_WATERMARK 2
109 #define ADXL362_FIFO_READY 1
110 #define ADXL362_DATA_READY 0
111
112 // FIFO Entries L Register 0x0C - Contains number of FIFO Entries in FIFO Buffer (0 to 512)
113 // FIFO Entries H Register 0x0D [15:10] are unused
114
115 // X-AXIS Data Register L and H 0x0E and 0x0F
116
117 // Y-AXIS Data Register L and H 0x10 and 0x11
118
119 // Z-AXIS Data Register L and H 0x12 and 0x13
120
121 // Temperature Register L and H 0x14 and 0x15
122
123 // Software Reset Register
124 #define ADXL362_RESET_CMD 0x52
125
126 // Activity Threshold Register L and H 0x20 and 0x21
127
128 // Activity Timer Register 0x22
129
130 // Inactivity Threshold Register L and H 0x23 and 0x24
131
132 // Inactivity Timer Register L and H 0x25 and 0x26
133
134 // Activity / Inactivity Control Register 0x27
135 #define ADXL362_LINKLOOP 4
136 #define ADXL362_INACT_REF 3
137 #define ADXL362_INACT_EN 2
138 #define ADXL362_ACT_REF 1
139 #define ADXL362_ACT_EN 0
140
141 // FIFO Control Register 0x28
142 #define ADXL362_AH 3
143 #define ADXL362_FIFO_TEMP 2
144 #define ADXL362_FIFO_MODE 0
145
146 // FIFO Samples Register 0x29
147
148 // INT1/INT2 Function Map Registers 0x2A and 0x2B
149 #define ADXL362_INT_LOW 7
150 #define ADXL362_AWAKE 6
151 #define ADXL362_INACT 5
152 #define ADXL362_ACT 4
153 #define ADXL362_FIFO_OVERRUN 3
154 #define ADXL362_FIFO_WATERMARK 2
155 #define ADXL362_FIFO_READY 1
156 #define ADXL362_DATA_READY 0
157
158 // Filter Control Register 0x2C
159 #define ADXL362_RANGE 6
160 #define ADXL362_HALF_BW 4
161 #define ADXL362_EXT_SAMPLE 3
162 #define ADXL362_ODR 0
163
164 // Power Control Register 0x2D
165 #define ADXL362_EXT_CLK 6
166 #define ADXL362_LOW_NOISE 4
167 #define ADXL362_WAKEUP 3
168 #define ADXL362_AUTOSLEEP 2
169 #define ADXL362_MEASURE 0
170
171 // Self Test Register 0x2E
172 #define ADXL362_ST 1
173
174 void delay_ms(u32 ms_count);
175 void ADXL362_DisplayMainMenu(void);
176 void ADXL362_DisplayMenu(void);
177 void ADXL362_Display(int whole, int thousands, int sign, char temp);
178 void ADXL362_WriteReg(char addr, char data);
179 char ADXL362_ReadReg(char addr);
180 void ADXL362_PrintID(void);
181 int ADXL362_ReadTemp(void);
182 void ADXL362_PrintTemp(void);
183 char ADXL362_IsDataReady(void);
184 char ADXL362_ReadXSmall(void);
185 char ADXL362_ReadYSmall(void);
186 char ADXL362_ReadZSmall(void);
187 void ADXL362_PrintSmall(char axis);
188 void ADXL362_DisplayAllSmall(void);
189 int ADXL362_ReadX(void);
190 int ADXL362_ReadY(void);
191 int ADXL362_ReadZ(void);
192 void ADXL362_Print(char axis);
193 void ADXL362_DisplayAll(void);
194 void ADXL362_SwitchRes(void);
195 void ADXL362_SetRange(void);
196 void ADXL362_Init(void);
197 void DemoProgram(void);
198
199
200 #endif /* ADXL362_H_ */