1 /*
2  * Copyright (c) 2006-2023, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  *2023-03-28      Zxy          first version
9  */
10 #ifndef __DRV_HW_I2C_H__
11 #define __DRV_HW_I2C_H__
12 
13 #include <rtthread.h>
14 #include <rtdevice.h>
15 #include "sdkconfig.h"
16 
17 #define WRITE_BIT I2C_MASTER_WRITE              /*!< I2C master write */
18 #define READ_BIT I2C_MASTER_READ                /*!< I2C master read */
19 #define ACK_CHECK_EN 0x1                        /*!< I2C master will check ack from slave*/
20 #define ACK_CHECK_DIS 0x0                       /*!< I2C master will not check ack from slave */
21 #define ACK_VAL 0x0                             /*!< I2C ack value */
22 #define NACK_VAL 0x1                            /*!< I2C nack value */
23 #define _I2C_NUMBER(num) I2C_NUM_##num
24 #define I2C_NUMBER(num) _I2C_NUMBER(num)
25 #define I2C_MASTER_NUM I2C_NUMBER(0) /*!< I2C port number for master dev */
26 #define I2C_MASTER_SCL_IO CONFIG_I2C_MASTER_SCL               /*!< gpio number for I2C master clock */
27 #define I2C_MASTER_SDA_IO CONFIG_I2C_MASTER_SDA               /*!< gpio number for I2C master data  */
28 #define CONFIG_I2C_MASTER_SCL 6
29 #define CONFIG_I2C_MASTER_SDA 5
30 int rt_hw_i2c_init(void);
31 
32 #endif /* __DRV_HW_I2C_H__ */
33