| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

FXLS8952_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 : FXLS8952_1.c
4 ** CDE edition : Community
5 ** Project : ISF2P2_K64F_MQX_PROJ
6 ** Processor : MK64FN1M0VLL12
7 ** Component : ISF_KSDK_Sensor_FXLS8952_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 : FXLS8952_1
16 ** Device Address : 0x18
17 ** Comm Channel : I2C1
18 ** Allowed Full-scale Range : +/-2g
19 ** Use Interrupts : FALSE
20 ** Sensor Specific Configuration :
21 ** BUF_CONFIG1 :
22 ** BUF_MODE : 0
23 ** BUF_TYPE : 0
24 ** BUF_GATE : 0
25 ** TRIG_SDCD_WT : 0
26 ** TRIG_SDCD_OT : 0
27 ** TRIG_ORIENT : 0
28 ** BUF_CONFIG2 :
29 ** BUF_FLUSH : 0
30 ** WAKE_SRC_BUF : 0
31 ** BUF_WMRK : 0
32 ** SENS_CONFIG1 :
33 ** FSR : 0
34 ** SENS_CONFIG2 :
35 ** WAKE_PM : 1
36 ** SLEEP_PM : 1
37 ** LE_BE : 0
38 ** AINC_TEMP : 0
39 ** F_READ : 0
40 ** SENS_CONFIG3 :
41 ** WAKE_ODR : 0
42 ** SLEEP_ODR : 0
43 ** WAKE_IDLE : 0
44 ** SLEEP_IDLE : 0
45 ** SENS_CONFIG4 :
46 ** EXT_TRIG_M : 0
47 ** WAKE_SDCD_WT : 0
48 ** WAKE_SDCD_OT : 0
49 ** WAKE_ORIENT : 0
50 ** DRDY_PUL : 1
51 ** INT2_FUNC : 0
52 ** INT_PP_OD : 0
53 ** INT_POL : 0
54 ** ASLP_COUNT : 0
55 ** INT_EN :
56 ** DRDY_EN : 1
57 ** BUF_EN : 0
58 ** SDCD_OT_EN : 0
59 ** SDCD_WT_EN : 0
60 ** ORIENT_EN : 0
61 ** ASLP_EN : 0
62 ** BOOT_DIS : 0
63 ** WAKE_OUT_EN : 0
64 ** INT_PIN_SEL :
65 ** DRDY_INT2 : 0
66 ** BUF_INT2 : 0
67 ** SDCD_OT_INT2 : 0
68 ** SDCD_WT_INT2 : 0
69 ** ORIENT_INT2 : 0
70 ** ASLP_INT2 : 0
71 ** BOOT_INT2 : 0
72 ** WAKE_OUT_INT2 : 0
73 ** OFF_X : 0
74 ** OFF_Y : 0
75 ** OFF_Z : 0
76 ** ORIENT_CONFIG :
77 ** ORIENT_DBCNTM : 1
78 ** ORIENT_ENABLE : 0
79 ** ORIENT_DBCOUNT : 0
80 ** ORIENT_BF_ZCOMP :
81 ** ORIENT_BKFR : 2
82 ** ORIENT_ZLOCK : 4
83 ** ORIENT_THS_REG :
84 ** ORIENT_THS : 16
85 ** ORIENT_HYS : 4
86 ** SDCD_CONFIG1 :
87 ** OT_ELE : 0
88 ** WT_ELE : 0
89 ** X_OT_EN : 0
90 ** Y_OT_EN : 0
91 ** Z_OT_EN : 0
92 ** X_WT_EN : 0
93 ** Y_WT_EN : 0
94 ** Z_WT_EN : 0
95 ** SDCD_CONFIG2 :
96 ** SDCD_EN : 0
97 ** REF_UPDM : 0
98 ** OT_DBCTM : 0
99 ** WT_DBCTM : 0
100 ** WT_LOG_SEL : 0
101 ** REF_UPD : 0
102 ** SDCD_OT_DBCNT : 0
103 ** SDCD_WT_DBCNT : 0
104 ** SDCD_LTHS_REG :
105 ** X_WT_EF : 0
106 ** Y_WT_EF : 0
107 ** Z_WT_EF : 0
108 ** SDCD_LTHS : 0
109 ** SDCD_UTHS : 0
110 ** Contents :
111 ** No public methods
112 **
113 ** For non-commercial use only.
114 (c) Copyright <company/user-name>, 2015,
115 http://www.<company>.com
116 mail: info@<company>.com
117 ** ###################################################################*/
118 /*!
119 ** @file FXLS8952_1.c
120 ** @version 01.00
121 ** @brief
122 **
123 */
124 /*!
125 ** @addtogroup FXLS8952_1_module FXLS8952_1 module documentation
126 ** @{
127 */
128
129 /* MODULE FXLS8952_1. */
130
131 #include "FXLS8952_1.h"
132
133 fxls8952_Sensor_Specific_Settings_t FXLS8952_1_Sensor_Specific_Config =
134 {
135 .accelFullScaleRange = 0, // Capture the accelerometer full-scale range for use in conversion routines.
136 .usesInterrupts = FALSE,
137 .signal = 0,
138 .usesBuffer = FALSE,
139 .regCount = 29, // Number of register pairs to follow
140 .regPairs =
141 {
142 { FXLS8952_SENS_CONFIG1, (FXLS8952_SET_FIELD(FSR,0)) },
143 { FXLS8952_SENS_CONFIG2, (FXLS8952_SET_FIELD(WAKE_PM,1)) | (FXLS8952_SET_FIELD(SLEEP_PM,1)) | (FXLS8952_SET_FIELD(LE_BE,0)) | (FXLS8952_SET_FIELD(AINC_TEMP,0)) | (FXLS8952_SET_FIELD(F_READ,0)) },
144 { FXLS8952_SENS_CONFIG3, (FXLS8952_SET_FIELD(WAKE_ODR,0)) | (FXLS8952_SET_FIELD(SLEEP_ODR,0)) },
145 { FXLS8952_WAKE_IDLE_MSB, 0 },
146 { FXLS8952_WAKE_IDLE_LSB, 0 },
147 { FXLS8952_SLEEP_IDLE_MSB, 0 },
148 { FXLS8952_SLEEP_IDLE_LSB, 0 },
149 { FXLS8952_SENS_CONFIG4, (FXLS8952_SET_FIELD(EXT_TRIG_M,0)) | (FXLS8952_SET_FIELD(WAKE_SDCD_WT,0)) | (FXLS8952_SET_FIELD(WAKE_SDCD_OT,0)) | (FXLS8952_SET_FIELD(WAKE_ORIENT,0)) | (FXLS8952_SET_FIELD(DRDY_PUL,1)) | (FXLS8952_SET_FIELD(INT2_FUNC,0)) | (FXLS8952_SET_FIELD(INT_PP_OD,0)) | (FXLS8952_SET_FIELD(INT_POL,0)) },
150 { FXLS8952_ASLP_COUNT_MSB, 0 },
151 { FXLS8952_ASLP_COUNT_LSB, 0 },
152 { FXLS8952_INT_EN, (FXLS8952_SET_FIELD(DRDY_EN,1)) | (FXLS8952_SET_FIELD(BUF_EN,0)) | (FXLS8952_SET_FIELD(SDCD_OT_EN,0)) | (FXLS8952_SET_FIELD(SDCD_WT_EN,0)) | (FXLS8952_SET_FIELD(ORIENT_EN,0)) | (FXLS8952_SET_FIELD(ASLP_EN,0)) | (FXLS8952_SET_FIELD(BOOT_DIS,0)) | (FXLS8952_SET_FIELD(WAKE_OUT_EN,0)) },
153 { FXLS8952_INT_PIN_SEL, (FXLS8952_SET_FIELD(DRDY_INT2,0)) | (FXLS8952_SET_FIELD(BUF_INT2,0)) | (FXLS8952_SET_FIELD(SDCD_OT_INT2,0)) | (FXLS8952_SET_FIELD(SDCD_WT_INT2,0)) | (FXLS8952_SET_FIELD(ORIENT_INT2,0)) | (FXLS8952_SET_FIELD(ASLP_INT2,0)) | (FXLS8952_SET_FIELD(BOOT_INT2,0)) | (FXLS8952_SET_FIELD(WAKE_OUT_INT2,0)) },
154 { FXLS8952_OFF_X, 0 },
155 { FXLS8952_OFF_Y, 0 },
156 { FXLS8952_OFF_Z, 0 },
157 { FXLS8952_BUF_CONFIG1, (FXLS8952_SET_FIELD(BUF_TYPE,0)) | (FXLS8952_SET_FIELD(BUF_MODE,0)) | (FXLS8952_SET_FIELD(BUF_GATE,0)) | (FXLS8952_SET_FIELD(TRIG_SDCD_WT,0)) | (FXLS8952_SET_FIELD(TRIG_SDCD_OT,0)) | (FXLS8952_SET_FIELD(TRIG_ORIENT,0)) },
158 { FXLS8952_BUF_CONFIG2, (FXLS8952_SET_FIELD(BUF_FLUSH,0)) | (FXLS8952_SET_FIELD(WAKE_SRC_BUF,0)) | (FXLS8952_SET_FIELD(BUF_CFG_WMRK,0)) },
159 { FXLS8952_ORIENT_CFG, (FXLS8952_SET_FIELD(ORIENT_DBCNTM,1)) | (FXLS8952_SET_FIELD(ORIENT_ENABLE,0)) },
160 { FXLS8952_ORIENT_DBCOUNT, (FXLS8952_SET_FIELD(ORIENT_DBCOUNT,0)) },
161 { FXLS8952_ORIENT_BF_ZCOMP, (FXLS8952_SET_FIELD(ORIENT_BKFR,2)) | (FXLS8952_SET_FIELD(ORIENT_ZLOCK,4)) },
162 { FXLS8952_ORIENT_THS_REG, (FXLS8952_SET_FIELD(ORIENT_THS,16)) | (FXLS8952_SET_FIELD(HYS,4)) },
163 { FXLS8952_SDCD_CONFIG1, (FXLS8952_SET_FIELD(OT_ELE,0)) | (FXLS8952_SET_FIELD(WT_ELE,0)) | (FXLS8952_SET_FIELD(X_OT_EN,0)) | (FXLS8952_SET_FIELD(Y_OT_EN,0)) | (FXLS8952_SET_FIELD(Z_OT_EN,0)) | (FXLS8952_SET_FIELD(X_WT_EN,0)) | (FXLS8952_SET_FIELD(Y_WT_EN,0)) | (FXLS8952_SET_FIELD(Z_WT_EN,0)) },
164 { FXLS8952_SDCD_CONFIG2, (FXLS8952_SET_FIELD(SDCD_EN,0)) | (FXLS8952_SET_FIELD(REF_UPDM,0)) | (FXLS8952_SET_FIELD(OT_DBCTM,0)) | (FXLS8952_SET_FIELD(WT_DBCTM,0)) | (FXLS8952_SET_FIELD(WT_LOG_SEL,0)) | (FXLS8952_SET_FIELD(REF_UPD,0)) },
165 { FXLS8952_SDCD_OT_DBCNT, 0 },
166 { FXLS8952_SDCD_WT_DBCNT, 0 },
167 { FXLS8952_SDCD_LTHS_LSB, 0 },
168 { FXLS8952_SDCD_LTHS_MSB, (FXLS8952_SET_FIELD(SDCD_X_WT_EF,0)) | (FXLS8952_SET_FIELD(SDCD_Y_WT_EF,0)) | (FXLS8952_SET_FIELD(SDCD_Z_WT_EF,0)) | 0 },
169 { FXLS8952_SDCD_UTHS_LSB, 0 },
170 { FXLS8952_SDCD_UTHS_MSB, 0 },
171 }
172 };
173
174 /*!
175 * @brief This creates the sensor adapter instance for the target sensor.
176 *
177 * @see ::isf_sm_dsa_adapter.h for details of the ::sm_DsaAdapter_t.
178 */
179 const isf_dsa_Adapter_t FXLS8952_1_Adapter =
180 {
181 .devInfo.pSupportedSensorTypes = fxls8952_SupportedSensorTypes,
182 .devInfo.pSupportedSensorDataTypes = fxls8952_SupportedDataTypes,
183 .devInfo.nNativeDataSetSize = sizeof(fxls8952_DataBuffer_t),
184 .control.Initialize = &fsl_fxls8952_i2c_3D_accel_Initialize,
185 .control.ValidateSettings = &fsl_fxls8952_i2c_3D_accel_ValidateSettings,
186 .control.Configure = &fsl_fxls8952_i2c_3D_accel_Configure,
187 .control.StartData = &fsl_fxls8952_i2c_3D_accel_StartData,
188 .control.EndData = &fsl_fxls8952_i2c_3D_accel_EndData,
189 .control.Calibrate = &fsl_fxls8952_i2c_3D_accel_Calibrate,
190 .control.Shutdown = &fsl_fxls8952_i2c_3D_accel_Shutdown,
191 .control.Convert = &fsl_fxls8952_i2c_3D_accel_Convert
192 };
193
194 const i2c_device_t FXLS8952_1_DeviceInfo =
195 {
196 .baudRate_kbps = 400, // default baud rate (kbps).
197 .address = 24 // instance specific device address.
198 };
199
200
201 /* END FXLS8952_1. */
202
203 /*!
204 ** @}
205 */
206 /*
207 ** ###################################################################
208 **
209 ** This file was created by Processor Expert 10.5 [05.21]
210 ** for the Freescale Kinetis series of microcontrollers.
211 **
212 ** ###################################################################
213 */
fxls8952_Sensor_Specific_Settings_t
Definition: fxls8952.h:352
FXLS8952_SENS_CONFIG3
Definition: fxls8952.h:40
fxls8952_SupportedDataTypes
isf_SensorDataTypes_t fxls8952_SupportedDataTypes[]
Definition: fsl_fxls8952_i2c_3D_accel.c:72
FXLS8952_ORIENT_BF_ZCOMP
Definition: fxls8952.h:58
FXLS8952_OFF_Z
Definition: fxls8952.h:52
FXLS8952_ORIENT_DBCOUNT
Definition: fxls8952.h:57
FXLS8952_1_Sensor_Specific_Config
fxls8952_Sensor_Specific_Settings_t FXLS8952_1_Sensor_Specific_Config
This allows access to the sensor specific configuration for the target sensor.
Definition: FXLS8952_1.c:133
FXLS8952_SDCD_LTHS_LSB
Definition: fxls8952.h:65
FALSE
#define FALSE
Definition: isf_types.h:86
FXLS8952_SDCD_LTHS_MSB
Definition: fxls8952.h:66
fsl_fxls8952_i2c_3D_accel_Shutdown
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_Shutdown(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXLS8952 sensor adapter for shutdown . ...
Definition: fsl_fxls8952_i2c_3D_accel.c:595
fsl_fxls8952_i2c_3D_accel_Calibrate
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
This is the concrete implementation of the FXLS8952 sensor adapter for calibration ...
Definition: fsl_fxls8952_i2c_3D_accel.c:578
fsl_fxls8952_i2c_3D_accel_ValidateSettings
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the FXLS8952 sensor adapter for validating current settings...
Definition: fsl_fxls8952_i2c_3D_accel.c:264
fsl_fxls8952_i2c_3D_accel_Configure
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
This is the concrete implementation of the FXLS8952 sensor adapter for configuration.
Definition: fsl_fxls8952_i2c_3D_accel.c:309
FXLS8952_SENS_CONFIG2
Definition: fxls8952.h:39
FXLS8952_1_DeviceInfo
const i2c_device_t FXLS8952_1_DeviceInfo
This allows access to the sensor communications specific configuration.
Definition: FXLS8952_1.c:194
fsl_fxls8952_i2c_3D_accel_Initialize
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_Initialize(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXLS8952 sensor adapter initialization.
Definition: fsl_fxls8952_i2c_3D_accel.c:179
FXLS8952_SLEEP_IDLE_MSB
Definition: fxls8952.h:44
FXLS8952_BUF_CONFIG2
Definition: fxls8952.h:54
FXLS8952_SDCD_UTHS_MSB
Definition: fxls8952.h:68
FXLS8952_WAKE_IDLE_LSB
Definition: fxls8952.h:41
fxls8952_Sensor_Specific_Settings_t::accelFullScaleRange
uint8 accelFullScaleRange
Definition: fxls8952.h:354
FXLS8952_WAKE_IDLE_MSB
Definition: fxls8952.h:42
FXLS8952_OFF_X
Definition: fxls8952.h:50
isf_dsa_Adapter_st::devInfo
isf_dsa_DeviceInfoBlock_t devInfo
Definition: isf_dsa_adapter.h:146
FXLS8952_SDCD_CONFIG1
Definition: fxls8952.h:61
FXLS8952_INT_EN
Definition: fxls8952.h:48
FXLS8952_ORIENT_THS_REG
Definition: fxls8952.h:59
isf_dsa_Adapter_st
This defines the DSA adapter structure required for static initialization of the concrete instance of...
Definition: isf_dsa_adapter.h:144
fxls8952_SupportedSensorTypes
isf_SensorTypes_t fxls8952_SupportedSensorTypes[]
Supported sensor and data types for FXLS8952.
Definition: fsl_fxls8952_i2c_3D_accel.c:71
FXLS8952_1_Adapter
const isf_dsa_Adapter_t FXLS8952_1_Adapter
This creates the sensor adapter instance for the target sensor.
Definition: FXLS8952_1.c:179
isf_dsa_DeviceInfoBlock_st::pSupportedSensorTypes
isf_SensorTypes_t * pSupportedSensorTypes
Definition: isf_dsa_adapter.h:70
fsl_fxls8952_i2c_3D_accel_Convert
isf_dsa_status_t fsl_fxls8952_i2c_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.
Definition: fsl_fxls8952_i2c_3D_accel.c:801
FXLS8952_SLEEP_IDLE_LSB
Definition: fxls8952.h:43
FXLS8952_OFF_Y
Definition: fxls8952.h:51
FXLS8952_ASLP_COUNT_LSB
Definition: fxls8952.h:46
FXLS8952_ORIENT_CFG
Definition: fxls8952.h:56
FXLS8952_1.h
FXLS8952_SENS_CONFIG4
Definition: fxls8952.h:45
fsl_fxls8952_i2c_3D_accel_StartData
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_StartData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXLS8952 sensor adapter for start Data.
Definition: fsl_fxls8952_i2c_3D_accel.c:450
FXLS8952_SDCD_UTHS_LSB
Definition: fxls8952.h:67
FXLS8952_SDCD_OT_DBCNT
Definition: fxls8952.h:63
FXLS8952_ASLP_COUNT_MSB
Definition: fxls8952.h:47
FXLS8952_SET_FIELD
#define FXLS8952_SET_FIELD(name, val)
Definition: fxls8952.h:79
FXLS8952_SDCD_CONFIG2
Definition: fxls8952.h:62
FXLS8952_SDCD_WT_DBCNT
Definition: fxls8952.h:64
fsl_fxls8952_i2c_3D_accel_EndData
isf_dsa_status_t fsl_fxls8952_i2c_3D_accel_EndData(isf_SensorHandle_t *pSensorHandle)
This is the concrete implementation of the FXLS8952 sensor adapter for End Data.
Definition: fsl_fxls8952_i2c_3D_accel.c:517
FXLS8952_SENS_CONFIG1
Definition: fxls8952.h:38
FXLS8952_BUF_CONFIG1
Definition: fxls8952.h:53
fxls8952_DataBuffer_t
This structure defines the dummy DSA data buffer format.
Definition: fsl_fxls8952_i2c_3D_accel.h:30
FXLS8952_INT_PIN_SEL
Definition: fxls8952.h:49
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.