ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
fsl_fxos8700_i2cspi_6D_AccMag.c File Reference

The FXOS8700 is a 6-axis consumer combo device that includes an accelerometer and magnetometer from Freescale that supports both I2C and SPI protocols. This source file implements the interface for the FXOS8700 Sensor Adapter. It uses Device Messaging (DM), which abstracts away the differences between the I2C and SPI protocols, to communicate with the device. This choice is made via the system communication file, isf_sysconf_comms.c. This file also uses the Bus Manager (BM) to schedule a periodic callback for reading new sensor data and sending the data to the Sensor Manager (SM). More...

#include <isf.h>
#include <isf_types.h>
#include <isf_sm_api.h>
#include <isf_dsa_adapter.h>
#include <isf_bm.h>
#include <isf_sensor_types.h>
#include <isf_fifo.h>
#include <isf_accelerometer_types.h>
#include <isf_magnetometer_types.h>
#include <isf_comm.h>
#include <isf_util.h>
#include <isf_sensors.h>
#include "fsl_os_abstraction.h"
#include "fsl_fxos8700_i2cspi_6D_AccMag.h"
#include "fxos8700.h"
Include dependency graph for fsl_fxos8700_i2cspi_6D_AccMag.c:

Go to the source code of this file.

Macros

#define FXOS8700_MAG_FLOAT_CONVERSION_FACTOR   (0.1)
 
#define FXOS8700_MAG_FLOAT_CONVERSION_OFFSET   (0.0)
 
#define FXOS8700_MAG_FIXED_CONVERSION_FACTOR   (6554)
 
#define FXOS8700_MAG_FIXED_CONVERSION_OFFSET   (0)
 
#define MAX_ACCEL_FULL_SCALE_RANGE   2
 
#define FXOS8700_SAMPLE_PERIOD_MAX   640000
 
#define FXOS8700_SAMPLE_PERIOD_MIN   1250
 
#define GET_ODR_CONFIG   0x0
 
#define GET_ODR_VALUE   0x01
 
#define NUM_STATUS_BYTES   1
 
#define NUMBER_OF_AXES_3D   0x3
 
#define NUMBER_OF_AXES_6D   0x6
 
#define MAX_NUM_AXES   0x6
 
#define MAX_FXOS8700_DM_BYTES   0x79
 
#define NUM_INTERNAL_ADDRESS_BYTES   0x1
 
#define GET_MODE(mode)   ((mode) <= FXOS8700_MODE_HYBRID) ? (mode) : FXOS8700_MODE_HYBRID
 
#define GET_STRUCT_MEMBER_ADDRESS(p, m)   (&(p)->m)
 
#define GET_MEMBER_SIZE(p, m)   sizeof((p)->m)
 
#define MAX_DATA_READ_SIZE   (NUMBER_OF_AXES_6D * 2 + NUM_STATUS_BYTES + sizeof (extendAddress) / sizeof(uint8))
 

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 . More...
 
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 . More...
 
void fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback (void *pSensorHandle)
 The callback function for the Bus Manager(BM). More...
 
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 *pNativeSample, void *pConvertedSample, int32 *numBytes)
 This function coverts the raw sample data to the desired output type. More...
 

Variables

isf_SensorTypes_t fxos8700_SupportedSensorTypes [] = { TYPE_ACCELEROMETER_3D, TYPE_MAGNETOMETER_3D, TYPE_NATIVE_SENSOR_TYPE }
 Supported sensor and data types for FXOS8700. More...
 
isf_SensorDataTypes_t fxos8700_SupportedDataTypes [] = { TYPE_RAW_ACCELERATION_3D, TYPE_MAGNETIC_FIELD_STRENGTH_3D, TYPE_NATIVE_SENSOR_DATA_TYPE }
 
const fxo8700_ODR_Table_t odrTable []
 The table that describes the configuration value based on ODR (output data rate). Note: This table is irregular after the 50HZ, so can't use FLOORLOG2 algorithm. More...
 
struct {
   float   floatFactor
 
   float   floatOffset
 
   int32   fixedFactor
 
