ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
FXLS8471_2.c
Go to the documentation of this file.
1 /* ###################################################################
2 ** This component module is generated by Processor Expert. Do not modify it.
3 ** Filename : FXLS8471_2.c
4 ** CDE edition : Community
5 ** Project : ISF2P2_K64F_MQX_PROJ
6 ** Processor : MK64FN1M0VLL12
7 ** Component : ISF_KSDK_Sensor_FXLS8471_Accelerometer
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 : FXLS8471_2
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 ** A_FFMT_CFG : yes
38 ** A_FFMT_ELE : 0
39 ** A_FFMT_OAE : 0
40 ** A_FFMT_ZEFE : 0
41 ** A_FFMT_YEFE : 0
42 ** A_FFMT_XEFE : 0
43 ** A_FFMT_THS : yes
44 ** A_FFMT_DBCNTM : 0
45 ** THS : 0
46 ** A_FFMT_COUNT : 0
47 ** PULSE_THSX : 0
48 ** PULSE_THSY : 0
49 ** PULSE_THSZ : 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 ** OFF_X : 0
60 ** OFF_Y : 0
61 ** OFF_Z : 0
62 ** A_VECM_CFG : yes
63 ** A_VECM_ELE : 0
64 ** A_VECM_INITM : 0
65 ** A_VECM_UPDM : 0
66 ** A_VECM_EN : 0
67 ** A_VECM_THS : yes
68 ** A_VECM_DBCNTM : 0
69 ** A_VECM_THS : 0
70 ** A_VECM_CNT : 0
71 ** A_VECM_INITX : 0
72 ** A_VECM_INITY : 0
73 ** A_VECM_INITZ : 0
74 ** A_FFMT_THS_X : yes
75 ** A_FFMT_THS_XYZ_EN : 0
76 ** A_FFMT_THS_X : 0
77 ** A_FFMT_THS_Y : 0
78 ** A_FFMT_THS_Z : 0
79 ** Contents :
80 ** No public methods
81 **
82 ** For non-commercial use only.
83 (c) Copyright <company/user-name>, 2015,
84 http://www.<company>.com
85 mail: info@<company>.com
86 ** ###################################################################*/
87 /*!
88 ** @file FXLS8471_2.c
89 ** @version 01.00
90 ** @brief
91 **
92 */
93 /*!
94 ** @addtogroup FXLS8471_2_module FXLS8471_2 module documentation
95 ** @{
96 */
97 
98 /* MODULE FXLS8471_2. */
99 
100 #include "FXLS8471_2.h"
101 #include "isf_target.h"
102 #include "isf.h"
103 #include "isf_util.h"
104 
105 
107 {
108  .accelFullScaleRange = 0, // Capture the accelerometer full-scale range for use in conversion routines.
109  .regCount = 41, // Number of register pairs to follow
110  .regPairs =
111  {
112  { FXLS8471_F_SETUP, 0 },
113  { FXLS8471_TRIG_CFG, 0 },
114  // Data configuration registers.
115  { FXLS8471_XYZ_DATA_CFG, (FXLS8471_SET_FIELD(HPF_OUT,0)) | (FXLS8471_SET_FIELD(FS,0)) },
116  { FXLS8471_HP_FILTER_CUTOFF, (FXLS8471_SET_FIELD(PULSE_HPF_BYP,0)) | (FXLS8471_SET_FIELD(PULSE_LPF_EN,0)) | (FXLS8471_SET_FIELD(SEL,0)) },
117  // Portrait Landscape registers.
118  { FXLS8471_PL_CFG, (FXLS8471_SET_FIELD(DBCNTM,1)) | (FXLS8471_SET_FIELD(PL_EN,0)) },
119  { FXLS8471_PL_COUNT, 0 },
120  { FXLS8471_PL_BF_ZCOMP, (FXLS8471_SET_FIELD(BKFR,1)) | (FXLS8471_SET_FIELD(ZLOCK,4)) },
121  { FXLS8471_PL_THS, (FXLS8471_SET_FIELD(PL_THS,16)) | (FXLS8471_SET_FIELD(HYS,4)) },
122  { FXLS8471_PULSE_THSX, 0 },
123  { FXLS8471_PULSE_THSY, 0 },
124  { FXLS8471_PULSE_THSZ, 0 },
125  // Freefall/Motion Detection registers.
126  { FXLS8471_FFMT_CFG, (FXLS8471_SET_FIELD(A_FFMT_ELE,0)) | (FXLS8471_SET_FIELD(A_FFMT_OAE,0)) | (FXLS8471_SET_FIELD(A_FFMT_ZEFE,0)) | (FXLS8471_SET_FIELD(A_FFMT_YEFE,0)) | (FXLS8471_SET_FIELD(A_FFMT_XEFE,0)) },
127  { FXLS8471_FFMT_THS, (FXLS8471_SET_FIELD(A_FFMT_DBCNTM,0)) | (FXLS8471_SET_FIELD(A_FFMT_THS,0)) },
128  { FXLS8471_A_FFMT_THS_X_MSB, (FXLS8471_SET_FIELD(A_FFMT_THS_XYZ_EN,0) | 0 ) },
134  { FXLS8471_FFMT_COUNT, 0 },
135  // Transient Detection registers.
136  { FXLS8471_TRANSIENT_CFG, 0 }, // Feature disabled by default (for now).
137  // Pulse Detection registers.
138  { FXLS8471_PULSE_CFG, 0 }, // Feature is disabled by default (for now).
139  // Auto-WAKE/SLEEP Detection registers.
140  { FXLS8471_ASLP_COUNT, 0 },
141  // System and Control registers.
142  { FXLS8471_CTRL_REG1, (FXLS8471_SET_FIELD(ASLP_RATE,0)) | (FXLS8471_SET_FIELD(DR,0)) | (FXLS8471_SET_FIELD(LNOISE,0)) | (FXLS8471_SET_FIELD(FREAD,0)) },
143  { FXLS8471_CTRL_REG2, (FXLS8471_SET_FIELD(SMODS,0)) | (FXLS8471_SET_FIELD(SLPE,0)) | (FXLS8471_SET_FIELD(MODS,0)) },
144  { FXLS8471_CTRL_REG3, 0 }, // Interrupt sources disabled, Active Low, Push-Pull Open Drain (defaults).
145  { FXLS8471_CTRL_REG4, 0 }, // Interrupts disabled (defaults).
146  { FXLS8471_CTRL_REG5, 0 }, // INT2 Pin (defaults).
147  // Calibration Offset registers.
148  { FXLS8471_OFF_X, 0 },
149  { FXLS8471_OFF_Y, 0 },
150  { FXLS8471_OFF_Z, 0 },
151  // Vector Magnitude Configuration registers.
152  { FXLS8471_A_VECM_CFG, (FXLS8471_SET_FIELD(A_VECM_ELE,0)) | (FXLS8471_SET_FIELD(A_VECM_INITM,0)) | (FXLS8471_SET_FIELD(A_VECM_UPDM,0)) | (FXLS8471_SET_FIELD(A_VECM_EN,0)) },
153  { FXLS8471_A_VECM_THS_MSB, (FXLS8471_SET_FIELD(A_VECM_DBCNTM,0)) | (FXLS8471_SET_FIELD(A_VECM_THS_MSB, 0)) },
155  { FXLS8471_A_VECM_CNT, 0 },
162  }
163  };
164 
165 /*!
166  * @brief This creates the sensor adapter instance for the target sensor.
167  *
168  */
170 {
172  .devInfo.pSupportedSensorDataTypes = fxls8471_SupportedDataTypes,
173  .devInfo.nNativeDataSetSize = sizeof(fxls8471_DataBuffer_t),
174  .control.Initialize = &fsl_fxls8471_i2cspi_3D_accel_Initialize,
175  .control.ValidateSettings = &fsl_fxls8471_i2cspi_3D_accel_ValidateSettings,
176  .control.Configure = &fsl_fxls8471_i2cspi_3D_accel_Configure,
177  .control.StartData = &fsl_fxls8471_i2cspi_3D_accel_StartData,
178  .control.EndData = &fsl_fxls8471_i2cspi_3D_accel_EndData,
179  .control.Calibrate = &fsl_fxls8471_i2cspi_3D_accel_Calibrate,
180  .control.Shutdown = &fsl_fxls8471_i2cspi_3D_accel_Shutdown,
181  .control.Convert = &fsl_fxls8471_i2cspi_3D_accel_Convert
182 };
183 
184 const i2c_device_t FXLS8471_2_DeviceInfo =
185 {
186  .baudRate_kbps = 400, // default baud rate (kbps).
187  .address = 30 // instance specific device address.
188 };
189 
190 
191 
192 /* END FXLS8471_2. */
193 
194 /*!
195 ** @}
196 */
197 /*
198 ** ###################################################################
199 **
200 ** This file was created by Processor Expert 10.5 [05.21]
201 ** for the Freescale Kinetis series of microcontrollers.
202 **
203 ** ###################################################################
204 */
ISF board support header files.
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_EndData(isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Shutdown(isf_SensorHandle_t *pSensorHandle)
#define FXLS8471_SET_FIELD(name, val)
Definition: fxls8471.h:96
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_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.
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_DeviceInfoBlock_t devInfo
isf_SensorTypes_t fxls8471_SupportedSensorTypes[]
Supported sensor and data types for FXLS8471.
The isf_util.h file contains the utility method declarations and macros.
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
This defines the DSA adapter structure required for static initialization of the concrete instance of...
isf_SensorTypes_t * pSupportedSensorTypes
isf_SensorDataTypes_t fxls8471_SupportedDataTypes[]
Main ISF header file. Contains code common to all ISF components.
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_StartData(isf_SensorHandle_t *pSensorHandle)
This structure defines the dummy DSA data buffer format.
const i2c_device_t FXLS8471_2_DeviceInfo
This allows access to the sensor communications specific configuration.
Definition: FXLS8471_2.c:184
const isf_dsa_Adapter_t FXLS8471_2_Adapter
This creates the sensor adapter instance for the target sensor.
Definition: FXLS8471_2.c:169
fxls8471_Sensor_Specific_Settings_t FXLS8471_2_Sensor_Specific_Config
This allows access to the sensor specific configuration for the target sensor.
Definition: FXLS8471_2.c:106
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Initialize(isf_SensorHandle_t *pSensorHandle)