| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
fsl_mma865x_i2c_3D_accel module documentation

## Data Structures
struct | mma865x_Specific_Settings_t
| This structure defines important settings. More...
struct | mma865x_DataBuffer_t
| This structure defines the dummy DSA data buffer format. More...

## Macros
#define | BYTES_FOR_FULL_READ 7
| This function retrieves the raw data from the MMA865x sensor. More...

## Typedefs
typedef int32 | mma865x_status_t

## Enumerations
enum | { FSL_MMA865x_ACCEL_800HZ = 1250, FSL_MMA865x_ACCEL_400HZ = 2500, FSL_MMA865x_ACCEL_200HZ = 5000, FSL_MMA865x_ACCEL_100HZ = 10000, FSL_MMA865x_ACCEL_50HZ = 20000, FSL_MMA865x_ACCEL_12p5HZ = 80000, FSL_MMA865x_ACCEL_6p25HZ = 160000, FSL_MMA865x_ACCEL_1p56HZ = 640000 }
| This enumerator describes the available sample rates for the MM865X family of accelerometers. More...
enum | { FSL_MMA865x_ACCEL_DATA_FULL = 0, FSL_MMA865x_ACCEL_DATA_8BIT = 1 }
| This enumerator describes the available output resolutions for the MM865X family of accelerometers. More...
enum | { FSL_MMA865x_ACCEL_SCALE_2G = 0, FSL_MMA865x_ACCEL_SCALE_4G = 1, FSL_MMA865x_ACCEL_SCALE_8G = 2 }
| This enumerator describes the available acceleration ranges for the MM865X family of accelerometers. More...

