ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 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"
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
42  MPL3115_F_DATA, // 0x0E
43  MPL3115_F_SETUP, // 0x0F
45  MPL3115_SYSMOD, // 0x11
52  MPL3115_T_ARM, // 0x18
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 {
224 
225 typedef struct
226 {
230 
231 typedef struct
232 {
236 
237 
238 #endif /* _MPL3115_H_ */
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
mpl3115_status_t
Definition: mpl3115.h:219
The fsl_mpl3115_i2c_1D_press.h file contains the definitions and functions supporting the MMA8652 Sen...
Main ISF header file. Contains code common to all ISF components.
isf_devmsg.h defines the API definitions and types for the Intelligent Sensing (ISF) Device Messaging...