1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 17 /** 18 * @addtogroup wifiiot 19 * @{ 20 * 21 * @brief Provides dedicated device operation interfaces on the Wi-Fi module, 22 * including ADC, AT, flash, GPIO, I2C, I2S, partition, PWM, SDIO, UART, and watchdog. 23 * 24 * 25 * 26 * @since 1.0 27 * @version 1.0 28 */ 29 30 /** 31 * @file wifiiot_i2c_ex.h 32 * 33 * @brief Declares the extended I2C interface functions. 34 * 35 * These functions are used for I2C baud rate setting and device exception callback. \n 36 * 37 * @since 1.0 38 * @version 1.0 39 */ 40 41 #ifndef IOT_I2C_EX_H 42 #define IOT_I2C_EX_H 43 44 45 /** 46 * @brief Defines I2C data transmission attributes. 47 */ 48 typedef struct { 49 /** Pointer to the buffer storing data to send */ 50 unsigned char *sendBuf; 51 /** Length of data to send */ 52 unsigned int sendLen; 53 /** Pointer to the buffer for storing data to receive */ 54 unsigned char *receiveBuf; 55 /** Length of data received */ 56 unsigned int receiveLen; 57 } IotI2cData; 58 59 60 /** 61 * @brief Sends data to and receives data responses from an I2C device. 62 * 63 * 64 * 65 * @param id Indicates the I2C device ID. 66 * @param deviceAddr Indicates the I2C device address. 67 * @param i2cData Indicates the pointer to the device descriptor of the data to receive. 68 * @return Returns {@link WIFI_IOT_SUCCESS} if the operation is successful; 69 * returns an error code defined in {@link wifiiot_errno.h} otherwise. 70 * @since 1.0 71 * @version 1.0 72 */ 73 unsigned int IoTI2cWriteread(unsigned int id, unsigned short deviceAddr, const IotI2cData *i2cData); 74 75 76 77 #endif 78 /** @} */ 79