   int32   fixedOffset
 
fxos8700AccelConvTable []
 
const uint8 extendAddress [] = {FXOS8700_PL_STATUS, FXOS8700_FF_MT_SRC, FXOS8700_TRANSIENT_SRC, FXOS8700_PULSE_SRC, FXOS8700_M_THS_SRC}
 The table that describes the extended address space. More...
 

Detailed Description

The FXOS8700 is a 6-axis consumer combo device that includes an accelerometer and magnetometer from Freescale that supports both I2C and SPI protocols. This source file implements the interface for the FXOS8700 Sensor Adapter. It uses Device Messaging (DM), which abstracts away the differences between the I2C and SPI protocols, to communicate with the device. This choice is made via the system communication file, isf_sysconf_comms.c. This file also uses the Bus Manager (BM) to schedule a periodic callback for reading new sensor data and sending the data to the Sensor Manager (SM).

File: fsl_fxos8700_i2cspi_6D_AccMag.c.c

Copyright (c) 2015, Freescale Semiconductor, Inc.

Definition in file fsl_fxos8700_i2cspi_6D_AccMag.c.

Macro Definition Documentation

#define FXOS8700_MAG_FIXED_CONVERSION_FACTOR   (6554)

Definition at line 65 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define FXOS8700_MAG_FIXED_CONVERSION_OFFSET   (0)

Definition at line 66 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define FXOS8700_MAG_FLOAT_CONVERSION_FACTOR   (0.1)

Definition at line 63 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define FXOS8700_MAG_FLOAT_CONVERSION_OFFSET   (0.0)

Definition at line 64 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define FXOS8700_SAMPLE_PERIOD_MAX   640000

Definition at line 70 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define FXOS8700_SAMPLE_PERIOD_MIN   1250

Definition at line 71 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define GET_MEMBER_SIZE (   p,
 
)    sizeof((p)->m)

Definition at line 95 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define GET_MODE (   mode)    ((mode) <= FXOS8700_MODE_HYBRID) ? (mode) : FXOS8700_MODE_HYBRID

Definition at line 90 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define GET_ODR_CONFIG   0x0
#define GET_ODR_VALUE   0x01
#define GET_STRUCT_MEMBER_ADDRESS (   p,
 
)    (&(p)->m)

Definition at line 93 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define MAX_ACCEL_FULL_SCALE_RANGE   2

Definition at line 68 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define MAX_DATA_READ_SIZE   (NUMBER_OF_AXES_6D * 2 + NUM_STATUS_BYTES + sizeof (extendAddress) / sizeof(uint8))

Definition at line 134 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define MAX_FXOS8700_DM_BYTES   0x79

Definition at line 80 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define MAX_NUM_AXES   0x6

Definition at line 79 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define NUM_INTERNAL_ADDRESS_BYTES   0x1

Definition at line 83 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define NUM_STATUS_BYTES   1

Definition at line 75 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define NUMBER_OF_AXES_3D   0x3

Definition at line 77 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

#define NUMBER_OF_AXES_6D   0x6

Definition at line 78 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

Variable Documentation

The table that describes the extended address space.

Definition at line 132 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

int32 fixedFactor

Definition at line 118 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

int32 fixedOffset

Definition at line 119 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

float floatFactor

Definition at line 116 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

float floatOffset

Definition at line 117 of file fsl_fxos8700_i2cspi_6D_AccMag.c.

const { ... } fxos8700AccelConvTable[]
Initial value:
=
{
{ 0.000061, 0.0, 16, 0},
{ 0.000122, 0.0, 32, 0},
{ 0.000244, 0.0, 64, 0}
}
const fxo8700_ODR_Table_t odrTable[]
Initial value:
={
{ 1250, 2500, 0},
{ 2500, 5000, 1},
{ 5000, 10000, 2},
{ 10000, 20000, 3},
{ 20000, 80000, 4},
{ 80000, 160000, 5},
{160000, 320000, 6},
{640000, 1280000, 7},
}

The table that describes the configuration value based on ODR (output data rate). Note: This table is irregular after the 50HZ, so can't use FLOORLOG2 algorithm.

Definition at line 101 of file fsl_fxos8700_i2cspi_6D_AccMag.c.