ISSDK  1.8
IoT Sensing Software Development Kit
dbap_drv.h
Go to the documentation of this file.
1 /*
2 * Copyright 2020 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7 
8 
9 /**
10  * @file dbap_drv.h
11  * @brief The dbap_drv.h file describes the DBAP driver interface and structures.
12  */
13 
14 #ifndef DBAP_DRV_H_
15 #define DBAP_DRV_H_
16 
17 /* Standard C Includes */
18 #include <stdint.h>
19 
20 /* ISSDK Includes */
21 #include "dbap.h"
22 #include "sensor_io_i2c.h"
23 #include "sensor_io_spi.h"
24 #include "register_io_i2c.h"
25 #include "register_io_spi.h"
26 
27 /*******************************************************************************
28  * Definitions
29  ******************************************************************************/
30 /*!
31  * @brief This defines the sensor specific information for I2C.
32  */
33 typedef struct
34 {
35  registerDeviceInfo_t deviceInfo; /*!< I2C device context. */
36  ARM_DRIVER_I2C *pCommDrv; /*!< Pointer to the i2c driver. */
37  bool isInitialized; /*!< whether sensor is intialized or not.*/
38  uint16_t slaveAddress; /*!< slave address.*/
40 
41 /*! @brief This structure defines the dbap data buffer in Pressure Mode.*/
42 typedef struct
43 {
44  uint32_t timestamp; /*!< Time stamp value in micro-seconds. */
45  uint16_t pressure; /*!< Sensor pressure output: unsigned 16-bits justified to MSBs. */
46  int8_t temperature; /*!< Sensor temperature output; 2's complement 8-bits justified to MSBs. */
48 
49 /*******************************************************************************
50  * APIs
51  ******************************************************************************/
52 /*! @brief The interface function to initialize the sensor.
53  * @details This function initialize the sensor and sensor handle.
54  * @param[in] pSensorHandle handle to the sensor.
55  * @param[in] pBus pointer to the CMSIS API compatible I2C bus object.
56  * @param[in] index the I2C device number.
57  * @param[in] sAddress slave address of the device on the bus.
58  * @param[in] whoami WHO_AM_I value of the device.
59  * @constraints This should be the first API to be called.
60  * Application has to ensure that previous instances of these APIs have exited before invocation.
61  * @reeentrant No
62  * @return ::DBAP_I2C_Initialize() returns the status.
63  */
65  dbap_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi);
66 
67 /*! @brief : The interface function to set the I2C Idle Task.
68  * @param[in] : dbap_i2c_sensorhandle_t *pSensorHandle, handle to the sensor handle.
69  * @param[in] : registeridlefunction_t idleTask, function pointer to the function to execute on I2C Idle Time.
70  * @param[in] : void *userParam, the pointer to the user idle ftask parameters.
71  * @return void.
72  * @constraints This can be called any number of times only after DBAP_I2C_Initialize().
73  * Application has to ensure that previous instances of these APIs have exited before invocation.
74  * @reeentrant No
75  */
76 void DBAP_I2C_SetIdleTask(dbap_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam);
77 
78 /*! @brief The interface function to configure he sensor.
79  * @details This function configure the sensor with requested ODR, Range and registers in the regsiter pair array.
80  * @param[in] pSensorHandle handle to the sensor.
81  * @param[in] pRegWriteList pointer to the register list.
82  * @constraints This can be called any number of times only after DBAP_I2C_Initialize().
83  * Application has to ensure that previous instances of these APIs have exited before invocation.
84  * @reeentrant No
85  * @return ::DBAP_I2C_Configure() returns the status.
86  */
87 int32_t DBAP_I2C_Configure(dbap_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList);
88 
89 /*! @brief The interface function to read the sensor data.
90  * @details This function read the sensor data out from the device and returns raw data in a byte stream.
91  * @param[in] pSensorHandle handle to the sensor.
92  * @param[in] pReadList pointer to the list of device registers and values to read.
93  * @param[out] pBuffer buffer which holds raw sensor data.This buffer may be back to back databuffer based
94  * command read in the list.
95  * @constraints This can be called only after DBAP_I2C_Initialize().
96  * Application has to ensure that previous instances of these APIs have exited before invocation.
97  * @reeentrant No
98  * @return ::DBAP_I2C_ReadData() returns the status .
99  */
101  const registerreadlist_t *pReadList,
102  uint8_t *pBuffer);
103 
104 #endif // DBAP_DRV_H_
This structure defines the device specific info required by register I/O.
Definition: sensor_drv.h:102
This structure defines the Write command List.
Definition: sensor_drv.h:68
The sensor_io_spi.h file declares low-level interface functions for reading and writing sensor regist...
uint32_t timestamp
Definition: dbap_drv.h:44
This defines the sensor specific information for I2C.
Definition: dbap_drv.h:33
int8_t temperature
Definition: dbap_drv.h:46
The register_io_spi.h file declares low-level interface functions for reading and writing sensor regi...
ARM_DRIVER_I2C * pCommDrv
Definition: dbap_drv.h:36
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
The register_io_i2c.h file declares low-level interface functions for reading and writing sensor regi...
int32_t DBAP_I2C_ReadData(dbap_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Definition: dbap_drv.c:86
registerDeviceInfo_t deviceInfo
Definition: dbap_drv.h:35
int32_t DBAP_I2C_Configure(dbap_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
Definition: dbap_drv.c:59
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
Definition: sensor_drv.h:97
The fxps7250.h contains the FXPS7250 pressure sensor register definitions, access macros...
int32_t DBAP_I2C_Initialize(dbap_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi)
The interface function to initialize the sensor.
Definition: dbap_drv.c:21
void DBAP_I2C_SetIdleTask(dbap_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
Definition: dbap_drv.c:53
uint16_t pressure
Definition: dbap_drv.h:45
This structure defines the Read command List.
Definition: sensor_drv.h:78
This structure defines the dbap data buffer in Pressure Mode.
Definition: dbap_drv.h:42
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...