ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
fsl_fxas21002_i2cspi_3D_gyro module documentation

Data Structures

struct  fxas21002_DataBuffer_t
 This structure defines the dummy DSA data buffer format. More...
 
struct  fxas21002_ODR_Table_tag
 the structure defines the ODR table between Hybrid and normal mode of FXAS21002 operation. More...
 
struct  fxas21000_ODR_Table_tag
 the structure defines the ODR table between Hybrid and normal mode of FXAS21000 operation. More...
 
struct  fxas21002_ConfigTable_tag
 the structure defines the configuration table. More...
 

Macros

#define FXAS21002_WHO_AM_I_VALUE_PRE_RELEASE   0xD6
 Define the WHO_AM_I register values for both possible sensor variations. More...
 
#define FXAS21002_WHO_AM_I_VALUE_RELEASE   0xD7
 
#define FXAS21000_WHO_AM_I_VALUE   0xD1
 

Typedefs

typedef int32 fxas21002_Status_t
 FXAS21002 internal return codes. More...
 
typedef enum fxas21002_Power_tag fxas21002_Power_t
 Enumeration for the FXAS21002 power modes. More...
 
typedef enum fxas21002_InternalState_tag fxas21002_InternalState_t
 Enumeration for the FXAS21002 driver internal states. More...
 
typedef enum fxas21002_Range_tag fxas21002_Range_t
 
typedef struct fxas21002_ODR_Table_tag fxas21002_ODR_Table_t
 the structure defines the ODR table between Hybrid and normal mode of FXAS21002 operation. More...
 
typedef struct fxas21000_ODR_Table_tag fxas21000_ODR_Table_t
 the structure defines the ODR table between Hybrid and normal mode of FXAS21000 operation. More...
 
typedef struct fxas21002_ConfigTable_tag fxas21002_ConfigTable_t
 the structure defines the configuration table. More...
 

Enumerations

enum  fxas21002_Error_tag {
  FXAS21002_ERROR_WHOAMI = 1, FXAS21002_ERROR_WAITFORACTIVE, FXAS21002_ERROR_BURSTWRITE, FXAS21002_ERROR_CONFIG,
  FXAS21002_ERROR_SETPOWER, FXAS21002_ERROR_WRITE, FXAS21002_ERROR_READ
}
 Enumeration for the FXAS21002 internal error codes. More...
 
enum  fxas21002_Power_tag { FXAS21002_POWER_STANDBY = 0, FXAS21002_POWER_ACTIVE = 1 }
 Enumeration for the FXAS21002 power modes. More...
 
enum  fxas21002_InternalState_tag { FXAS21002_STATE_UNINTIALIZED, FXAS21002_STATE_INITIALIZED, FXAS21002_STATE_CONFIGURED, FXAS21002_STATE_STARTED }
 Enumeration for the FXAS21002 driver internal states. More...
 
enum  fxas21002_Range_tag { FXAS21002_RANGE_2000DPS = 0, FXAS21002_RANGE_1000DPS = 1, FXAS21002_RANGE_500DPS = 2, FXAS21002_RANGE_MAX = FXAS21002_RANGE_2000DPS }
 

