68 #define MAX_GYRO_FULL_SCALE_RANGE 2
70 #define FXAS21002_SAMPLE_PERIOD_MAX 640000 // Maximum sample period supported by the FXAS21002.
71 #define FXAS21002_SAMPLE_PERIOD_MIN 5000 // Minimum sample period supported by the FXAS21002.
72 #define GET_ODR_CONFIG 0x0 // Flag enables the configuration value.
73 #define GET_ODR_VALUE 0x01 // Flag enables the ODR value.
75 #define MAX_FXAS21002_DM_BYTES 0x16 // Maximum number of read/write using direct device messaging to address the registers. This is the maximum number of register in 8700.
76 #define NUM_INTERNAL_ADDRESS_BYTES 0x1 // Size of the internal address byte.
119 { 0.0625, 0.0, 4096, 0},
120 { 0.03125, 0.0, 2048, 0},
121 { 0.01563, 0.0, 1024, 0},
122 { 0.00782, 0.0, 512, 0}
126 { 0.200, 0.0, 13107, 0},
127 { 0.100, 0.0, 6554, 0},
128 { 0.050, 0.0, 3277, 0},
129 { 0.025, 0.0, 1638, 0}
139 #define MAX_DATA_READ_SIZE 6 // Maximum number of data
140 #define MAX_BUF_SIZE 6 // Maximum buffer size
160 if (NULL == pSensorHandle) {
175 if (NULL == pDeviceDescriptor) {
183 pCurrentSampleBuffer->
gyro[0] = 0;
184 pCurrentSampleBuffer->
gyro[1] = 0;
185 pCurrentSampleBuffer->
gyro[2] = 0;
249 if ((NULL == pSensorHandle) || (NULL == pSensorSettings)) {
282 #ifdef DEBUG_READ_ALL_REGS
283 static uint8 debugRegs[120];
288 if ((NULL == pSensorHandle) || (NULL == pSensorSettings)) {
301 if ((NULL == pDeviceDescriptor) || (NULL == pSpecificSettings))
312 goto unlockdescriptor;
318 goto unlockdescriptor;
344 for (
uint32 reg=0; reg < cnt ; reg++)
367 #ifdef DEBUG_READ_ALL_REGS
368 for (
int i=0; i<
sizeof(debugRegs); i++)
417 if (NULL == pSensorHandle) {
426 if (NULL == pDeviceDescriptor)
435 goto unlockdescriptor;
440 goto unlockdescriptor;
445 goto unlockdescriptor;
449 goto unlockdescriptor;
477 if(NULL == pSensorHandle){
486 if (NULL == pDeviceDescriptor)
495 goto unlockdescriptor;
504 goto unlockdescriptor;
511 goto unlockdescriptor;
557 if(NULL == pSensorHandle){
588 if (NULL == pSensorHandle) {
601 if (NULL == pDeviceDescriptor){
619 if (MQX_OK !=_lwsem_wait_ticks(&pDeviceDescriptor->
deviceSemaphore, 0))
621 goto unlockdescriptor;
627 goto unlockdescriptor;
633 #ifdef DEBUG_READ_ALL_REGS
634 for (
int i=0; i<
sizeof(debugRegs); i++)
644 pCurrentSampleBuffer->
gyro[0] = SHORT_BE_TO_HOST(pCurrentSampleBuffer->
gyro[0]);
645 pCurrentSampleBuffer->
gyro[1] = SHORT_BE_TO_HOST(pCurrentSampleBuffer->
gyro[1]);
646 pCurrentSampleBuffer->
gyro[2] = SHORT_BE_TO_HOST(pCurrentSampleBuffer->
gyro[2]);
659 *pFifoEntry = *pCurrentSampleBuffer;
667 pCurrentSampleBuffer,
698 void *pConvertedSample,
707 switch (convertToType)
711 pConverter = float_gyro3d_converter;
713 pConverter = fixed_gyro3d_converter;
719 if (pConverter == NULL)
722 retStatus = pConverter(
724 (fxas21002_DataBuffer_t *)pNativeSample,
801 uint8 buffer[1] = {0x00};
805 if (whoami == buffer[0]) {
880 _time_delay_ticks(1);
907 if(fxas21000_odrTable[i].periodNormalMode == samplePeriod)
926 if(fxas21002_odrTable[i].periodNormalMode == samplePeriod)
isf_timestamp_t timestamp
isf_status_t dm_channel_start(dm_ChannelDescriptor_t *apChannelDescriptor)
This function starts a channel.
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 ...
void * pSensorSpecificSettings
unsigned char uint8
This defines uint8 as unsigned char.
the structure defines the ODR table between Hybrid and normal mode of FXAS21000 operation.
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. ...
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.
fsl_i2c_master_driver.h defines structures and types for the i2c master driver.
Standard fixed type for three axis accelerometers.
int32 fxas21002_Status_t
FXAS21002 internal return codes.
#define FXAS21002_ACTIVE_MASK
#define MAX_DATA_READ_SIZE
const uint8 fxas21002_extendAddress[]
The table that describes the extended address space.
The isf_magnetometer_types.h file contains the ISF data type definitions for use with the ISF generic...
uint32 isf_time_util_get_usec(void)
This API returns the time in microseconds.
isf_status_t dm_device_open(dm_ChannelDescriptor_t *apChannelDescriptor, void *apDevice, dm_DeviceDescriptor_t *apDeviceDescriptor)
This function creates a device handle for a device at a specified channel address.
This structure defines the dummy DSA data buffer format.
The fsl_fxas21002_i2cspi_3D_gyro.h file contains the definitions and functions supporting the FXAS210...
isf_dsa_ControlData_t controlData
isf_fifo_status_t isf_fifo_lock(isf_fifo_t *pFifo)
Lock a sample buffer for exclusive access.
comm_State_t dm_channel_get_state(dm_ChannelDescriptor_t *apChannelDescriptor)
This function returns the channel state.
isf_fifo_status_t isf_fifo_unlock(isf_fifo_t *pFifo)
Release the exclusive access lock on a sample buffer.
isf_SensorTypes_t fxas21002_SupportedSensorTypes[]
Supported sensor and data types for FXAS21002.
isf_fifo_status_t isf_fifo_el_increment(isf_fifo_t *pFifo)
Routine increments the insert pointer after direct access.
isf_sensors.h contains the ISF Generic Sensor definitions and data structures required when a client ...
Information necessary to communicate with an I2C slave device.
API definitions, types, and macros for the Intelligent Sensing Framework (ISF) Bus Manager (BM)...
dm_DeviceDescriptor_t deviceHandle
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
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.
#define FXAS21002_ZYXDR_MASK
Define the sensor device descriptor.
LWSEM_STRUCT deviceSemaphore
unsigned long uint32
This defines uint32 as unsigned long.
The fxas21002.h file contains the FXAS21002 Magnetometer register definitions, access macros...
const struct @16 fxas21002GyroConvTable[]
dm_ChannelDescriptor_t cDescriptor
isf_status_t dm_device_write(dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite)
This function writes to a device.
isf_status_t bm_unregister_callback(bm_callback_token_t aToken)
This API unregisters one or more callbacks.
isf_timestamp_t timestamp
const fxas21002_ODR_Table_t fxas21002_odrTable[]
The table that describes the configuration value based on ODR (output data rate). Note: This table is...
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
#define FXAS21000_WHOAMI_VALUE
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.
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
The isf_gyrometer_types.h file contains the ISF data type definitions for use with the ISF generic gy...
Standard fixed type for three axis accelerometers.
isf_gyrometer_dps_fixed_32s1i16_t angularVelocity[3]
const struct @16 fxas21000GyroConvTable[]
isf_status_t dm_channel_acquire_lock(dm_ChannelDescriptor_t *apChannelDescriptor, isf_duration_t aTimeout)
This function locks the channel for exclusive access.
The isf_sensor_types.h contains the enumerated list of sensor types used by ISF.
#define FXAS21002_WHOAMI_VALUE
The isf_util.h file contains the utility method declarations and macros.
#define FXAS21002_SET_FIELD(name, val)
enum isf_dsa_result_enums isf_dsa_result_types_t
bm_callback_token_t bm_register_periodic_callback(isf_duration_t aPeriod, bm_callback_t *pCallback, void *pCbData)
This API schedules a callback at the specified period.
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...
isf_dsa_result_types_t resultFormat
isf_status_t dm_channel_init(dm_ChannelId_t aChannelId, dm_ChannelDescriptor_t *apChannelDescriptor)
This function initializes a channel.
isf_status_t bm_stop(bm_callback_token_t aTokens)
This API stops one or more callback(s) by setting them to the inactive state.
const isf_SensorConfig_t * pSensorStaticConfig
isf_status_t bm_start(boolean aSync, bm_callback_token_t aTokens)
This API sets one or more callback(s) to the active state.
uint32 isf_duration_t
ISF time duration in microseconds.
long int32
This defines int32 as long.
isf_SensorDataTypes_t resultType
Main ISF header file. Contains code common to all ISF components.
LWEVENT_STRUCT * pEventGroup
The isf_sm_api.h contains the collection of APIs for the Sensor Manager as well as related defines an...
isf_dsa_AdapterStatus_t adapterStatus
sys_channelId_t channelId
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 .
isf_SensorDataTypes_t fxas21002_SupportedDataTypes[]
isf_fifo_t * pSampleBufferInfo
isf_status_t dm_device_read(dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead)
This function reads from a device.
void fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(void *pSensorHandle)
The callback function for the Bus Manager(BM).
#define BM_ERROR
This value specifies a general Bus Manager error. If an error occurs in registering a callback...
isf_gyrometer_dps_float_t angularVelocity[3]
int32 isf_status_t
ISF return status type.
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 defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
isf_comm.h defines the common types for the Communications Service Family of the Intelligent Sensing ...
isf_dsa_SensorSettings_t sensorSettings
enum fxas21002_Power_tag fxas21002_Power_t
Enumeration for the FXAS21002 power modes.
void * isf_fifo_el_get_insert_pointer(isf_fifo_t *pFifo)
Routine returns the insert pointer for direct access.
isf_status_t dm_channel_release_lock(dm_ChannelDescriptor_t *apChannelDescriptor)
This function releases exclusive channel access.
const fxas21000_ODR_Table_t fxas21000_odrTable[]
The table that describes the configuration value based on ODR (output data rate). Note: This table is...
This structure defines a handle for the device.
#define FXAS21002_READY_MASK
fxas21002_Sensor_Specific_Reg_t regPairs[]
This structure is a declaration of a channel descriptor type.
bm_callback_token_t token
the structure defines the ODR table between Hybrid and normal mode of FXAS21002 operation.