/* * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes *2023-03-28 Zxy first version */ #ifndef __DRV_HW_I2C_H__ #define __DRV_HW_I2C_H__ #include #include #include "sdkconfig.h" #define WRITE_BIT I2C_MASTER_WRITE /*!< I2C master write */ #define READ_BIT I2C_MASTER_READ /*!< I2C master read */ #define ACK_CHECK_EN 0x1 /*!< I2C master will check ack from slave*/ #define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */ #define ACK_VAL 0x0 /*!< I2C ack value */ #define NACK_VAL 0x1 /*!< I2C nack value */ #define _I2C_NUMBER(num) I2C_NUM_##num #define I2C_NUMBER(num) _I2C_NUMBER(num) #define I2C_MASTER_NUM I2C_NUMBER(0) /*!< I2C port number for master dev */ #define I2C_MASTER_SCL_IO CONFIG_I2C_MASTER_SCL /*!< gpio number for I2C master clock */ #define I2C_MASTER_SDA_IO CONFIG_I2C_MASTER_SDA /*!< gpio number for I2C master data */ #define CONFIG_I2C_MASTER_SCL 6 #define CONFIG_I2C_MASTER_SDA 5 int rt_hw_i2c_init(void); #endif /* __DRV_HW_I2C_H__ */