Functions

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Initialize (isf_SensorHandle_t *pSensorHandle)
 This is the concrete implementation of the FXAS21002 sensor adapter initialization. More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_ValidateSettings (isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSubSettings)
 This is the concrete implementation of the FXAS21002 sensor adapter for validating current settings. More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Configure (isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
 This is the concrete implementation of the FXAS21002 sensor adapter for configuration. More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_StartData (isf_SensorHandle_t *pSensorHandle)
 This is the concrete implementation of the FXAS21002 sensor adapter for start Data. More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_EndData (isf_SensorHandle_t *pSensorHandle)
 This is the concrete implementation of the FXAS21002 sensor adapter for End Data. More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Calibrate (isf_SensorHandle_t *pSensorHandle, void *pCalData)
 This is the concrete implementation of the FXAS21002 sensor adapter for calibration . More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Shutdown (isf_SensorHandle_t *pSensorHandle)
 This is the concrete implementation of the FXAS21002 sensor adapter for shutdown . More...
 
void fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback (void *pSensorHandle)
 The callback function for the Bus Manager(BM). More...
 
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_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. More...
 

Variables

isf_SensorTypes_t fxas21002_SupportedSensorTypes []
 Supported sensor and data types for MMA8652. More...
 
isf_SensorDataTypes_t fxas21002_SupportedDataTypes []
 
isf_SensorTypes_t fxas21002_SupportedSensorTypes [] = { TYPE_THERMOMETER, TYPE_GYROMETER_3D, TYPE_NATIVE_SENSOR_TYPE }
 Supported sensor and data types for FXAS21002. More...
 
isf_SensorDataTypes_t fxas21002_SupportedDataTypes [] = { TYPE_TEMPERATURE, TYPE_ROTATIONAL_RATE_3D , TYPE_NATIVE_SENSOR_DATA_TYPE }
 

Detailed Description

Macro Definition Documentation

#define FXAS21000_WHO_AM_I_VALUE   0xD1

Definition at line 22 of file fsl_fxas21002_i2cspi_3D_gyro.h.

#define FXAS21002_WHO_AM_I_VALUE_PRE_RELEASE   0xD6

Define the WHO_AM_I register values for both possible sensor variations.

Definition at line 20 of file fsl_fxas21002_i2cspi_3D_gyro.h.

#define FXAS21002_WHO_AM_I_VALUE_RELEASE   0xD7

Definition at line 21 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Typedef Documentation

the structure defines the ODR table between Hybrid and normal mode of FXAS21000 operation.

the structure defines the configuration table.

Enumeration for the FXAS21002 driver internal states.

the structure defines the ODR table between Hybrid and normal mode of FXAS21002 operation.

Enumeration for the FXAS21002 power modes.

FXAS21002 internal return codes.

Definition at line 35 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Enumeration Type Documentation

Enumeration for the FXAS21002 internal error codes.

Enumerator
FXAS21002_ERROR_WHOAMI 

Error occurred while reading FXAS21002_WHO_AM_I or the value was incorrect.

FXAS21002_ERROR_WAITFORACTIVE 

Error occurred while attempting to put device into active mode.

FXAS21002_ERROR_BURSTWRITE 

Error occurred while attempting to write a block of memory to the device.

FXAS21002_ERROR_CONFIG 

Error occurred while attempting to configure the device.

FXAS21002_ERROR_SETPOWER 

Error occurred while attempting to set the power mode of the device.

FXAS21002_ERROR_WRITE 

Error occurred while attempting to write the registers directly.

FXAS21002_ERROR_READ 

Error occurred while attempting to read the registers directly.

Definition at line 40 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Enumeration for the FXAS21002 driver internal states.

Enumerator
FXAS21002_STATE_UNINTIALIZED 

initial state of the device.

FXAS21002_STATE_INITIALIZED 

FXAS21002_WHO_AM_I has been verified.

FXAS21002_STATE_CONFIGURED 

Device has been reset and configured.

FXAS21002_STATE_STARTED 

Device is in active mode and measuring data.

Definition at line 59 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Enumeration for the FXAS21002 power modes.

Enumerator
FXAS21002_POWER_STANDBY 

Device in Standby mode. Less power consumption during the mode.

FXAS21002_POWER_ACTIVE 

Device in active mode.

Definition at line 52 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Enumerator
FXAS21002_RANGE_2000DPS 
FXAS21002_RANGE_1000DPS 
FXAS21002_RANGE_500DPS 
FXAS21002_RANGE_MAX 

Definition at line 66 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Function Documentation

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Calibrate ( isf_SensorHandle_t pSensorHandle,
void *  pCalData 
)

This is the concrete implementation of the FXAS21002 sensor adapter for calibration .

The FXAS21000 does not provide the capability to be dynamically calibrated. Therefore, this function simply returns success.

Parameters
[in]pSensorHandleThis is a pointer to the instance of the FXAS21002 sensor adapter.
[in]pCalDataThis is a void pointer to the calibration data.
Returns
fsl_fxas21002_i2cspi_3D_gyro_Calibrate() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the device is calibrated properly. Note: Currently, there is no return error type defined for this API.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 564 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References ISF_SUCCESS.

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Configure ( isf_SensorHandle_t pSensorHandle,
isf_dsa_SensorSettings_t pSensorSettings 
)

This is the concrete implementation of the FXAS21002 sensor adapter for configuration.

This function resets the sensor, applies the settings, and registers a callback with the Bus Manager(BM) timer. It does not yet start the timer, as this is done by fsl_fxas21002_i2cspi_3D_gyro_StartData().

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21000 sensor adapter.
[in]pSensorSettingsThe reference to the sensor configuration settings.
Returns
fsl_fxas21002_i2cspi_3D_gyro_Configure() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the device is configured successfully.
DSA_ERR_CONFIGUREis returned when the provided configuration settings could not be applied.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 306 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References isf_SensorHandle_st::adapterStatus, BM_ERROR, bm_register_periodic_callback(), DeviceDescriptor_struct::cDescriptor, DeviceDescriptor_struct::deviceHandle, DeviceDescriptor_struct::deviceSemaphore, dm_channel_acquire_lock(), dm_channel_release_lock(), dm_device_read(), dm_device_write(), DSA_ERR_CONFIGURE, DSA_ERR_PARAM, DSA_STATE_CONFIGURED_STOPPED, DSA_STATE_INITIALIZED, fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), FXAS21000_WHOAMI_VALUE, FXAS21002_ACTIVE_MASK, FXAS21002_CTRL_REG1, FXAS21002_READY_MASK, FXAS21002_SET_FIELD, ISF_SUCCESS, isf_dsa_SensorSettings_st::nSamplePeriod, isf_SensorHandle_st::pDeviceDescriptor, SensorConfig_st::pSensorSpecificSettings, isf_SensorHandle_st::pSensorStaticConfig, fxas21002_Sensor_Specific_Reg_t::regAddr, fxas21002_Sensor_Specific_Settings_t::regCount, fxas21002_Sensor_Specific_Settings_t::regPairs, fxas21002_Sensor_Specific_Reg_t::regValue, DeviceDescriptor_struct::token, and whoami_read_val.

