ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fsl_fxas21002_i2cspi_3D_gyro.c File Reference

The FXAS21002 is a 3-axis Angular Rate Gyroscope from Freescale that supports both I2C and SPI protocols. This source file implements the interface for the FXAS21002 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 <mqxlite.h>
#include <isf.h>
#include <isf_types.h>
#include <lwmem.h>
#include <lwsem.h>
#include <lwevent.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_gyrometer_types.h>
#include <isf_magnetometer_types.h>
#include <isf_comm.h>
#include <isf_util.h>
#include <isf_sensors.h>
#include "fsl_i2c_master_driver.h"
#include "fsl_fxas21002_i2cspi_3D_gyro.h"
#include "fxas21002.h"
Include dependency graph for fsl_fxas21002_i2cspi_3D_gyro.c:

Go to the source code of this file.

Macros

#define MAX_GYRO_FULL_SCALE_RANGE   2
 
#define FXAS21002_SAMPLE_PERIOD_MAX   640000
 
#define FXAS21002_SAMPLE_PERIOD_MIN   5000
 
#define GET_ODR_CONFIG   0x0
 
#define GET_ODR_VALUE   0x01
 
#define MAX_FXAS21002_DM_BYTES   0x16
 
#define NUM_INTERNAL_ADDRESS_BYTES   0x1
 
#define MAX_DATA_READ_SIZE   6
 
#define MAX_BUF_SIZE   6
 

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 *pSensorSettings)
 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

uint8 whoami_read_val
 
isf_SensorTypes_t fxas21002_SupportedSensorTypes [] = { TYPE_GYROMETER_3D, TYPE_NATIVE_SENSOR_TYPE }
 Supported sensor and data types for FXAS21002. More...
 
isf_SensorDataTypes_t fxas21002_SupportedDataTypes [] = { TYPE_ROTATIONAL_RATE_3D , TYPE_NATIVE_SENSOR_DATA_TYPE }
 
const fxas21000_ODR_Table_t fxas21000_odrTable []
 The table that describes the configuration value based on ODR (output data rate). Note: This table is irregular after the 25HZ, so can't use FLOORLOG2 algorithm. More...
 
const fxas21002_ODR_Table_t fxas21002_odrTable []
 The table that describes the configuration value based on ODR (output data rate). Note: This table is irregular after the 25HZ, so can't use FLOORLOG2 algorithm. More...
 
struct {
   float   floatFactor
 
   float   floatOffset
 
   int32   fixedFactor
 
   int32   fixedOffset
 
fxas21000GyroConvTable []
 
struct {
   float   floatFactor
 
   float   floatOffset
 
   int32   fixedFactor
 
   int32   fixedOffset
 
fxas21002GyroConvTable []
 
const uint8 fxas21002_extendAddress [] = {FXAS21002_F_STATUS, FXAS21002_F_SETUP, FXAS21002_F_EVENT, FXAS21002_INT_SRC_FLAG}
 The table that describes the extended address space. More...
 

Detailed Description

The FXAS21002 is a 3-axis Angular Rate Gyroscope from Freescale that supports both I2C and SPI protocols. This source file implements the interface for the FXAS21002 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_fxas21002_i2cspi_3D_gyro.c.c

Copyright (c) 2013, Freescale Semiconductor, Inc.

Definition in file fsl_fxas21002_i2cspi_3D_gyro.c.

Macro Definition Documentation

#define FXAS21002_SAMPLE_PERIOD_MAX   640000

Definition at line 70 of file fsl_fxas21002_i2cspi_3D_gyro.c.

#define FXAS21002_SAMPLE_PERIOD_MIN   5000

Definition at line 71 of file fsl_fxas21002_i2cspi_3D_gyro.c.

#define GET_ODR_CONFIG   0x0

Definition at line 72 of file fsl_fxas21002_i2cspi_3D_gyro.c.

#define GET_ODR_VALUE   0x01

Definition at line 73 of file fsl_fxas21002_i2cspi_3D_gyro.c.

#define MAX_BUF_SIZE   6
#define MAX_DATA_READ_SIZE   6
#define MAX_FXAS21002_DM_BYTES   0x16

Definition at line 75 of file fsl_fxas21002_i2cspi_3D_gyro.c.

#define MAX_GYRO_FULL_SCALE_RANGE   2

Definition at line 68 of file fsl_fxas21002_i2cspi_3D_gyro.c.

#define NUM_INTERNAL_ADDRESS_BYTES   0x1

Definition at line 76 of file fsl_fxas21002_i2cspi_3D_gyro.c.

Variable Documentation

int32 fixedFactor

Definition at line 115 of file fsl_fxas21002_i2cspi_3D_gyro.c.

int32 fixedOffset

Definition at line 116 of file fsl_fxas21002_i2cspi_3D_gyro.c.

float floatFactor

Definition at line 113 of file fsl_fxas21002_i2cspi_3D_gyro.c.

float floatOffset

Definition at line 114 of file fsl_fxas21002_i2cspi_3D_gyro.c.

const fxas21000_ODR_Table_t fxas21000_odrTable[]
Initial value:
={
{ 5000, 0},
{ 10000, 1},
{ 20000, 2},
{ 40000, 3},
{ 80000, 4},
{ 160000, 5},
{ 320000, 6},
{ 640000, 7},
}

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

Definition at line 83 of file fsl_fxas21002_i2cspi_3D_gyro.c.

const { ... } fxas21000GyroConvTable[]
Initial value:
=
{
{ 0.0625, 0.0, 4096, 0},
{ 0.03125, 0.0, 2048, 0},
{ 0.01563, 0.0, 1024, 0},
{ 0.00782, 0.0, 512, 0}
}

The table that describes the extended address space.

Definition at line 137 of file fsl_fxas21002_i2cspi_3D_gyro.c.

const fxas21002_ODR_Table_t fxas21002_odrTable[]
Initial value:
={
{ 1250, 0},
{ 2500, 1},
{ 5000, 2},
{ 10000, 3},
{ 20000, 4},
{ 40000, 5},
{ 80000, 6},
{ 80000, 7},
}

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

Definition at line 98 of file fsl_fxas21002_i2cspi_3D_gyro.c.

const { ... } fxas21002GyroConvTable[]
Initial value:
=
{
{ 0.200, 0.0, 13107, 0},
{ 0.100, 0.0, 6554, 0},
{ 0.050, 0.0, 3277, 0},
{ 0.025, 0.0, 1638, 0}
}
uint8 whoami_read_val