## Functions
void | mma865x_Reset (int32_t *status, void *pSensorHandle)
| This function resets the MMA865x sensor resulting in a default configuration for all registers. More...
void | mma865x_CheckId (int32_t *status, void *pSensorHandle)
| This function validates the MMA865x sensor is connected via the I2C bus. More...
void | mma865x_SetMode (int32_t *status, void *pSensorHandle, int32_t Mode)
| This function sets the MMA865x part to the requested mode. More...
void | mma865x_ValidateConfig (int32_t *status, void *pSensorHandle, void *pSettings)
| This function validates the configuration for the MMA865x sensor. More...
isf_dsa_status_t | mma865x_GetConfig (isf_dsa_SensorSettings_t *pRequiredSettings, DeviceDescriptor_t *pDeviceDes)
| This function obtains the configuration register values for a given user configuration of the MMA865x. If the configuration has changed then it returns true and saves the new configuration. More...
isf_dsa_status_t | mma865x_SetConfig (isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pConfigSettings)
| This function sets the MMA865x sensor configuration. More...
isf_dsa_status_t | mma865x_GetData (isf_SensorHandle_t *pSensorHandle, void *pBuffer)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_Initialize (isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_ValidateSettings (isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_Configure (isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_StartData (isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_EndData (isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_Calibrate (isf_SensorHandle_t *pSensorHandle, void *pCalData)
isf_dsa_status_t | fsl_mma865x_i2c_3D_accel_Shutdown (isf_SensorHandle_t *pSensorHandle)
void | fsl_mma865x_i2c_3D_accel_PeriodicCallback (void *pSensorHandle)
isf_dsa_status_t | fsl_mma865x_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. More...

## Variables
struct {
float floatFactor
float floatOffset
int32 fixedFactor
int32 fixedOffset
} | mma865xAccelConvTable []
isf_SensorTypes_t | mma865x_SupportedSensorTypes [] = { TYPE_ACCELEROMETER_3D, TYPE_NATIVE_SENSOR_TYPE }
| Supported sensor and data types for MMA865x. More...
isf_SensorDataTypes_t | mma865x_SupportedDataTypes [] = { TYPE_RAW_ACCELERATION_3D, TYPE_NATIVE_SENSOR_DATA_TYPE }
isf_SensorTypes_t | mma865x_SupportedSensorTypes []
| Supported sensor and data types for MMA865x. More...
isf_SensorDataTypes_t | mma865x_SupportedDataTypes []

## Detailed Description

## Macro Definition Documentation

#define BYTES_FOR_FULL_READ 7

This function retrieves the raw data from the MMA865x sensor.

Definition at line 788 of file fsl_mma865x_i2c_3D_accel.c.

Referenced by mma865x_GetData().

## Typedef Documentation

typedef int32 mma865x_status_t

Definition at line 70 of file fsl_mma865x_i2c_3D_accel.c.

## Enumeration Type Documentation

anonymous enum

This enumerator describes the available sample rates for the MM865X family of accelerometers.

Enumerator
FSL_MMA865x_ACCEL_800HZ | 800 Hz
FSL_MMA865x_ACCEL_400HZ | 400 Hz
FSL_MMA865x_ACCEL_200HZ | 200 Hz
FSL_MMA865x_ACCEL_100HZ | 100 Hz
FSL_MMA865x_ACCEL_50HZ | 50 Hz
FSL_MMA865x_ACCEL_12p5HZ | 12.5 Hz
FSL_MMA865x_ACCEL_6p25HZ | 6.25 Hz
FSL_MMA865x_ACCEL_1p56HZ | 1.56 Hz

Definition at line 30 of file fsl_mma865x_i2c_3D_accel.h.

anonymous enum

This enumerator describes the available output resolutions for the MM865X family of accelerometers.

Enumerator
FSL_MMA865x_ACCEL_DATA_FULL | select full-scale resolution
FSL_MMA865x_ACCEL_DATA_8BIT | select 8-bit resolution

Definition at line 42 of file fsl_mma865x_i2c_3D_accel.h.

anonymous enum

This enumerator describes the available acceleration ranges for the MM865X family of accelerometers.

Enumerator
FSL_MMA865x_ACCEL_SCALE_2G | select +/-2G range
FSL_MMA865x_ACCEL_SCALE_4G | select +/-4G range
FSL_MMA865x_ACCEL_SCALE_8G | select +/-8G range

Definition at line 48 of file fsl_mma865x_i2c_3D_accel.h.

## Function Documentation

isf_dsa_status_t fsl_mma865x_i2c_3D_accel_Calibrate | ( | isf_SensorHandle_t * | pSensorHandle,
|  | void * | pCalData
| ) |  |

Definition at line 433 of file fsl_mma865x_i2c_3D_accel.c.

References ISF_SUCCESS.

isf_dsa_status_t fsl_mma865x_i2c_3D_accel_Configure | ( | isf_SensorHandle_t * | pSensorHandle,
|  | isf_dsa_SensorSettings_t * | pSensorSettings
| ) |  |

Definition at line 220 of file fsl_mma865x_i2c_3D_accel.c.

References isf_SensorHandle_st::adapterStatus, BM_ERROR, bm_register_periodic_callback(), DeviceDescriptor_struct::cDescriptor, isf_SensorHandle_st::controlData, DeviceDescriptor_struct::deviceSemaphore, dm_channel_acquire_lock(), dm_channel_release_lock(), DSA_ERR_CONFIGURE, DSA_ERR_PARAM, DSA_STATE_CONFIGURED_STOPPED, DSA_STATE_INITIALIZED, fsl_mma865x_i2c_3D_accel_PeriodicCallback(), ISF_SUCCESS, mma865x_SetConfig(), mma865x_SetMode(), isf_dsa_SensorSettings_st::nSamplePeriod, isf_SensorHandle_st::pDeviceDescriptor, SENSOR_STANDBY, isf_dsa_ControlData_st::sensorSettings, and DeviceDescriptor_struct::token.

Here is the call graph for this function:

isf_dsa_status_t fsl_mma865x_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 at line 576 of file fsl_mma865x_i2c_3D_accel.c.

References DSA_ERR_BAD_RESULT_TYPE, DSA_ERR_BAD_SENSOR_DATA_TYPE, DSA_RESULT_TYPE_ENG_FIXED, DSA_RESULT_TYPE_ENG_FLOAT, SensorConfig_st::pSensorSpecificSettings, isf_SensorHandle_st::pSensorStaticConfig, and TYPE_RAW_ACCELERATION_3D.

Referenced by fsl_mma865x_i2c_3D_accel_PeriodicCallback().

Here is the caller graph for this function:

isf_dsa_status_t fsl_mma865x_i2c_3D_accel_EndData | ( | isf_SensorHandle_t * | pSensorHandle | ) |

Definition at line 369 of file fsl_mma865x_i2c_3D_accel.c.

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

Here is the call graph for this function:

isf_dsa_status_t fsl_mma865x_i2c_3D_accel_Initialize | ( | isf_SensorHandle_t * | pSensorHandle | ) |

Definition at line 100 of file fsl_mma865x_i2c_3D_accel.c.

References mma865x_DataBuffer_t::accel, isf_SensorHandle_st::adapterStatus, mma865x_DataBuffer_t::addr, 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, ISF_SUCCESS, mma865x_CheckId(), DeviceDescriptor_struct::pCurrentSample, isf_SensorHandle_st::pDeviceDescriptor, isf_SensorHandle_st::pSensorStaticConfig, DeviceDescriptor_struct::skipFramecnt, and mma865x_DataBuffer_t::timeStamp.

Here is the call graph for this function:

void fsl_mma865x_i2c_3D_accel_PeriodicCallback | ( | void * | pSensorHandle | ) |

Definition at line 482 of file fsl_mma865x_i2c_3D_accel.c.

References mma865x_DataBuffer_t::accel, isf_SensorHandle_st::adapterStatus, isf_SensorHandle_st::controlData, DeviceDescriptor_struct::deviceSemaphore, DSA_STATE_CONFIGURED_STARTED, fsl_mma865x_i2c_3D_accel_Convert(), isf_fifo_el_get_insert_pointer(), isf_fifo_el_increment(), ISF_FIFO_FULL, isf_fifo_lock(), isf_fifo_unlock(), isf_time_util_get_usec(), mma865x_GetData(), 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, mma865x_DataBuffer_t::timeStamp, and TYPE_NATIVE_SENSOR_DATA_TYPE.

Referenced by fsl_mma865x_i2c_3D_accel_Configure().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_dsa_status_t fsl_mma865x_i2c_3D_accel_Shutdown | ( | isf_SensorHandle_t * | pSensorHandle | ) |

Definition at line 453 of file fsl_mma865x_i2c_3D_accel.c.

References isf_SensorHandle_st::adapterStatus, bm_unregister_callback(), DSA_ERR_PARAM, 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_mma865x_i2c_3D_accel_StartData | ( | isf_SensorHandle_t * | pSensorHandle | ) |

Definition at line 309 of file fsl_mma865x_i2c_3D_accel.c.

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

Here is the call graph for this function:

isf_dsa_status_t fsl_mma865x_i2c_3D_accel_ValidateSettings | ( | isf_SensorHandle_t * | pSensorHandle,
|  | isf_dsa_SensorSettings_t * | pSensorSettings
| ) |  |

Definition at line 191 of file fsl_mma865x_i2c_3D_accel.c.

References DSA_ERR_PARAM, and mma865x_ValidateConfig().

Here is the call graph for this function:

void mma865x_CheckId | ( | int32_t * | status,
|  | void * | pSensorHandle
| ) |  |

This function validates the MMA865x sensor is connected via the I2C bus.

Definition at line 679 of file fsl_mma865x_i2c_3D_accel.c.

References DeviceDescriptor_struct::deviceHandle, dm_device_read(), ISF_SUCCESS, MMA865x_WHO_AM_I, MMA865x_WHOAMI_VALUE_8652, MMA865x_WHOAMI_VALUE_8653, isf_SensorHandle_st::pDeviceDescriptor, and SENSOR_ERROR_CHECKID.

Referenced by fsl_mma865x_i2c_3D_accel_Initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_dsa_status_t mma865x_GetConfig | ( | isf_dsa_SensorSettings_t * | pRequiredSettings,
|  | DeviceDescriptor_t * | pDeviceDes
| ) |  |

This function obtains the configuration register values for a given user configuration of the MMA865x. If the configuration has changed then it returns true and saves the new configuration.

Parameters

  [out] | pRequiredSettings | update the data period in settings
  [out] | pDeviceDes | update the data rate in the generic sensor structure for this device

Returns
  mma865x_GetConfig() returns a value of type isf_dsa_status_t indicating the success or failure of the function call.

Return values

  0 | is returned when the configuration is valid.
  1 | is returned when the configuration is modified.

Constraints:
  None

Reentrant: Yes

Link Libraries:
  lib_fsl_mma865x_i2c_3D_accel.lib

Definition at line 868 of file fsl_mma865x_i2c_3D_accel.c.

References DSA_RET_SETTINGS_CHANGED, FALSE, FSL_MMA865x_ACCEL_800HZ, isf_dsa_SensorSettings_st::nSamplePeriod, mma865x_Specific_Settings_t::sampleRateIndex, and TRUE.

Referenced by mma865x_ValidateConfig().

Here is the caller graph for this function:

isf_dsa_status_t mma865x_GetData | ( | isf_SensorHandle_t * | pSensorHandle,
|  | void * | pBuffer
| ) |  |

Definition at line 790 of file fsl_mma865x_i2c_3D_accel.c.

References BYTES_FOR_FULL_READ, DeviceDescriptor_struct::deviceHandle, dm_device_read(), ISF_SUCCESS, MMA865x_GET_FIELD, MMA865x_STATUS_00, isf_SensorHandle_st::pDeviceDescriptor, and SENSOR_ERROR_GETDATA.

Referenced by fsl_mma865x_i2c_3D_accel_PeriodicCallback().

Here is the call graph for this function:

Here is the caller graph for this function:

void mma865x_Reset | ( | int32_t * | status,
|  | void * | pSensorHandle
| ) |  |

This function resets the MMA865x sensor resulting in a default configuration for all registers.

Definition at line 649 of file fsl_mma865x_i2c_3D_accel.c.

References DeviceDescriptor_struct::deviceHandle, dm_device_write(), DSA_ERR_INITIALIZE, ISF_SUCCESS, MMA865x_ASLP_COUNT, MMA865x_CTRL_REG2, MMA865x_RST_MASK, and isf_SensorHandle_st::pDeviceDescriptor.

Here is the call graph for this function:

isf_dsa_status_t mma865x_SetConfig | ( | isf_SensorHandle_t * | pSensorHandle,
|  | isf_dsa_SensorSettings_t * | pConfigSettings
| ) |  |

This function sets the MMA865x sensor configuration.

Definition at line 822 of file fsl_mma865x_i2c_3D_accel.c.

References DeviceDescriptor_struct::deviceHandle, dm_device_write(), DSA_ERR_CONFIGURE, ISF_SUCCESS, MMA865x_CTRL_REG1, MMA865x_ERROR, MMA865x_SET_FIELD, isf_SensorHandle_st::pDeviceDescriptor, SensorConfig_st::pSensorSpecificSettings, isf_SensorHandle_st::pSensorStaticConfig, and mma865x_Specific_Settings_t::sampleRateIndex.

Referenced by fsl_mma865x_i2c_3D_accel_Configure().

Here is the call graph for this function:

Here is the caller graph for this function:

void mma865x_SetMode | ( | int32_t * | status,
|  | void * | pSensorHandle,
|  | int32_t | Mode
| ) |  |

This function sets the MMA865x part to the requested mode.

Definition at line 724 of file fsl_mma865x_i2c_3D_accel.c.

References DeviceDescriptor_struct::deviceHandle, and isf_SensorHandle_st::pDeviceDescriptor.

Referenced by fsl_mma865x_i2c_3D_accel_Configure(), fsl_mma865x_i2c_3D_accel_EndData(), and fsl_mma865x_i2c_3D_accel_StartData().

Here is the caller graph for this function:

void mma865x_ValidateConfig | ( | int32_t * | status,
|  | void * | pSensorHandle,
|  | void * | pSettings
| ) |  |

This function validates the configuration for the MMA865x sensor.

Definition at line 702 of file fsl_mma865x_i2c_3D_accel.c.

References DSA_RET_SETTINGS_CHANGED, ISF_SUCCESS, mma865x_GetConfig(), and isf_SensorHandle_st::pDeviceDescriptor.

Referenced by fsl_mma865x_i2c_3D_accel_ValidateSettings().

Here is the call graph for this function:

Here is the caller graph for this function:

## Variable Documentation

int32 fixedFactor

Definition at line 57 of file fsl_mma865x_i2c_3D_accel.c.

int32 fixedOffset

Definition at line 58 of file fsl_mma865x_i2c_3D_accel.c.

float floatFactor

Definition at line 55 of file fsl_mma865x_i2c_3D_accel.c.

float floatOffset

Definition at line 56 of file fsl_mma865x_i2c_3D_accel.c.

isf_SensorDataTypes_t mma865x_SupportedDataTypes[] = { TYPE_RAW_ACCELERATION_3D, TYPE_NATIVE_SENSOR_DATA_TYPE }

Definition at line 67 of file fsl_mma865x_i2c_3D_accel.c.

isf_SensorDataTypes_t mma865x_SupportedDataTypes[]

Definition at line 67 of file fsl_mma865x_i2c_3D_accel.c.

isf_SensorTypes_t mma865x_SupportedSensorTypes[] = { TYPE_ACCELEROMETER_3D, TYPE_NATIVE_SENSOR_TYPE }

Supported sensor and data types for MMA865x.

Definition at line 66 of file fsl_mma865x_i2c_3D_accel.c.

isf_SensorTypes_t mma865x_SupportedSensorTypes[]

Supported sensor and data types for MMA865x.

Definition at line 66 of file fsl_mma865x_i2c_3D_accel.c.

const { ... } mma865xAccelConvTable[]

Initial value:
=
{
{ 0.000061, 0.0, 8, 0},
{ 0.000122, 0.0, 16, 0},
{ 0.000244, 0.0, 32, 0}
}
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.