Here is the call graph for this function:

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Convert ( volatile isf_SensorHandle_t pSensorHandle,
isf_SensorDataTypes_t  convertToType,
isf_dsa_result_types_t  resultType,
void *  pNativeSample,
void *  pConvertedSample,
int32 numBytes 
)
isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_EndData ( isf_SensorHandle_t pSensorHandle)

This is the concrete implementation of the FXAS21002 sensor adapter for End Data.

This function tells the Bus Manager to stop the callbacks and disable data collection.

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21002 sensor adapter.
Returns
fsl_fxas21002_i2cspi_3D_gyro_EndData() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the data collection stopped successfully.
DSA_ERR_PARAMis returned when a wrong parameter is passed into the function such as an invalid or NULL parameter.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 498 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References isf_SensorHandle_st::adapterStatus, BM_ERROR, bm_stop(), DeviceDescriptor_struct::deviceHandle, DeviceDescriptor_struct::deviceSemaphore, DSA_ERR_END_DATA, DSA_ERR_PARAM, DSA_STATE_CONFIGURED_STARTED, DSA_STATE_CONFIGURED_STOPPED, FXAS21002_POWER_STANDBY, ISF_SUCCESS, isf_SensorHandle_st::pDeviceDescriptor, and DeviceDescriptor_struct::token.

Here is the call graph for this function:

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Initialize ( isf_SensorHandle_t pSensorHandle)

This is the concrete implementation of the FXAS21002 sensor adapter initialization.

This function allocates memory for the device descriptor.

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21002 sensor adapter.
Returns
fsl_fxas21002_i2cspi_3D_gyro_Initialize() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the device is initialized properly.
DSA_ERR_PARAMis returned when a wrong parameter was passed into the function, i.e. an invalid or NULL parameter.
DSA_ERR_INITIALIZEis returned when the driver could not be initialized successfully.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 181 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References isf_SensorHandle_st::adapterStatus, DeviceDescriptor_struct::cDescriptor, SensorConfig_st::channelId, COMM_STATE_OK, SensorConfig_st::commInfo, DeviceDescriptor_struct::deviceHandle, DeviceDescriptor_struct::deviceSemaphore, dm_channel_get_state(), dm_channel_init(), dm_channel_start(), dm_device_open(), DSA_ERR_INITIALIZE, DSA_ERR_PARAM, DSA_STATE_INITIALIZED, DSA_STATE_NOT_INITIALIZED, FXAS21000_WHOAMI_VALUE, FXAS21002_WHOAMI_VALUE_PRE_RELEASE, FXAS21002_WHOAMI_VALUE_RELEASE, fxas21002_DataBuffer_t::gyro, ISF_SUCCESS, DeviceDescriptor_struct::pCurrentSample, isf_SensorHandle_st::pDeviceDescriptor, isf_SensorHandle_st::pSensorStaticConfig, DeviceDescriptor_struct::skipFramecnt, and fxas21002_DataBuffer_t::timeStamp.

Here is the call graph for this function:

void fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback ( void *  pSensorHandle)

The callback function for the Bus Manager(BM).

