1 /* 2 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. 3 * Copyright 2016-2017 NXP 4 * All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 /** 10 * @file sensor_io_i2c.h 11 * @brief The sensor_io_i2c.h file declares low-level interface functions for reading 12 * and writing sensor registers. 13 */ 14 15 #ifndef __SENSOR_IO_I2C_H 16 #define __SENSOR_IO_I2C_H 17 18 #include <stdint.h> 19 #include <stdbool.h> 20 #include "Driver_I2C.h" 21 #include "register_io_i2c.h" 22 23 /******************************************************************************* 24 * API 25 ******************************************************************************/ 26 /*! @brief Write commands to a sensor 27 28 * @param[in] pCommDrv pointer to the I2C ARM driver to use 29 * @param[in] devInfo The I2C device number and idle function. 30 * @param[in] slaveAddress the I2C slave address to write to 31 * @param[in] pCommandList a list of one or more commands to write 32 * @param[in] error_mask The mask for Error Code Bits in CoCo Byte 33 * 34 * @return returns the execution status of the operation using ::ESensorErrors 35 */ 36 int32_t Sensor_I2C_BlockWrite(ARM_DRIVER_I2C *pCommDrv, 37 registerDeviceInfo_t *devInfo, 38 uint16_t slaveAddress, 39 const registercommandlist_t *pCommandList, 40 uint8_t error_mask); 41 42 /*! @brief Write register data to a sensor 43 44 * @param[in] pCommDrv pointer to the I2C ARM driver to use 45 * @param[in] devInfo The I2C device number and idle function. 46 * @param[in] slaveAddress the I2C slave address to write to 47 * @param[in] pRegWriteList a list of one or more register/value pairs to write 48 * 49 * @return returns the execution status of the operation using ::ESensorErrors 50 */ 51 int32_t Sensor_I2C_Write(ARM_DRIVER_I2C *pCommDrv, 52 registerDeviceInfo_t *devInfo, 53 uint16_t slaveAddress, 54 const registerwritelist_t *pRegWriteList); 55 56 /*! @brief Read register data from a sensor 57 58 * @param[in] pCommDrv pointer to the I2C ARM driver to use 59 * @param[in] devInfo The I2C device number and idle function. 60 * @param[in] slaveAddress the I2C slave address to read from 61 * @param[in] pReadList a list of one or more register addresses and lengths to read 62 * @param[in] pOutBuffer a pointer of sufficient size to contain the requested read data 63 * 64 * 65 * @return returns the execution status of the operation using ::ESensorErrors 66 */ 67 int32_t Sensor_I2C_Read(ARM_DRIVER_I2C *pCommDrv, 68 registerDeviceInfo_t *devInfo, 69 uint16_t slaveAddress, 70 const registerreadlist_t *pReadList, 71 uint8_t *pOutBuffer); 72 73 #endif /* __SENSOR_IO_I2C_H */ 74