40 #include "rtos_main_task.h"
76 #define Custom_1_CONVERT_FLOAT_FACTOR 0.000061
77 #define Custom_1_CONVERT_FIXED_FACTOR 4
185 void Custom_1_fsl_Sensor_Custom_Convert(
volatile void* pSensorHandle, uint32_t convertToType, uint8_t resultType,
void* pNativeSample,
void* pConvertedSample, int32_t *numBytes, uint8_t *retVal)
191 switch (convertToType)
207 if (pConverter == NULL)
212 retStat = pConverter(
214 (Custom_1_DataBuffer_t *)pNativeSample, pConvertedSample);
235 if (NULL == pSensorHandle)
248 if (NULL == pDeviceDescriptor)
267 if (kStatus_OSA_Success != OSA_SemaWait(&pDeviceDescriptor->
deviceSemaphore, OSA_WAIT_FOREVER))
269 goto unlockdescriptor;
275 goto unlockdescriptor;
278 #define BYTES_FOR_FULL_READ 7
288 pSensorData[0] = ((
int16)registerData[1])<<8 | registerData[2];
289 pSensorData[1] = ((
int16)registerData[3])<<8 | registerData[4];
290 pSensorData[2] = ((
int16)registerData[5])<<8 | registerData[6];
303 *pFifoEntry = *pCurrentSampleBuffer;
311 pCurrentSampleBuffer, pFifoEntry, &numBytes);
343 if(NULL == pSensorHandle)
375 if(NULL == pSensorHandle)
381 uint8 buffer[1] = {0x00};
389 if (NULL == pDeviceDescriptor)
400 goto unlockdescriptor;
410 goto unlockdescriptor;
426 goto unlockdescriptor;
455 if(NULL == pSensorHandle)
461 uint8 buffer[1] = {0x00};
468 if (NULL == pDeviceDescriptor)
479 goto unlockdescriptor;
507 goto unlockdescriptor;
513 goto unlockdescriptor;
544 if((NULL == pSensorHandle) || (NULL == pSensorSettings))
550 uint8 buffer[1] = {0x00};
557 if (NULL == pDeviceDescriptor)
568 goto unlockdescriptor;
575 goto unlockdescriptor;
662 if ((NULL == pSensorHandle) || (NULL == pSensorSettings))
687 if ( NULL == pSensorHandle)
706 if (NULL == pDeviceDescriptor)
715 pCurrentSampleBuffer->
data[0] = 0;
716 pCurrentSampleBuffer->
data[1] = 0;
717 pCurrentSampleBuffer->
data[2] = 0;
718 pCurrentSampleBuffer->
addr = ((i2c_device_t *)((
isf_SensorHandle_t *)pSensorHandle)->pSensorStaticConfig->commInfo)->address;
749 uint8 buffer[1] = {0};
758 if ((Custom_1_Who_Am_I_Values[0] != buffer[0]) && (Custom_1_Who_Am_I_Values[1] != buffer[0]))
772 if (kStatus_OSA_Success != OSA_SemaCreate(&pDeviceDescriptor->
deviceSemaphore, 1))
isf_status_t dm_channel_start(dm_ChannelDescriptor_t *apChannelDescriptor)
This function starts a channel.
isf_SensorDataTypes_t Custom_1_SupportedDataTypes[]
isf_dsa_status_t Custom_1_float_Custom_converter(Custom_1_Sensor_Specific_Settings_t *pSensorSpecificConfig, Custom_1_DataBuffer_t *nativeSample, void *vpConvertedSample)
#define Custom_1_CONVERT_FLOAT_FACTOR
uint32 isf_time_util_get_usec(void)
This API returns the time in microseconds.
This is user's event module. Put your event handler code here.
isf_dsa_status_t fsl_Sensor_Custom_1_Initialize(isf_SensorHandle_t *pSensorHandle)
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_dsa_status_t fsl_Sensor_Custom_1_EndData(isf_SensorHandle_t *pSensorHandle)
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_Sensor_Custom_1_Convert(volatile isf_SensorHandle_t *pSensorHandle, isf_SensorDataTypes_t convertToType, isf_dsa_result_types_t resultType, void *pNativeSample, void *pConvertedSample, int32_t *numBytes)
dm_DeviceDescriptor_t deviceHandle
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
This structure defines important settings.
Define the sensor device descriptor.
void Custom_1_fsl_Sensor_Custom_EndData(void *pSensorHandle, uint8_t *retVal)
Custom_1_Sensor_Specific_Settings_t Custom_1_Sensor_Specific_Config
This allows access to the sensor specific configuration for the target sensor.
This is user's event module. Put your event handler code here.
void Custom_1_fsl_Sensor_Custom_Shutdown(void *pSensorHandle, uint8_t *retVal)
isf_dsa_status_t fsl_Sensor_Custom_1_ValidateSettings(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
isf_dsa_status_t fsl_Sensor_Custom_1_Configure(isf_SensorHandle_t *pSensorHandle, isf_dsa_SensorSettings_t *pSensorSettings)
dm_ChannelDescriptor_t cDescriptor
isf_timestamp_t timestamp
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.
void Custom_1_fsl_Sensor_Custom_PeriodicCallback(void *pSensorHandle)
#define Custom_1_CONVERT_FIXED_FACTOR
isf_dsa_status_t Custom_1_fixed_Custom_converter(Custom_1_Sensor_Specific_Settings_t *pSensorSpecificConfig, Custom_1_DataBuffer_t *nativeSample, void *vpConvertedSample)
Standard fixed type for three axis accelerometers.
int32 isf_dsa_status_t
This is the Sensor Manager API return type definition.
#define BYTES_FOR_FULL_READ
isf_status_t dm_channel_acquire_lock(dm_ChannelDescriptor_t *apChannelDescriptor, isf_duration_t aTimeout)
This function locks the channel for exclusive access.
isf_dsa_status_t fsl_Sensor_Custom_1_StartData(isf_SensorHandle_t *pSensorHandle)
enum isf_dsa_result_enums isf_dsa_result_types_t
isf_Custom_1_float_data_t sensorData[3]
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.
uint8 sensorFullScaleRange
const uint8_t Custom_1_Who_Am_I_Values[]
Define the WHO_AM_I register values for both possible sensor variations.
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.
This is user's event module. Put your event handler code here.
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.
isf_status_t bm_start(boolean aSync, bm_callback_token_t aTokens)
This API sets one or more callback(s) to the active state.
#define Custom_1_ACTIVE_MASK
isf_SensorDataTypes_t resultType
isf_dsa_AdapterStatus_t adapterStatus
unsigned short int uint16
#define Custom_1_GET_FIELD(name, val)
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_SensorTypes_t Custom_1_SupportedSensorTypes[]
Supported sensor and data types for the Sensor.
This defines the DSA sensor configuration parameter structure configuring the sensor settings by a su...
This is user's event module. Put your event handler code here.
isf_dsa_SensorSettings_t sensorSettings
#define Custom_1_SET_FIELD(name, val)
void Custom_1_fsl_Sensor_Custom_Initialize(void *pSensorHandle, uint8_t *retVal)
isf_Custom_1_fixed_data_t sensorData[3]
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 the dummy DSA data buffer format.
This is user's event module. Put your event handler code here.
void Custom_1_fsl_Sensor_Custom_StartData(void *pSensorHandle, uint8_t *retVal)
void Custom_1_fsl_Sensor_Custom_Configure(void *pSensorHandle, void *pSensorSettings, uint8_t *retVal)
This structure defines a handle for the device.
void Custom_1_fsl_Sensor_Custom_ValidateSettings(void *pSensorHandle, void *pSensorSettings, uint8_t *retVal)
const i2c_device_t Custom_1_DeviceInfo
This allows access to the sensor communications specific configuration.
void Custom_1_fsl_Sensor_Custom_Convert(volatile void *pSensorHandle, uint32_t convertToType, uint8_t resultType, void *pNativeSample, void *pConvertedSample, int32_t *numBytes, uint8_t *retVal)
semaphore_t deviceSemaphore
This structure is a declaration of a channel descriptor type.
isf_dsa_status_t fsl_Sensor_Custom_1_Shutdown(isf_SensorHandle_t *pSensorHandle)
bm_callback_token_t token
isf_timestamp_t timestamp