rt-thread/bsp/w60x/drivers/drv_soft_i2c.h
tangyuxin 08656c3034 [bsp][w60x] 更新驱动,添加加解密及配网功能,增强稳定性。
1. 新增 crypto, onchip_Flash, soft_i2c 驱动
2. 新增 oneshot 配网功能
3. 完善 I2C, UART, SPI, WIFI 等基本驱动
4. 更新 Kconfig 配置,用户交互更加友好
5. 屏蔽 末尾 80 内存,无法作为栈使用。
2019-08-03 10:52:37 +08:00

62 lines
1.6 KiB
C

/*
* Copyright (c) 2006-2019, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-03-22 balanceTWK first version
*/
#ifndef __DRV_SOFT_I2C__
#define __DRV_SOFT_I2C__
#include <rtthread.h>
#include <rthw.h>
#include <rtdevice.h>
/* w60x config class */
struct w60x_soft_i2c_config
{
rt_uint8_t scl;
rt_uint8_t sda;
const char *bus_name;
};
/* w60x i2c dirver class */
struct w60x_i2c
{
struct rt_i2c_bit_ops ops;
struct rt_i2c_bus_device i2c2_bus;
};
#ifdef BSP_USING_SOFT_I2C1
#define I2C1_BUS_CONFIG \
{ \
.scl = SOFT_I2C1_SCL_PIN, \
.sda = SOFT_I2C1_SDA_PIN, \
.bus_name = "i2c1soft", \
}
#endif
#ifdef BSP_USING_SOFT_I2C2
#define I2C2_BUS_CONFIG \
{ \
.scl = SOFT_I2C2_SCL_PIN, \
.sda = SOFT_I2C2_SDA_PIN, \
.bus_name = "i2c2soft", \
}
#endif
#ifdef BSP_USING_SOFT_I2C3
#define I2C3_BUS_CONFIG \
{ \
.scl = SOFT_I2C3_SCL_PIN, \
.sda = SOFT_I2C3_SDA_PIN, \
.bus_name = "i2c3soft", \
}
#endif
int rt_hw_i2c_init(void);
#endif