1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 #ifndef __APP_DEMO_I2C_H__ 17 #define __APP_DEMO_I2C_H__ 18 19 #include <hi_types_base.h> 20 #include <hi_i2c.h> 21 #include <hi_early_debug.h> 22 #include <hi_stdlib.h> 23 24 #define I2C_REG_ARRAY_LEN 64 25 #define ES8311_DEV_ADDR 0x30 /* 11000 0 */ 26 #define ES8311_REG_ADDR 0x10 27 #define I2C_SEND_LEN_2 2 28 #define I2C_RECV_LEN_1 1 29 30 hi_void i2c_demo_send_data_init(hi_void); 31 hi_u32 i2c_demo_write(hi_i2c_idx id, hi_u16 device_addr, hi_u32 send_len); 32 hi_u32 i2c_demo_writeread(hi_i2c_idx id, hi_u16 device_addr, hi_u32 recv_len); 33 hi_void i2c_demo(hi_i2c_idx id); 34 hi_void app_demo_custom_i2c(hi_void); 35 36 #endif 37