ISSDK  1.8
IoT Sensing Software Development Kit
isl29023_drv.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /**
9  * @file isl29023_drv.h
10  * @brief The isl29023_drv.h file describes the ISL29023 driver interface and structures.
11  */
12 
13 #ifndef ISL29023_FI_H_
14 #define ISL29023_FI_H_
15 
16 /* Standard C Includes */
17 #include <stdint.h>
18 
19 /* ISSDK Includes */
20 #include "isl29023.h"
21 #include "sensor_io_i2c.h"
22 #include "register_io_i2c.h"
23 
24 /*******************************************************************************
25  * Definitions
26  ******************************************************************************/
27 /*! @brief This defines the sensor specific information. */
28 typedef struct
29 {
30  registerDeviceInfo_t deviceInfo; /*!< I2C device context. */
31  ARM_DRIVER_I2C *pCommDrv; /*!< Pointer to the i2c driver. */
32  bool isInitialized; /*!< Init status.*/
33  uint16_t slaveAddress; /*!< slave address.*/
35 
36 /*! @brief This structure defines the isl29023 raw data buffer. */
37 typedef struct
38 {
39  uint32_t timestamp; /*!< Time stamp value in micro-seconds. */
40  uint16_t light; /*!< ADC output: unsigned 16/12/8/4-bits resolution */
42 
43 /*******************************************************************************
44  * APIs
45  ******************************************************************************/
46 /*! @brief The interface function to initialize the sensor.
47  * @details This function initialize the sensor and sensor handle.
48  * @param[in] pSensorHandle handle to the sensor.
49  * @param[in] pBus pointer to the CMSIS API compatible I2C bus object.
50  * @param[in] index the I2C device number.
51  * @param[in] sAddress slave address of the device on the bus.
52  * @param[in] whoami WHO_AM_I value of the device.
53  * @constraints This should be the first API to be called.
54  * Application has to ensure that previous instances of these APIs have exited before invocation.
55  * @reeentrant No
56  * @return ::ISL29023_I2C_Initialize() returns the status.
57  */
59  isl29023_i2c_sensorhandle_t *pSensorHandle, ARM_DRIVER_I2C *pBus, uint8_t index, uint16_t sAddress, uint8_t whoAmi);
60 
61 /*! @brief : The interface function to set the I2C Idle Task.
62  * @param[in] : isl29023_i2c_sensorhandle_t *pSensorHandle, handle to the sensor handle.
63  * @param[in] : registeridlefunction_t idleTask, function pointer to the function to execute on I2C Idle Time.
64  * @param[in] : void *userParam, the pointer to the user idle ftask parameters.
65  * @return void.
66  * @constraints This can be called any number of times only after ISL29023_I2C_Initialize().
67  * Application has to ensure that previous instances of these APIs have exited before invocation.
68  * @reeentrant No
69  */
71  registeridlefunction_t idleTask,
72  void *userParam);
73 
74 /*! @brief The interface function to configure he sensor.
75  * @details This function configure the sensor with requested ODR, Range and registers in the regsiter pair array.
76  * @param[in] pSensorHandle handle to the sensor.
77  * @param[in] pRegWriteList pointer to the register list.
78  * @constraints This can be called any number of times only after ISL29023_I2C_Initialize().
79  * Application has to ensure that previous instances of these APIs have exited before invocation.
80  * @reeentrant No
81  * @return ::ISL29023_I2C_Configure() returns the status.
82  */
84 
85 /*! @brief The interface function to read the sensor data.
86  * @details This function read the sensor data out from the device and returns raw data in a byte stream.
87  * @param[in] pSensorHandle handle to the sensor.
88  * @param[in] pReadList pointer to the list of device registers and values to read.
89  * @param[out] pBuffer buffer which holds raw sensor data.This buffer may be back to back databuffer based
90  * command read in the list.
91  * @constraints This can be called only after ISL29023_I2C_Initialize().
92  * Application has to ensure that previous instances of these APIs have exited before invocation.
93  * @reeentrant No
94  * @return ::ISL29023_I2C_ReadData() returns the status .
95  */
97  const registerreadlist_t *pReadList,
98  uint8_t *pBuffer);
99 
100 /*! @brief The interface function to De Initialize sensor..
101  * @details This function made sensor in a power safe state and de initialize its handle.
102  * @param[in] pSensorHandle handle to the sensor.
103  * @constraints This can be called only after ISL29023_I2C_Initialize() has been called.
104  * Application has to ensure that previous instances of these APIs have exited before invocation.
105  * @reeentrant No
106  * @return ::ISL29023_I2C_DeInit() returns the status.
107  */
109 
110 #endif // ISL29023_FI_H_
This structure defines the device specific info required by register I/O.
Definition: sensor_drv.h:102
void ISL29023_I2C_SetIdleTask(isl29023_i2c_sensorhandle_t *pSensorHandle, registeridlefunction_t idleTask, void *userParam)
: The interface function to set the I2C Idle Task.
Definition: isl29023_drv.c:52
This structure defines the isl29023 raw data buffer.
Definition: isl29023_drv.h:37
This structure defines the Write command List.
Definition: sensor_drv.h:68
int32_t ISL29023_I2C_ReadData(isl29023_i2c_sensorhandle_t *pSensorHandle, const registerreadlist_t *pReadList, uint8_t *pBuffer)
The interface function to read the sensor data.
Definition: isl29023_drv.c:87
int32_t ISL29023_I2C_DeInit(isl29023_i2c_sensorhandle_t *pSensorHandle)
The interface function to De Initialize sensor..
Definition: isl29023_drv.c:116
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...
registerDeviceInfo_t deviceInfo
Definition: isl29023_drv.h:30
This defines the sensor specific information.
Definition: isl29023_drv.h:28
void(* registeridlefunction_t)(void *userParam)
This is the register idle function type.
Definition: sensor_drv.h:97
ARM_DRIVER_I2C * pCommDrv
Definition: isl29023_drv.h:31
This structure defines the Read command List.
Definition: sensor_drv.h:78
int32_t ISL29023_I2C_Initialize(isl29023_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: isl29023_drv.c:21
int32_t ISL29023_I2C_Configure(isl29023_i2c_sensorhandle_t *pSensorHandle, const registerwritelist_t *pRegWriteList)
The interface function to configure he sensor.
Definition: isl29023_drv.c:60
The sensor_io_i2c.h file declares low-level interface functions for reading and writing sensor regist...