| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mpl3115.h
Go to the documentation of this file.
1 /**
2 * @file mpl3115.h
3 * @brief The \b mpl3115.h contains the MPL3115 Pressure sensor register definitions, access macros, and
4 * device access functions.
5 *
6 * @copyright Copyright (c) 2014, Freescale Semiconductor, Inc.
7 */
8 #ifndef _MPL3115_H_
9 #define _MPL3115_H_
10
11 #include "isf_types.h"
12 #include "isf.h"
13 #include "isf_devmsg.h"
14 #include "fsl_mpl3115_i2c_1D_press.h"
15
16 /***********************************************************************************************\
17 * Public macros
18 \***********************************************************************************************/
19
20 #define MPL3115_IIC_ADDRESS 0x60 /*MPL3115A2 Address*/
21
22 /***********************************************************************************************
23 **
24 ** MPL3115 Sensor Internal Registers
25 */
26 enum
27 {
28 MPL3115_STATUS_00 = 0, // 0x00
29 MPL3115_OUT_P_MSB, // 0x01
30 MPL3115_OUT_P_CSB, // 0x02
31 MPL3115_OUT_P_LSB, // 0x03
32 MPL3115_OUT_T_MSB, // 0x04
33 MPL3115_OUT_T_LSB, // 0x05
34 MPL3115_OUT_DR_STATUS, // 0x06
35 MPL3115_OUT_P_DELTA_MSB, // 0x07
36 MPL3115_OUT_P_DELTA_CSB, // 0x08
37 MPL3115_OUT_P_DELTA_LSB, // 0x09
38 MPL3115_OUT_T_DELTA_MSB, // 0x0A
39 MPL3115_OUT_T_DELTA_LSB, // 0x0B
40 MPL3115_WHO_AM_I, // 0x0C
41 MPL3115_F_STATUS, // 0x0D
42 MPL3115_F_DATA, // 0x0E
43 MPL3115_F_SETUP, // 0x0F
44 MPL3115_TIME_DLY, // 0x10
45 MPL3115_SYSMOD, // 0x11
46 MPL3115_INT_SOURCE, // 0x12
47 MPL3115_PT_DATA_CFG, // 0x13
48 MPL3115_BAR_IN_MSB, // 0x14
49 MPL3115_BAR_IN_LSB, // 0x15
50 MPL3115_P_ARM_MSB, // 0x16
51 MPL3115_P_ARM_LSB, // 0x17
52 MPL3115_T_ARM, // 0x18
53 MPL3115_P_ARM_WND_MSB, // 0x19
54 MPL3115_P_ARM_WND_LSB, // 0x1A
55 MPL3115_T_ARM_WND, // 0x1B
56 MPL3115_P_MIN_MSB, // 0x1C
57 MPL3115_P_MIN_CSB, // 0x1D
58 MPL3115_P_MIN_LSB, // 0x1E
59 MPL3115_T_MIN_MSB, // 0x1F
60 MPL3115_T_MIN_LSB, // 0x20
61 MPL3115_P_MAX_MSB, // 0x21
62 MPL3115_P_MAX_CSB, // 0x22
63 MPL3115_P_MAX_LSB, // 0x23
64 MPL3115_T_MAX_MSB, // 0x24
65 MPL3115_T_MAX_LSB, // 0x25
66 MPL3115_CTRL_REG1, // 0x26
67 MPL3115_CTRL_REG2, // 0x27
68 MPL3115_CTRL_REG3, // 0x28
69 MPL3115_CTRL_REG4, // 0x29
70 MPL3115_CTRL_REG5, // 0x2A
71 MPL3115_OFF_P, // 0x2B
72 MPL3115_OFF_T, // 0x2C
73 MPL3115_OFF_H // 0x2D
74 };
75
76 /*
77 * General purpose macros to set/get a specific bit field within a register.
78 * The macro assumes that the root identifier for the field is a consistent character string (e.g., "BIT_FIELD").
79 * The bit field mask is the character string followed by "_MASK" (e.g., BIT_FIELD_MASK).
80 * The bit field shift is the character string followed by "_SHIFT" (e.g., BIT_FIELD_SHIFT).
81 */
82 #define MPL3115_SET_FIELD(name,val) (((val)<<MPL3115_##name##_SHIFT)&(MPL3115_##name##_MASK))
83 #define MPL3115_GET_FIELD(name,val) ((val&MPL3115_##name##_MASK)>>MPL3115_##name##_SHIFT)
84
85 /*
86 ** STATUS_00 Register
87 */
88 #define STATUS_00_REG 0x00
89 #define DR_STATUS_00_REG 0x06
90 //
91 #define MPL3115_PTOW_MASK 0x80
92 #define MPL3115_PTOW_SHIFT 7
93 #define MPL3115_PTDR_MASK 0x08
94 #define MPL3115_PTDR_SHIFT 3
95 #define MPL3115_PDR_MASK 0x04
96 #define MPL3115_PDR_SHIFT 2
97 #define MPL3115_TDR_MASK 0x02
98 #define MPL3115_TDR_SHIFT 1
99 /*
100 ** WHO_AM_I Register
101 */
102 #define MPL3115_WHOAMI_VALUE 0xC4
103
104 /*
105 ** SYSMOD System Mode Register
106 */
107 #define MPL3115_SYSMOD_MASK 0x01
108 #define MPL3115_SYSMOD_SHIFT 0
109 #define MPL3115_ACTIVE_MASK 1
110
111 /*
112 ** INT_SOURCE System Interrupt Status Register
113 */
114 #define MPL3115_SRC_DRDY_MASK 0x80
115 #define MPL3115_SRC_DRDY_SHIFT 7
116 #define MPL3115_SRC_PW_MASK 0x20
117 #define MPL3115_SRC_PW_SHIFT 5
118 #define MPL3115_SRC_TW_MASK 0x10
119 #define MPL3115_SRC_TW_SHIFT 4
120 #define MPL3115_SRC_PTH_MASK 0x08
121 #define MPL3115_SRC_PTH_SHIFT 3
122 #define MPL3115_SRC_TTH_MASK 0x04
123 #define MPL3115_SRC_TTH_SHIFT 2
124 #define MPL3115_SRC_PCHG_MASK 0x02
125 #define MPL3115_SRC_PCHG_SHIFT 1
126 #define MPL3115_SRC_TCHG_MASK 0x01
127 #define MPL3115_SRC_TCHG_SHIFT 0
128
129 /*
130 ** PT_DATA_CFG Sensor Data Configuration Register
131 */
132 #define MPL3115_DREM_MASK 0x04
133 #define MPL3115_DREM_SHIFT 2
134 #define MPL3115_PDEFE_MASK 0x02
135 #define MPL3115_PDEFE_SHIFT 1
136 #define MPL3115_TDEFE_MASK 0x01
137 #define MPL3115_TDEFE_SHIFT 0
138
139 /*
140 ** CTRL_REG1 Interrupt Control Register
141 */
142 #define MPL3115_ALT_MASK 0x80
143 #define MPL3115_ALT_SHIFT 7
144 #define MPL3115_RAW_MASK 0x40
145 #define MPL3115_RAW_SHIFT 6
146 #define MPL3115_OS_MASK 0x38
147 #define MPL3115_OS_SHIFT 3
148 #define MPL3115_RST_MASK 0x04
149 #define MPL3115_RST_SHIFT 2
150 #define MPL3115_OST_MASK 0x02
151 #define MPL3115_OST_SHIFT 1
152 #define MPL3115_SBYB_MASK 0x01
153 #define MPL3115_SBYB_SHIFT 0
154
155 /*
156 ** CTRL_REG2 Interrupt Control Register
157 */
158 #define MPL3115_LOAD_OUT_MASK 0x20
159 #define MPL3115_LOAD_OUT_SHIFT 5
160 #define MPL3115_ALARM_SEL_MASK 0x10
161 #define MPL3115_ALARM_SEL_SHIFT 4
162 #define MPL3115_ST_MASK 0x0F
163 #define MPL3115_ST_SHIFT 0
164
165 /*
166 ** CTRL_REG3 Interrupt Control Register
167 */
168 #define MPL3115_IPOL1_MASK 0x20
169 #define MPL3115_IPOL1_SHIFT 5
170 #define MPL3115_PP_OD1_MASK 0x10
171 #define MPL3115_PP_OD1_SHIFT 4
172 #define MPL3115_IPOL2_MASK 0x02
173 #define MPL3115_IPOL2_SHIFT 1
174 #define MPL3115_PP_OD2_MASK 0x01
175 #define MPL3115_PP_OD2_SHIFT 0
176
177 /*
178 ** CTRL_REG4 Interrupt Control Register
179 */
180 #define MPL3115_INT_EN_DRDY_MASK 0x80
181 #define MPL3115_INT_EN_DRDY_SHIFT 7
182 #define MPL3115_INT_EN_PW_MASK 0x20
183 #define MPL3115_INT_EN_PW_SHIFT 5
184 #define MPL3115_INT_EN_TW_MASK 0x10
185 #define MPL3115_INT_EN_TW_SHIFT 4
186 #define MPL3115_INT_EN_PTH_MASK 0x08
187 #define MPL3115_INT_EN_PTH_SHIFT 3
188 #define MPL3115_INT_EN_TTH_MASK 0x04
189 #define MPL3115_INT_EN_TTH_SHIFT 2
190 #define MPL3115_INT_EN_PCHG_MASK 0x02
191 #define MPL3115_INT_EN_PCHG_SHIFT 1
192 #define MPL3115_INT_EN_TCHG_MASK 0x01
193 #define MPL3115_INT_EN_TCHG_SHIFT 0
194 /*
195 ** CTRL_REG5 Interrupt Control Register
196 */
197 #define MPL3115_INT_CFG_DRDY_MASK 0x80
198 #define MPL3115_INT_CFG_DRDY_SHIFT 7
199 #define MPL3115_INT_CFG_PW_MASK 0x20
200 #define MPL3115_INT_CFG_PW_SHIFT 5
201 #define MPL3115_INT_CFG_TW_MASK 0x10
202 #define MPL3115_INT_CFG_TW_SHIFT 4
203 #define MPL3115_INT_CFG_PTH_MASK 0x08
204 #define MPL3115_INT_CFG_PTH_SHIFT 3
205 #define MPL3115_INT_CFG_TTH_MASK 0x04
206 #define MPL3115_INT_CFG_TTH_SHIFT 2
207 #define MPL3115_INT_CFG_PCHG_MASK 0x02
208 #define MPL3115_INT_CFG_PCHG_SHIFT 1
209 #define MPL3115_INT_CFG_TCHG_MASK 0x01
210 #define MPL3115_INT_CFG_TCHG_SHIFT 0
211
212
213
214 /*
215 * Public Types
216 */
217
218 // Define the MPL3115 functional interface status return type.
219 typedef enum
220 {
221 MPL3115_SUCCESS,
222 MPL3115_ERROR
223 } mpl3115_status_t;
224
225 typedef struct
226 {
227 uint8 regAddr;
228 uint8 regValue;
229 } mpl3115_Sensor_Specific_Reg_t;
230
231 typedef struct
232 {
233 uint32 regCount;
234 mpl3115_Sensor_Specific_Reg_t regPairs[];
235 } mpl3115_Sensor_Specific_Settings_t;
236
237
238 #endif /* _MPL3115_H_ */
MPL3115_T_ARM_WND
Definition: mpl3115.h:55
MPL3115_P_MIN_MSB
Definition: mpl3115.h:56
uint8
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
mpl3115_Sensor_Specific_Reg_t
Definition: mpl3115.h:225
MPL3115_PT_DATA_CFG
Definition: mpl3115.h:47
MPL3115_P_MIN_LSB
Definition: mpl3115.h:58
MPL3115_CTRL_REG3
Definition: mpl3115.h:68
MPL3115_T_MAX_MSB
Definition: mpl3115.h:64
uint32
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
MPL3115_OUT_P_DELTA_CSB
Definition: mpl3115.h:36
MPL3115_P_MAX_CSB
Definition: mpl3115.h:62
MPL3115_P_MIN_CSB
Definition: mpl3115.h:57
MPL3115_F_STATUS
Definition: mpl3115.h:41
MPL3115_P_ARM_WND_LSB
Definition: mpl3115.h:54
mpl3115_Sensor_Specific_Reg_t::regValue
uint8 regValue
Definition: mpl3115.h:228
MPL3115_OFF_P
Definition: mpl3115.h:71
isf_types.h
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
mpl3115_Sensor_Specific_Settings_t
Definition: mpl3115.h:231
MPL3115_OUT_T_LSB
Definition: mpl3115.h:33
MPL3115_F_DATA
Definition: mpl3115.h:42
mpl3115_Sensor_Specific_Reg_t::regAddr
uint8 regAddr
Definition: mpl3115.h:227
MPL3115_P_ARM_WND_MSB
Definition: mpl3115.h:53
MPL3115_WHO_AM_I
Definition: mpl3115.h:40
mpl3115_status_t
mpl3115_status_t
Definition: mpl3115.h:219
MPL3115_P_ARM_MSB
Definition: mpl3115.h:50
MPL3115_OUT_P_DELTA_MSB
Definition: mpl3115.h:35
MPL3115_OUT_P_CSB
Definition: mpl3115.h:30
MPL3115_CTRL_REG4
Definition: mpl3115.h:69
MPL3115_BAR_IN_MSB
Definition: mpl3115.h:48
MPL3115_STATUS_00
Definition: mpl3115.h:28
MPL3115_INT_SOURCE
Definition: mpl3115.h:46
fsl_mpl3115_i2c_1D_press.h
The fsl_mpl3115_i2c_1D_press.h file contains the definitions and functions supporting the MMA8652 Sen...
MPL3115_P_MAX_LSB
Definition: mpl3115.h:63
MPL3115_OUT_P_LSB
Definition: mpl3115.h:31
MPL3115_P_MAX_MSB
Definition: mpl3115.h:61
MPL3115_CTRL_REG1
Definition: mpl3115.h:66
MPL3115_P_ARM_LSB
Definition: mpl3115.h:51
MPL3115_OUT_T_MSB
Definition: mpl3115.h:32
isf.h
Main ISF header file. Contains code common to all ISF components.
MPL3115_ERROR
Definition: mpl3115.h:222
MPL3115_T_ARM
Definition: mpl3115.h:52
MPL3115_BAR_IN_LSB
Definition: mpl3115.h:49
MPL3115_OUT_P_MSB
Definition: mpl3115.h:29
MPL3115_OUT_DR_STATUS
Definition: mpl3115.h:34
MPL3115_T_MIN_MSB
Definition: mpl3115.h:59
MPL3115_TIME_DLY
Definition: mpl3115.h:44
MPL3115_SUCCESS
Definition: mpl3115.h:221
MPL3115_T_MAX_LSB
Definition: mpl3115.h:65
MPL3115_CTRL_REG2
Definition: mpl3115.h:67
MPL3115_SYSMOD
Definition: mpl3115.h:45
MPL3115_OUT_T_DELTA_LSB
Definition: mpl3115.h:39
MPL3115_OUT_P_DELTA_LSB
Definition: mpl3115.h:37
MPL3115_OFF_H
Definition: mpl3115.h:73
MPL3115_T_MIN_LSB
Definition: mpl3115.h:60
MPL3115_CTRL_REG5
Definition: mpl3115.h:70
MPL3115_OUT_T_DELTA_MSB
Definition: mpl3115.h:38
isf_devmsg.h
isf_devmsg.h defines the API definitions and types for the Intelligent Sensing (ISF) Device Messaging...
mpl3115_Sensor_Specific_Settings_t::regCount
uint32 regCount
Definition: mpl3115.h:233
MPL3115_F_SETUP
Definition: mpl3115.h:43
MPL3115_OFF_T
Definition: mpl3115.h:72
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.