The Bus Manager calls this function periodically based on the period configured for the FXAS21002.

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21002 sensor adapter.
Returns
Void There is no return value.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 611 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References isf_SensorHandle_st::adapterStatus, isf_SensorHandle_st::controlData, DeviceDescriptor_struct::deviceHandle, DeviceDescriptor_struct::deviceSemaphore, dm_device_read(), DSA_STATE_CONFIGURED_STARTED, fsl_fxas21002_i2cspi_3D_gyro_Convert(), FXAS21002_OUT_X_MSB, FXAS21002_TEMP, fxas21002_DataBuffer_t::gyro, isf_fifo_el_get_insert_pointer(), isf_fifo_el_increment(), ISF_FIFO_FULL, isf_fifo_lock(), isf_fifo_unlock(), isf_swap2byte(), isf_time_util_get_usec(), MAX_BUF_SIZE, MAX_DATA_READ_SIZE, isf_dsa_ControlData_st::nEventFieldIndex, DeviceDescriptor_struct::pCurrentSample, isf_SensorHandle_st::pDeviceDescriptor, isf_dsa_ControlData_st::pEventGroup, isf_dsa_SensorSettings_st::pSampleBufferInfo, isf_dsa_SensorSettings_st::resultFormat, isf_dsa_SensorSettings_st::resultType, isf_dsa_ControlData_st::sensorSettings, DeviceDescriptor_struct::skipFramecnt, fxas21002_DataBuffer_t::temperature, TEMPERATURE_BUF_SIZE, TEMPERATURE_DATA_READ_SIZE, fxas21002_DataBuffer_t::timeStamp, and TYPE_NATIVE_SENSOR_DATA_TYPE.

Referenced by fsl_fxas21002_i2cspi_3D_gyro_Configure().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_Shutdown ( isf_SensorHandle_t pSensorHandle)

This is the concrete implementation of the FXAS21002 sensor adapter for shutdown .

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21002 sensor adapter.
Returns
fsl_fxas21002_i2cspi_3D_gyro_Shutdown() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the device is calibrated properly. Note: Currently, there is no return error type defined for this API.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 581 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References isf_SensorHandle_st::adapterStatus, bm_unregister_callback(), DSA_ERR_PARAM, DSA_ERR_SHUTDOWN, DSA_STATE_INITIALIZED, ISF_SUCCESS, isf_SensorHandle_st::pDeviceDescriptor, and DeviceDescriptor_struct::token.

Here is the call graph for this function:

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_StartData ( isf_SensorHandle_t pSensorHandle)

This is the concrete implementation of the FXAS21002 sensor adapter for start Data.

This function tells the Bus Manager to start the callbacks periodically as defined in the bus configuration and enable the data collection.

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21002 sensor adapter.
Returns
fsl_fxas21002_i2cspi_3D_gyro_StartData() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the data collection callback triggered successfully.
DSA_ERR_PARAMis returned when a wrong parameter is passed into the function such as an invalid or NULL parameter.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 436 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References isf_SensorHandle_st::adapterStatus, BM_ERROR, bm_start(), DeviceDescriptor_struct::deviceHandle, DeviceDescriptor_struct::deviceSemaphore, DSA_ERR_PARAM, DSA_ERR_START_DATA, DSA_STATE_CONFIGURED_STARTED, DSA_STATE_CONFIGURED_STOPPED, FALSE, FXAS21002_POWER_ACTIVE, ISF_SUCCESS, isf_SensorHandle_st::pDeviceDescriptor, and DeviceDescriptor_struct::token.

Here is the call graph for this function:

isf_dsa_status_t fsl_fxas21002_i2cspi_3D_gyro_ValidateSettings ( isf_SensorHandle_t pSensorHandle,
isf_dsa_SensorSettings_t pSensorSettings 
)

This is the concrete implementation of the FXAS21002 sensor adapter for validating current settings.

This function is responsible for validating the current settings and if the current settings are not valid settings, it provides the best suitable settings.

Parameters
[in]pSensorHandleThis is a void pointer to the instance of the FXAS21002 sensor adapter.
[in]pSensorSettingsThe reference to the sensor settings.
Returns
fsl_fxas21002_i2cspi_3D_gyro_ValidateSettings() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.
Return values
ISF_SUCCESSis returned when the device settings are successfully validated.
DSA_RET_SETTINGS_CHANGEDis returned when the current settings have been changed.
Constraints:
None
Reentrant: Yes
Link Libraries:
fsl_fxas21002_i2cspi_3D_gyro.lib

Definition at line 267 of file fsl_fxas21002_i2cspi_3D_gyro.c.

References DSA_ERR_PARAM, DSA_RET_SETTINGS_CHANGED, ISF_SUCCESS, and isf_dsa_SensorSettings_st::nSamplePeriod.

Variable Documentation

isf_SensorDataTypes_t fxas21002_SupportedDataTypes[]

Definition at line 254 of file fsl_fxas21002_i2cspi_3D_gyro.h.

Supported sensor and data types for FXAS21002.

Supported sensor and data types for MMA8652.

Definition at line 54 of file fsl_fxas21002_i2cspi_3D_gyro.c.

isf_SensorTypes_t fxas21002_SupportedSensorTypes[]

Supported sensor and data types for MMA8652.

Supported sensor and data types for MMA8652.

Definition at line 253 of file fsl_fxas21002_i2cspi_3D_gyro.h.