ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
mma8491q.h
Go to the documentation of this file.
1 /**
2  * @file mma8491q.h
3  * @brief The \b mma8491q.h contains register definitions and macros as well as the type definitions
4  * and public functions for the lowest level interface to the MMA865x family of parts.
5  *
6  * @copyright Copyright (c) 2015, Freescale Semiconductor, Inc.
7  */
8 #ifndef _MMA8491Q_H_
9 #define _MMA8491Q_H_
10 
11 #include <stdint.h>
12 
13 /*
14  * Sensor ID
15  */
16 #define MMA8491Q_WHOAMI_VALUE (0x55)
17 
18 /*
19  * General purpose macros to set/get a specific bit field within a register.
20  * The macro assumes that the root identifier for the field is a consistent character string (e.g., "BIT_FIELD").
21  * The bit field mask is the character string followed by "_MASK" (e.g., BIT_FIELD_MASK).
22  * The bit field shift is the character string followed by "_SHIFT" (e.g., BIT_FIELD_SHIFT).
23  */
24 #define SET_FIELD(name,val) (((val)<<name##_SHIFT)&(name##_MASK))
25 #define GET_FIELD(name,val) ((val&name##_MASK)>>name##_SHIFT)
26 
27 /*
28 ** STATUS Register
29 */
30 #define ZYXOW_MASK 0x80
31 #define ZYXOW_SHIFT 7
32 #define ZOW_MASK 0x40
33 #define YOW_MASK 0x20
34 #define XOW_MASK 0x10
35 #define ZYXDR_MASK 0x08
36 #define ZYXDR_SHIFT 3
37 #define ZDR_MASK 0x04
38 #define YDR_MASK 0x02
39 #define XDR_MASK 0x01
40 
41 /*
42  * Public Types
43  */
44 
45 /*
46  * MMA8491Q Sensor Internal Registers
47  */
48 enum
49 {
50  MMA8491Q_STATUS_00 = 0, // 0x00 - status register x,y,z,xyz
51  MMA8491Q_OUT_X_MSB, // 0x01 - data register address1
52  MMA8491Q_OUT_X_LSB, // 0x02 - data register address2
53  MMA8491Q_OUT_Y_MSB, // 0x03 - data register address3
54  MMA8491Q_OUT_Y_lSB, // 0x04 - data register address4
55  MMA8491Q_OUT_Z_MSB, // 0x05 - data register address5
56  MMA8491Q_OUT_Z_LSB, // 0x06 - data register address6
57 };
58 
59 /*! @brief Define the MMA8491Q functional interface status return type. */
60 enum
61 {
64 };
65 
66 // These are the modes of the MMA8498Q device according to the Freescale Specification
67 typedef enum
68 {
72 
74 
75 typedef struct
76 {
77  uint32_t padding;
79 
80 
81 #endif /* _MMA8491Q_H_ */
mma8491q_mode_t
Definition: mma8491q.h:67