ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
FXOS8700_1.c
Go to the documentation of this file.
1 /* ###################################################################
2 ** This component module is generated by Processor Expert. Do not modify it.
3 ** Filename : FXOS8700_1.c
4 ** CDE edition : Community
5 ** Project : ISF2P2_K64F_MQX_PROJ
6 ** Processor : MK64FN1M0VLL12
7 ** Component : ISF_KSDK_Sensor_FXOS8700_ECompass
8 ** Version : Component 02.500, Driver 01.00, CPU db: 3.00.000
9 ** Repository : My Components
10 ** Compiler : GNU C Compiler
11 ** Date/Time : 2016-10-06, 13:38, # CodeGen: 0
12 ** Abstract :
13 **
14 ** Settings :
15 ** Component Name : FXOS8700_1
16 ** Device Address : 0x1E
17 ** Comm Channel : I2C1
18 ** Allowed Full-scale Ranges : ±0.244 mg/LSB
19 ** Sensor Specific Configuration : yes
20 ** XYZ_DATA_CFG : yes
21 ** HPF_OUT : 0
22 ** FS : 0
23 ** HP_FILTER_CUTOFF : yes
24 ** PULSE_HPF_BYP : 0
25 ** PULSE_LPF_EN : 0
26 ** SEL : 0
27 ** PL_CFG : yes
28 ** DBCNTM : 1
29 ** PL_EN : 0
30 ** PL_COUNT : 0
31 ** PL_BF_ZCOMP : yes
32 ** BKFR : 2
33 ** ZLOCK : 4
34 ** PL_THS_REG : yes
35 ** PL_THS : 16
36 ** HYS : 4
37 ** FF_MT_CFG : yes
38 ** ELE : 0
39 ** OAE : 0
40 ** ZEFE : 0
41 ** YEFE : 0
42 ** XEFE : 0
43 ** FF_MT_THS : yes
44 ** DBCNTM : 0
45 ** THS : 0
46 ** FF_MT_COUNT : 0
47 ** M_OFF_X : 0
48 ** M_OFF_Y : 0
49 ** M_OFF_Z : 0
50 ** ASLP_COUNT : 0
51 ** CTRL_REG1 : yes
52 ** ASLP_RATE : 0
53 ** DR : 1
54 ** LNOISE : 0
55 ** CTRL_REG2 : yes
56 ** SMODS : 0
57 ** SLPE : 0
58 ** MODS : 0
59 ** M_CTRL_REG1 : yes
60 ** M_ACAL : 0
61 ** M_HMS : 0
62 ** M_CTRL_REG3 : yes
63 ** M_RAW : 0
64 ** M_ASLP_OS : 0
65 ** M_THS_XYZ_UPDATE : 0
66 ** Contents :
67 ** No public methods
68 **
69 ** For non-commercial use only.
70 (c) Copyright <company/user-name>, 2015,
71 http://www.<company>.com
72 mail: info@<company>.com
73 ** ###################################################################*/
74 /*!
75 ** @file FXOS8700_1.c
76 ** @version 01.00
77 ** @brief
78 **
79 */
80 /*!
81 ** @addtogroup FXOS8700_1_module FXOS8700_1 module documentation
82 ** @{
83 */
84 
85 /* MODULE FXOS8700_1. */
86 
87 #include "FXOS8700_1.h"
88 
89 
91 {
92  .accelFullScaleRange = 0, // Capture the accelerometer full-scale range for use in conversion routines.
93  .mode = 0,
94  .regCount = 30, // Number of register pairs to follow
95  .regPairs =
96  {
97  { FXOS8700_INT_SOURCE, 0 },
98  // Data configuration registers.
100  { FXOS8700_HP_FILTER_CUTOFF, (FXOS8700_SET_FIELD(PULSE_HPF_BYP,0)) | (FXOS8700_SET_FIELD(PULSE_LPF_EN,0)) | (FXOS8700_SET_FIELD(SEL,0)) },
101  // Portrait Landscape registers.
102  { FXOS8700_PL_CFG, (FXOS8700_SET_FIELD(DBCNTM,1)) | (FXOS8700_SET_FIELD(PL_EN,0)) },
103  { FXOS8700_PL_COUNT, 0 },
104  { FXOS8700_PL_BF_ZCOMP, (FXOS8700_SET_FIELD(BKFR,1)) | (FXOS8700_SET_FIELD(ZLOCK,4)) },
105  { FXOS8700_PL_THS_REG, (FXOS8700_SET_FIELD(PL_THS,16)) | (FXOS8700_SET_FIELD(HYS,4)) },
106  // Freefall/Motion Detection registers.
107  { FXOS8700_FF_MT_CFG, (FXOS8700_SET_FIELD(ELE,0)) | (FXOS8700_SET_FIELD(OAE,0)) | (FXOS8700_SET_FIELD(ZEFE,0)) | (FXOS8700_SET_FIELD(YEFE,0)) | (FXOS8700_SET_FIELD(XEFE,0)) },
108  { FXOS8700_FF_MT_THS, (FXOS8700_SET_FIELD(DBCNTM,0)) | (FXOS8700_SET_FIELD(THS,0)) },
109  { FXOS8700_FF_MT_COUNT, 0 },
110  // Transient Detection registers.
111  { FXOS8700_TRANSIENT_CFG, 0 }, // Feature disabled by default (for now).
112  // Pulse Detection registers.
113  { FXOS8700_PULSE_CFG, 0 }, // Feature is disabled by default (for now).
114  // Auto-WAKE/SLEEP Detection registers.
115  { FXOS8700_ASLP_COUNT, 0 },
116  // System and Control registers.
117  { FXOS8700_CTRL_REG1, (FXOS8700_SET_FIELD(ASLP_RATE,0)) | (FXOS8700_SET_FIELD(DR,0)) | (FXOS8700_SET_FIELD(LNOISE,0)) | (FXOS8700_SET_FIELD(F_READ,0)) },
118  { FXOS8700_CTRL_REG2, (FXOS8700_SET_FIELD(SMODS,0)) | (FXOS8700_SET_FIELD(SLPE,0)) | (FXOS8700_SET_FIELD(MODS,0)) },
119  { FXOS8700_CTRL_REG3, 0 }, // Interrupt sources disabled, Active Low, Push-Pull Open Drain (defaults).
120  { FXOS8700_CTRL_REG4, 0 }, // Interrupts disabled (defaults).
121  { FXOS8700_CTRL_REG5, 0 }, // INT2 Pin (defaults).
122  // Calibration Offset registers.
123  { FXOS8700_OFF_X, 0 },
124  { FXOS8700_OFF_Y, 0 },
125  { FXOS8700_OFF_Z, 0 },
126  { FXOS8700_M_OFF_X_MSB, 0 },
127  { FXOS8700_M_OFF_X_LSB, 0 },
128  { FXOS8700_M_OFF_Y_MSB, 0 },
129  { FXOS8700_M_OFF_Y_LSB, 0 },
130  { FXOS8700_M_OFF_Z_MSB, 0 },
131  { FXOS8700_M_OFF_Z_LSB, 0 },
132  { FXOS8700_M_CTRL_REG1, (FXOS8700_SET_FIELD(M_ACAL,0)) | (FXOS8700_SET_FIELD(M_HMS,0)) },
133  { FXOS8700_M_CTRL_REG2, (FXOS8700_SET_FIELD(M_AUTOINC,0)) | (FXOS8700_SET_FIELD(M_RST_CNT,3)) },
134  { FXOS8700_M_CTRL_REG3, (FXOS8700_SET_FIELD(M_RAW,0)) | (FXOS8700_SET_FIELD(M_ASLP_OS,0)) | (FXOS8700_SET_FIELD(M_THS_XYZ_UPDATE,0)) }
135  }
136  };
137 
138 /*!
139  * @brief This creates the sensor adapter instance for the target sensor.
140  *
141  */
143 {
145  .devInfo.pSupportedSensorDataTypes = fxos8700_SupportedDataTypes,
146  .devInfo.nNativeDataSetSize = sizeof(fxos8700_DataBuffer_t),
147  .control.Initialize = &fsl_fxos8700_i2cspi_6D_AccMag_Initialize,
148  .control.ValidateSettings = &fsl_fxos8700_i2cspi_6D_AccMag_ValidateSettings,
149  .control.Configure = &fsl_fxos8700_i2cspi_6D_AccMag_Configure,
150  .control.StartData = &fsl_fxos8700_i2cspi_6D_AccMag_StartData,
151  .control.EndData = &fsl_fxos8700_i2cspi_6D_AccMag_EndData,
152  .control.Calibrate = &fsl_fxos8700_i2cspi_6D_AccMag_Calibrate,
153  .control.Shutdown = &fsl_fxos8700_i2cspi_6D_AccMag_Shutdown,
154  .control.Convert = &fsl_fxos8700_i2cspi_6D_AccMag_Convert
155 };
156 
157 const i2c_device_t FXOS8700_1_DeviceInfo =
158 {
159  .baudRate_kbps = 400, // default baud rate (kbps).
160  .address = 30 // instance specific device address.
161 };
162 
163 
164 /* END FXOS8700_1. */
165 
166 /*!
167 ** @}
168 */
169 /*
170 ** ###################################################################
171 **
172 ** This file was created by Processor Expert 10.5 [05.21]
173 ** for the Freescale Kinetis series of microcontrollers.
174 **
175 ** ###################################################################
176 */
#define FXOS8700_SET_FIELD(name, val)
Definition: fxos8700.h:144
This structure defines the dummy DSA data buffer format.
const i2c_device_t FXOS8700_1_DeviceInfo
This allows access to the sensor communications specific configuration.
Definition: FXOS8700_1.c:157
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_Initialize(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXOS8700 sensor adapter initialization.
isf_SensorTypes_t fxos8700_SupportedSensorTypes[]
Supported sensor and data types for FXOS8700.
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the FXOS8700 sensor adapter for configuration.
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_StartData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXOS8700 sensor adapter for start Data.
isf_dsa_DeviceInfoBlock_t devInfo
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
This is the concrete implementation of the FXOS8700 sensor adapter for calibration ...
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_Convert(volatile isf_SensorHandle_t *pSensorHandle, isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType, void *pNativeSample, void *pConvertedSample, int32 *numBytes)
This function coverts the raw sample data to the desired output type.
This defines the DSA adapter structure required for static initialization of the concrete instance of...
isf_SensorTypes_t * pSupportedSensorTypes
isf_SensorDataTypes_t fxos8700_SupportedDataTypes[]
const isf_dsa_Adapter_t FXOS8700_1_Adapter
This creates the sensor adapter instance for the target sensor.
Definition: FXOS8700_1.c:142
fxos8700_Sensor_Specific_Settings_t FXOS8700_1_Sensor_Specific_Config
This allows access to the sensor specific configuration for the target sensor.
Definition: FXOS8700_1.c:90
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_Shutdown(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXOS8700 sensor adapter for shutdown . ...
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_EndData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXOS8700 sensor adapter for End Data.
isf_dsa_status_t fsl_fxos8700_i2cspi_6D_AccMag_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the FXOS8700 sensor adapter for validating current settings...