26 #define T_ON_8491Q_MICROSECONDS (700)
32 #define mma8491q_xyz_format(destination, msb, lsb) destination = (((uint16)msb) << 8) | lsb;
44 #define MMA8491Q_ACCEL_FLOAT_CONVERSION_FACTOR 0.000244
45 #define MMA8491Q_ACCEL_FIXED_CONVERSION_FACTOR 16
69 if( NULL == pSensorHandle)
86 if(NULL == pDeviceDescriptor)
96 pCurrentSampleBuffer->
accel[0] = 0;
97 pCurrentSampleBuffer->
accel[1] = 0;
98 pCurrentSampleBuffer->
accel[2] = 0;
99 pCurrentSampleBuffer->
xOut = 0;
100 pCurrentSampleBuffer->
yOut = 0;
101 pCurrentSampleBuffer->
zOut = 0;
124 GPIO_DRV_SetPinOutput(
en_pin);
147 if(kStatus_OSA_Success != OSA_SemaCreate(&pDeviceDescriptor->
deviceSemaphore, 1))
160 if((NULL == pSensorHandle) || (NULL == pSensorSettings))
171 if((NULL == pSensorHandle) || (NULL == pSensorSettings))
180 if(NULL == pDeviceDescriptor)
192 goto unlockdescriptor;
251 if((NULL == pSensorHandle) || (NULL == pCalData))
262 if(NULL == pSensorHandle)
271 if(NULL == pDescriptor)
283 goto unlockdescriptor;
290 goto unlockdescriptor;
309 if(NULL == pSensorHandle)
319 if(NULL == pDescriptor)
331 goto unlockdescriptor;
341 goto unlockdescriptor;
346 GPIO_DRV_SetPinOutput(
en_pin);
364 if(NULL == pSensorHandle)
400 if(NULL == pSensorHandle)
405 if(NULL == pDescriptor)
419 GPIO_DRV_SetPinOutput(
en_pin);
438 if(NULL == pSensorHandle)
445 if(NULL == pDescriptor)
474 goto unlockdescriptor;
479 GPIO_DRV_ClearPinOutput(
en_pin);
481 (void)
bm_stop(token_cb_Read_Data);
486 goto unlockdescriptor;
490 pCurrentSampleBuffer->
xOut = GPIO_DRV_ReadPinInput(
x_out_pin);
491 pCurrentSampleBuffer->
yOut = GPIO_DRV_ReadPinInput(
y_out_pin);
492 pCurrentSampleBuffer->
zOut = GPIO_DRV_ReadPinInput(
z_out_pin);
497 *pFifoEntry = *pCurrentSampleBuffer;
505 pCurrentSampleBuffer,
535 void *pConvertedSample,
543 switch (convertToType)
548 pConverter = float_accel3d_converter;
552 pConverter = fixed_accel3d_converter;
559 if(pConverter == NULL)
564 retStat = pConverter(
566 (mma8491q_DataBuffer_t *)pNativeSample, pConvertedSample);
576 uint8 buffer[1] = {0};
596 #define DATA_BUFFER_SIZE_8491Q (7)
isf_status_t fsl_mma8491q_i2c_3D_accel_Calibrate(isf_SensorHandle_t *pSensorHandle, void *pCalData)
volatile mma8491q_mode_t mma8491q_mode
isf_status_t dm_channel_start(dm_ChannelDescriptor_t *apChannelDescriptor)
This function starts a channel.
void * pSensorSpecificSettings
Standard fixed type for three axis accelerometers.
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.
uint32 timestamp
Time stamp value in micro-seconds.
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_dsa_status_t fsl_mma8491q_i2c_3D_accel_Shutdown(isf_SensorHandle_t *pSensorHandle)
isf_fifo_status_t isf_fifo_el_increment(isf_fifo_t *pFifo)
Routine increments the insert pointer after direct access.
int16 accel[3]
Accelerometer raw data buffer. MMA8491Q supports X,Y,Z axes(3).
isf_sensors.h contains the ISF Generic Sensor definitions and data structures required when a client ...
#define MMA8491Q_ACCEL_FLOAT_CONVERSION_FACTOR
dm_DeviceDescriptor_t deviceHandle
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
uint8 yOut
The Tilt Y data from the sensor.
Define the sensor device descriptor.
isf_status_t fsl_mma8491q_i2c_3D_accel_EndData(isf_SensorHandle_t *pSensorHandle)
#define DATA_BUFFER_SIZE_8491Q
isf_dsa_status_t fsl_mma8491q_i2c_3D_accel_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
uint32 bm_callback_token_t
This type defines the Bus Manager token. Each callback registered with the Bus Manager receives a uni...
dm_ChannelDescriptor_t cDescriptor
isf_status_t bm_unregister_callback(bm_callback_token_t aToken)
This API unregisters one or more callbacks.
uint8 xOut
The Tilt X data from the sensor.
isf_acceleration_g_fixed_32s1i16_t accel[3]
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
#define MMA8491Q_WHOAMI_VALUE
#define MMA8491Q_ACCEL_FIXED_CONVERSION_FACTOR
isf_acceleration_g_float_t accel[3]
void fsl_mma8491q_i2c_3D_accel_PeriodicCallback(void *pSensorHandle)
isf_status_t dm_channel_acquire_lock(dm_ChannelDescriptor_t *apChannelDescriptor, isf_duration_t aTimeout)
This function locks the channel for exclusive access.
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_status_t fsl_mma8491q_i2c_3D_accel_StartData(isf_SensorHandle_t *pSensorHandle)
isf_dsa_status_t fsl_mma8491q_i2c_3D_accel_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_result_types_t resultFormat
The mma8491q.h contains register definitions and macros as well as the type definitions and public fu...
The fsl_mma8491q_i2c_3D_accel.h file contains the definitions and functions supporting the MMA8491q S...
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.
isf_SensorDataTypes_t resultType
void mma8491q_CheckId(int32_t *status, void *pSensorHandle)
This function validates the MMA8491Q sensor is connected via the I2C bus.
uint8 zOut
The Tilt Z data from the sensor.
MMA8491Q data buffer format.
isf_dsa_AdapterStatus_t adapterStatus
sys_channelId_t channelId
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...
int32 isf_status_t
ISF return status type.
isf_SensorDataTypes_t mma8491q_SupportedDataTypes[]
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
isf_dsa_SensorSettings_t sensorSettings
isf_timestamp_t timestamp
isf_dsa_status_t fsl_mma8491q_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)
isf_dsa_status_t fsl_mma8491q_i2c_3D_accel_Initialize(isf_SensorHandle_t *pSensorHandle)
#define mma8491q_xyz_format(destination, msb, lsb)
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.
void fsl_mma8491q_read_data_OneShotCallback(void *pSensorHandle)
This structure defines a handle for the device.
isf_devmsg.h defines the API definitions and types for the Intelligent Sensing (ISF) Device Messaging...
The isf_accelerometer_types.h file contains the ISF data type definitions for use with the ISF generi...
semaphore_t deviceSemaphore
This structure is a declaration of a channel descriptor type.
isf_SensorTypes_t mma8491q_SupportedSensorTypes[]
Supported sensor and data types for MMA8491q.
#define T_ON_8491Q_MICROSECONDS
bm_callback_token_t token
isf_dsa_status_t mma8491q_getAccelData(DeviceDescriptor_t *pDescriptor, int16 *pAccelData)