30 #include "fsl_os_abstraction.h"
63 { 0.000061, 0.0, 16, 0},
64 { 0.000122, 0.0, 32, 0},
65 { 0.000244, 0.0, 64, 0}
103 if ( NULL == pSensorHandle){
121 if (NULL == pDeviceDescriptor) {
130 pCurrentSampleBuffer->
accel[0] = 0;
131 pCurrentSampleBuffer->
accel[1] = 0;
132 pCurrentSampleBuffer->
accel[2] = 0;
170 if (kStatus_OSA_Success != OSA_SemaCreate(&pDeviceDescriptor->
deviceSemaphore, 1)){
198 if ((NULL == pSensorHandle) || (NULL == pSensorSettings)) {
227 if((NULL == pSensorHandle) || (NULL == pSensorSettings) ){
239 if (NULL == pDeviceDescriptor)
250 goto unlockdescriptor;
256 goto unlockdescriptor;
318 if(NULL == pSensorHandle){
329 if (NULL == pDeviceDescriptor)
339 goto unlockdescriptor;
345 goto unlockdescriptor;
350 goto unlockdescriptor;
380 if(NULL == pSensorHandle){
393 if (NULL == pDeviceDescriptor)
402 goto unlockdescriptor;
409 goto unlockdescriptor;
416 goto unlockdescriptor;
466 if(NULL == pSensorHandle){
496 if(NULL == pSensorHandle){
508 if (NULL == pDeviceDescriptor){
527 if (kStatus_OSA_Success !=OSA_SemaWait(&pDeviceDescriptor->
deviceSemaphore, OSA_WAIT_FOREVER))
529 goto unlockdescriptor;
536 goto unlockdescriptor;
553 *pFifoEntry = *pCurrentSampleBuffer;
561 pCurrentSampleBuffer,
594 void *pConvertedSample,
603 switch (convertToType)
607 pConverter = float_accel3d_converter;
609 pConverter = fixed_accel3d_converter;
615 if (pConverter == NULL)
618 retStat = pConverter(
620 (fxls8471_DataBuffer_t *)pNativeSample,
665 uint8 buffer[1] = {0};
685 OSA_TimeDelay(1000/5);
695 uint8 buffer[1] = {0};
746 uint8 buffer[1] = {0x00};
804 #define BYTES_FOR_FULL_READ 7
841 uint8 address, value;
850 for (
uint32 reg=0; reg < pConfigSpecific->regCount; reg++)
852 address = pConfigSpecific->regPairs[reg].regAddr;
853 value = pConfigSpecific->regPairs[reg].regValue;
854 buffer[0] = pConfigSpecific->regPairs[reg].regValue;
896 uint8 maxDataRateIndex =
sizeof fsl_fxls8471_period /
sizeof fsl_fxls8471_period[0];
898 for (dataRate = 0; dataRate < maxDataRateIndex; dataRate++)
900 if (fsl_fxls8471_period[dataRate] == pRequiredSettings->
nSamplePeriod)
isf_status_t dm_channel_start(dm_ChannelDescriptor_t *apChannelDescriptor)
This function starts a channel.
#define FXLS8471_RST_MASK
void * pSensorSpecificSettings
Standard fixed type for three axis accelerometers.
This structure defines important settings.
isf_timestamp_t timestamp
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.
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_fifo_status_t isf_fifo_el_increment(isf_fifo_t *pFifo)
Routine increments the insert pointer after direct access.
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_EndData(isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Shutdown(isf_SensorHandle_t *pSensorHandle)
isf_sensors.h contains the ISF Generic Sensor definitions and data structures required when a client ...
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...
const struct @16 fxls8471AccelConvTable[]
#define BYTES_FOR_FULL_READ
This function retrieves the raw data from the FXLS8471 sensor.
Define the sensor device descriptor.
isf_dsa_status_t fxls8471_GetData(isf_SensorHandle_t *pSensorHandle, void *pBuffer)
uint8 sampleRateIndex
Holds the ODR index into the rate array fsl_fxls8471_period */.
isf_dsa_status_t fxls8471_GetConfig(isf_dsa_SensorSettings_t *pRequiredSettings, DeviceDescriptor_t *pDeviceDes)
This function obtains the configuration register values for a given user configuration of the FXLS847...
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.
The fxls8471.h contains the FXLS8471 Accelerometer register definitions, access macros, and device access functions.
#define FXLS8471_SET_FIELD(name, val)
The fsl_fxls8471_i2cspi_3D_accel.h file contains the definitions and functions supporting the MMA8652...
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
void fxls8471_ValidateConfig(int32_t *status, void *pSensorHandle, void *pSettings)
This function validates the configuration for the FXLS8471 sensor.
isf_dsa_status_t fsl_fxls8471_i2cspi_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.
isf_acceleration_g_fixed_32s1i16_t accel[3]
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
isf_acceleration_g_float_t accel[3]
void fxls8471_SetMode(int32_t *status, void *pSensorHandle, int32_t Mode)
This function sets the FXLS8471 part to the requested mode.
isf_SensorTypes_t fxls8471_SupportedSensorTypes[]
Supported sensor and data types for FXLS8471.
#define FXLS8471_GET_FIELD(name, val)
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.
The isf_util.h file contains the utility method declarations and macros.
enum isf_dsa_result_enums isf_dsa_result_types_t
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
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.
#define FXLS8471_ACTIVE_MASK
#define FXLS8471_WHOAMI_VALUE
isf_dsa_result_types_t resultFormat
isf_dsa_status_t fxls8471_SetConfig(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pConfigSettings)
This function sets the FXLS8471 sensor configuration.
void fxls8471_Reset(int32_t *status, void *pSensorHandle)
This function resets the FXLS8471 sensor resulting in a default configuration for all registers...
isf_SensorDataTypes_t fxls8471_SupportedDataTypes[]
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.
isf_SensorDataTypes_t resultType
Main ISF header file. Contains code common to all ISF components.
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
unsigned short int uint16
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
Standard float type for three axis accelerometers.
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.
#define BM_ERROR
This value specifies a general Bus Manager error. If an error occurs in registering a callback...
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_StartData(isf_SensorHandle_t *pSensorHandle)
int32 isf_status_t
ISF return status type.
This structure defines the dummy DSA data buffer format.
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
uint8 accelFullScaleRange
isf_comm.h defines the common types for the Communications Service Family of the Intelligent Sensing ...
isf_dsa_SensorSettings_t sensorSettings
isf_timestamp_t timestamp
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.
This structure defines a handle for the device.
void fsl_fxls8471_i2cspi_3D_accel_PeriodicCallback(void *pSensorHandle)
The isf_accelerometer_types.h file contains the ISF data type definitions for use with the ISF generi...
void fxls8471_CheckId(int32_t *status, void *pSensorHandle)
This function validates the FXLS8471 sensor is connected via the I2C bus.
semaphore_t deviceSemaphore
This structure is a declaration of a channel descriptor type.
bm_callback_token_t token
isf_dsa_status_t fsl_fxls8471_i2cspi_3D_accel_Initialize(isf_SensorHandle_t *pSensorHandle)