ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
fsl_fxos8700_i2cspi_6D_AccMag.h
Go to the documentation of this file.
1 /**
2  * @file fsl_fxos8700_i2cspi_6D_AccMag.h
3  * @brief The \b fsl_fxos8700_i2cspi_6D_AccMag.h file contains the definitions and functions supporting the FXOS8700 Sensor adapter header file
4 
5  * @copyright Copyright (c) 2015, Freescale Semiconductor, Inc.
6  * @version 01.00
7  * @addtogroup fsl_fxos8700_i2cspi_6D_AccMag_module fsl_fxos8700_i2cspi_6D_AccMag module documentation
8  * @{
9 */
10 
11 #ifndef FSL_FXOS8700_I2CSPI_6D_ACCMAG_H_
12 #define FSL_FXOS8700_I2CSPI_6D_ACCMAG_H_
13 
14 /* Include shared modules, which are used for whole project */
15 #include "isf.h"
16 
17 #include "isf_sm_types.h"
18 #include "isf_dsa_adapter.h"
19 
20 
21 /**
22  * @brief FXOS8700 expected WHO_AM_I value.
23  */
24 #define FXOS8700_WHO_AM_I_VALUE1 0xC7
25 #define FXOS8700_WHO_AM_I_VALUE2 0xC9
26 #define FXOS8700_WHO_AM_I_VALUE3 0xCA //WHO_AM_I value of future SPI fix parts
27 
28 
29 /**
30  * @brief FXOS8700 internal return codes.
31  */
33 /**
34  * @brief Enumeration for the FXOS8700 internal error codes.
35  */
37  FXOS8700_ERROR_WHOAMI = 1, /*!< Error occurred while reading ::FXOS8700_WHO_AM_I or the value was incorrect. */
38  FXOS8700_ERROR_WAITFORACTIVE, /*!< Error occurred while attempting to put device into active mode. */
39  FXOS8700_ERROR_BURSTWRITE, /*!< Error occurred while attempting to write a block of memory to the device. */
40  FXOS8700_ERROR_CONFIG, /*!< Error occurred while attempting to configure the device. */
41  FXOS8700_ERROR_SETPOWER, /*!< Error occurred while attempting to set the power mode of the device. */
42  FX0S8700_ERRO_WRITE, /*!< Error occurred while attempting to write the registers directly. */
43  FX0S8700_ERRO_READ, /*!< Error occurred while attempting to read the registers directly. */
44 };
45 /**
46  * @brief Enumeration for the FXOS8700 power modes.
47  */
48 typedef enum fxos8700_Power_tag {
49  FXOS8700_POWER_STANDBY = 0, /*!< Device in Standby mode. Less power consumption during the mode.*/
50  FXOS8700_POWER_ACTIVE = 1, /*!< Device in active mode.*/
52 /**
53  * @brief Enumeration for the FXOS8700 driver internal states.
54  */
56  FXOS8700_STATE_UNINTIALIZED, /*!< initial state of the device.*/
57  FXOS8700_STATE_INITIALIZED, /*!< FXOS8700_WHO_AM_I has been verified. */
58  FXOS8700_STATE_CONFIGURED, /*!< Device has been reset and configured. */
59  FXOS8700_STATE_STARTED, /*!< Device is in active mode and measuring data. */
61 
62 /*! @brief The enumeration, fxos8700_Mode_tag, defines the operational modes of the FXOS8700.*/
63 typedef enum fxos8700_Mode_tag {
64  FXOS8700_MODE_ACCELEROMETER = 0, /*<! The device is in accelerometer mode only.*/
65  FXOS8700_MODE_MAGNETOMETER = 1, /*<! The device is in magnetometer mode only.*/
66  FXOS8700_MODE_HYBRID = 3, /*<! The device is in hybrid mode, where both the
67  accelerometer and magnetometer are active.
68  The value is not sequential because this value is
69  used directly by the device to set the mode.*/
70  FXOS8700_MODE_EXTEND = 4, /*<! Extended functionality for algorithms output.It also provides algorithmic data, in addition to accelerometer and magnetometer data.*/
72 /*! @brief The enumeration, fxos8700_Range_tag, defines the acceleration range of the FXOS8700.*/
73 typedef enum fxos8700_Range_tag {
74  FXOS8700_RANGE_2G = 0, /*<!Acceleration range is 2G.*/
75  FXOS8700_RANGE_4G = 1, /*<!Acceleration range is 4G.*/
76  FXOS8700_RANGE_8G = 2, /*<!Acceleration range is 8G.*/
79 /*! @brief The enumeration, fxos8700_Resolution_tag, defines the bit resolution of the FXOS8700.*/
81  FXOS8700_RESOLUTION_8_BIT = 1, /*<!8 bit resolution.*/
82  FXOS8700_RESOLUTION_NORMAL = 2, /*<!Normal resolution for the accelerometer is 14 bits and the magnetometer is 16 bits.*/
84 
85 /**
86  * @brief the structure defines the ODR table between Hybrid and normal mode of device operation.
87  */
88 typedef struct fxos8700_ODR_Table_tag{
89  uint32 periodNormalMode; /*!< Normal Mode ODR value in millisecond. */
90  uint32 periodHybridMode; /*!< Hybrid mode ODR value in millisecond. */
91  uint8 configVal; /*!< configuration value correspond to given ODR in millisecond. */
93 
94 /**
95  * @brief the structure defines the configuration table.
96  */
97 typedef struct fxos8700_ConfigTable_tag{
98  void *memberVariable; /*!< reference to the member variable. */
99  uint8 startAddress; /*!< start address to the member variable. */
100  uint8 size; /*!< size of the memeber to be configured. */
102 
103 /*! @brief This structure defines the dummy DSA data buffer format.*/
104 typedef struct {
105  uint32 timeStamp; /*!< The time stamp for the data packet.*/
106  int16 accel[3]; /*!< The accelerometer data */
107  int16 mag[3]; /*!< The magnetometer data */
108  uint8 addr; /*!< The device "address" can uniquely identify the sensor */
110 
111 /*! @brief Supported sensor and data types for fxos8700 */
114 
115 
116 /*
117  ** ===================================================================
118  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_Initialize
119  ** @brief
120  **
121  ** Parameters :
122  ** NAME - DESCRIPTION
123  ** @param
124  ** isf_SensorHandle_t *pSensorHandle
125  ** @return
126  ** isf_dsa_status_t -
127  ** ===================================================================
128  */
130 
131 /*
132  ** ===================================================================
133  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_ValidateSettings
134  ** @brief
135  **
136  ** Parameters :
137  ** NAME - DESCRIPTION
138  ** @param
139  ** isf_SensorHandle_t *pSensorHandle
140  ** @param
141  ** isf_SubscriptionSettings_t *pSettings
142  ** @return
143  ** isf_dsa_status_t -
144  ** ===================================================================
145  */
147 
148 /*
149  ** ===================================================================
150  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_Configure
151  ** @brief
152  **
153  ** Parameters :
154  ** NAME - DESCRIPTION
155  ** @param
156  ** isf_SensorHandle_t *pSensorHandle
157  ** @param
158  ** isf_SubscriptionSettings_t *pConfigSettings
159  ** @return
160  ** isf_dsa_status_t -
161  ** ===================================================================
162  */
164 
165 /*
166  ** ===================================================================
167  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_StartData
168  ** @brief
169  **
170  ** Parameters :
171  ** NAME - DESCRIPTION
172  ** @param
173  ** isf_SensorHandle_t *pSensorHandle
174  ** @return
175  ** isf_dsa_status_t -
176  ** ===================================================================
177  */
179 
180 /*
181  ** ===================================================================
182  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_EndData
183  ** @brief
184  **
185  ** Parameters :
186  ** NAME - DESCRIPTION
187  ** @param
188  ** isf_SensorHandle_t *pSensorHandle
189  ** @return
190  ** isf_dsa_status_t -
191  ** ===================================================================
192  */
194 
195 /*
196  ** ===================================================================
197  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_Calibrate
198  ** @brief
199  **
200  ** Parameters :
201  ** NAME - DESCRIPTION
202  ** @param
203  ** isf_SensorHandle_t *pSensorHandle
204  ** @return
205  ** isf_dsa_status_t -
206  ** ===================================================================
207  */
209 
210 /*
211  ** ===================================================================
212  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_Shutdown
213  ** @brief
214  **
215  ** Parameters :
216  ** NAME - DESCRIPTION
217  ** @param
218  ** isf_SensorHandle_t *pSensorHandle
219  ** @return
220  ** isf_dsa_status_t -
221  ** ===================================================================
222  */
224 
225 /*
226  ** ===================================================================
227  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_Convert
228  ** @brief The DSA interface conversion function to convert native samples to specified standard types
229  **
230  ** Parameters :
231  ** NAME - DESCRIPTION
232  ** @param
233  ** isf_SensorHandle_t *pSensorHandle
234  ** @return
235  ** void -
236  ** ===================================================================
237  */
238 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 *nativeSample, void *convertedSample, int32 *numBytes );
239 /*
240  ** ===================================================================
241  ** Method : fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback (component ISFDSA)
242  ** @brief
243  **
244  ** Parameters :
245  ** NAME - DESCRIPTION
246  ** @param
247  ** isf_SensorHandle_t *pSensorHandle
248  ** @return
249  ** void -
250  ** ===================================================================
251  */
252 void fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(void* pSensorHandle);
253 
254 /* END FSL_FXOS8700_I2CSPI_6D_ACCMAG. */
255 #endif
256 /* ifndef FSL_FXOS8700_I2CSPI_6D_ACCMAG_H_ */
257 /*!
258 ** @}
259 */
unsigned char uint8
Definition: isf_types.h:76
int32 fxos8700_Status_t
FXOS8700 internal return codes.
This structure defines the dummy DSA data buffer format.
void fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(void *pSensorHandle)
The callback function for the Bus Manager(BM).
fxos8700_Range_tag
The enumeration, fxos8700_Range_tag, defines the acceleration range of the FXOS8700.
the structure defines the configuration table.
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
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.
enum fxos8700_Power_tag fxos8700_Power_t
Enumeration for the FXOS8700 power modes.
enum fxos8700_InternalState_tag fxos8700_InternalState_t
Enumeration for the FXOS8700 driver internal states.
isf_SensorTypes_t
enum fxos8700_Range_tag fxos8700_Range_t
The enumeration, fxos8700_Range_tag, defines the acceleration range of the FXOS8700.
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.
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
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 ...
fxos8700_InternalState_tag
Enumeration for the FXOS8700 driver internal states.
signed short int int16
Definition: isf_types.h:73
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 *nativeSample, void *convertedSample, int32 *numBytes)
This function coverts the raw sample data to the desired output type.
enum isf_dsa_result_enums isf_dsa_result_types_t
isf_SensorDataTypes_t fxos8700_SupportedDataTypes[]
isf_SensorDataTypes_t
fxos8700_Error_tag
Enumeration for the FXOS8700 internal error codes.
Main ISF header file. Contains code common to all ISF components.
signed long int int32
Definition: isf_types.h:74
enum fxos8700_Mode_tag fxos8700_Mode_t
The enumeration, fxos8700_Mode_tag, defines the operational modes of the FXOS8700.
struct fxos8700_ConfigTable_tag fxos8700_ConfigTable_t
the structure defines the configuration table.
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
fxos8700_Power_tag
Enumeration for the FXOS8700 power modes.
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 . ...
struct fxos8700_ODR_Table_tag fxo8700_ODR_Table_t
the structure defines the ODR table between Hybrid and normal mode of device operation.
the structure defines the ODR table between Hybrid and normal mode of device operation.
unsigned long int uint32
Definition: isf_types.h:78
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.
The isf_sm_types.h contains the collection of type definitions used in the Sensor Manager Interface a...
enum fxos8700_Resolution_tag fxos8700_Resolution_t
The enumeration, fxos8700_Resolution_tag, defines the bit resolution of the FXOS8700.
fxos8700_Resolution_tag
The enumeration, fxos8700_Resolution_tag, defines the bit resolution of the FXOS8700.
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...
fxos8700_Mode_tag
The enumeration, fxos8700_Mode_tag, defines the operational modes of the FXOS8700.