mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
[bsp][drivers][soft_i2c] unify the software I2C driver
This commit is contained in:
@@ -24,8 +24,11 @@ devices.swi2c:
|
||||
depends:
|
||||
- devices.i2c
|
||||
kconfig:
|
||||
- CONFIG_BSP_USING_SW_I2C=y
|
||||
- CONFIG_BSP_USING_SW_I2C0=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C0=y
|
||||
- CONFIG_RT_SOFT_I2C0_SCL_PIN=19
|
||||
- CONFIG_RT_SOFT_I2C0_SDA_PIN=18
|
||||
- CONFIG_RT_SOFT_I2C0_BUS_NAME="swi2c0"
|
||||
devices.spi:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_SPI=y
|
||||
@@ -60,4 +63,4 @@ devices.at:
|
||||
- CONFIG_RT_USING_AT=y
|
||||
- CONFIG_AT_USING_CLIENT=y
|
||||
- CONFIG_RT_USING_SAL=y
|
||||
- CONFIG_RT_USING_NETDEV=y
|
||||
- CONFIG_RT_USING_NETDEV=y
|
||||
|
||||
@@ -75,25 +75,27 @@ menu "On-chip Peripheral Drivers"
|
||||
menuconfig BSP_USING_HW_I2C
|
||||
bool "Enable HardWare I2C"
|
||||
default n
|
||||
|
||||
menuconfig BSP_USING_SW_I2C
|
||||
bool "Enable SoftWare I2C"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
if BSP_USING_SW_I2C
|
||||
config BSP_USING_SW_I2C0
|
||||
bool "Enable SoftWare I2C0"
|
||||
default n
|
||||
if BSP_USING_SW_I2C0
|
||||
config BSP_SW_I2C0_SDA_PIN
|
||||
int "SWI2C0 sda pin number"
|
||||
range 0 21
|
||||
default 18
|
||||
config BSP_SW_I2C0_SCL_PIN
|
||||
int "SWI2C0 scl pin number"
|
||||
range 0 21
|
||||
default 19
|
||||
endif
|
||||
endif
|
||||
select RT_USING_I2C
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C0
|
||||
bool "Enable software I2C0 Bus (swi2c0)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C0
|
||||
if BSP_USING_SOFT_I2C0
|
||||
config RT_SOFT_I2C0_SCL_PIN
|
||||
int "swi2c0 SCL pin number"
|
||||
default 19
|
||||
config RT_SOFT_I2C0_SDA_PIN
|
||||
int "swi2c0 SDA pin number"
|
||||
default 18
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
@@ -171,4 +173,16 @@ config BSP_ENABLE_GDBSTUB
|
||||
bool "Enable ESP_GDBSTUB compontent"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
config RT_SOFT_I2C0_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C0
|
||||
|
||||
config RT_SOFT_I2C0_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 19 if RT_USING_SOFT_I2C0
|
||||
|
||||
config RT_SOFT_I2C0_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 18 if RT_USING_SOFT_I2C0
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -18,9 +18,6 @@ if GetDepend('BSP_USING_ADC'):
|
||||
if GetDepend('BSP_USING_I2C'):
|
||||
src += ['drv_hw_i2c.c']
|
||||
|
||||
if GetDepend('BSP_USING_SW_I2C'):
|
||||
src += ['drv_sw_i2c.c']
|
||||
|
||||
if GetDepend('BSP_USING_PWM'):
|
||||
src += ['drv_pwm.c']
|
||||
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2024 RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2024-12-07 wumingzi first version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#define LOG_TAG "drv.i2c"
|
||||
#ifdef RT_USING_I2C
|
||||
#ifdef BSP_USING_SW_I2C
|
||||
#include "rthw.h"
|
||||
#include "rttypes.h"
|
||||
#include <rtdbg.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "drv_sw_i2c.h"
|
||||
|
||||
#if defined(BSP_USING_SW_I2C0)
|
||||
#define SW_I2C0_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_SW_I2C0_SCL_PIN, \
|
||||
.sda = BSP_SW_I2C0_SDA_PIN, \
|
||||
.bus_name = "i2c0", \
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct esp32c3_soft_i2c_config soft_i2c_config[] =
|
||||
{
|
||||
#if defined(BSP_USING_SW_I2C0)
|
||||
SW_I2C0_BUS_CONFIG,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct esp32c3_i2c i2c_obj[sizeof(soft_i2c_config) / sizeof(soft_i2c_config[0])];
|
||||
|
||||
/**
|
||||
* @brief This function initializes the i2c pin.
|
||||
* @param i2c
|
||||
* @retval None
|
||||
*/
|
||||
static void esp32c3_i2c_gpio_init(struct esp32c3_i2c *i2c)
|
||||
{
|
||||
struct esp32c3_soft_i2c_config* cfg = (struct esp32c3_soft_i2c_config*)i2c->ops.data;
|
||||
rt_pin_mode(cfg->scl, PIN_MODE_OUTPUT_OD);
|
||||
rt_pin_mode(cfg->sda, PIN_MODE_OUTPUT_OD);
|
||||
|
||||
gpio_set_pull_mode(cfg->sda, GPIO_FLOATING);
|
||||
gpio_set_pull_mode(cfg->scl, GPIO_FLOATING);
|
||||
|
||||
gpio_set_level(cfg->scl, PIN_HIGH);
|
||||
gpio_set_level(cfg->sda, PIN_HIGH);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function sets the sda pin.
|
||||
* @param data, state
|
||||
* @retval None
|
||||
*/
|
||||
static void esp32c3_set_sda(void *data, rt_int32_t state)
|
||||
{
|
||||
struct esp32c3_soft_i2c_config* cfg = (struct esp32c3_soft_i2c_config*)data;
|
||||
/*rt_pin_mode(cfg->sda, PIN_MODE_OUTPUT_OD);*/
|
||||
if (state)
|
||||
{
|
||||
gpio_set_level(cfg->sda, PIN_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set_level(cfg->sda, PIN_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function sets the scl pin.
|
||||
* @param data, state
|
||||
* @retval None
|
||||
*/
|
||||
static void esp32c3_set_scl(void *data, rt_int32_t state)
|
||||
{
|
||||
struct esp32c3_soft_i2c_config* cfg = (struct esp32c3_soft_i2c_config*)data;
|
||||
if (state)
|
||||
{
|
||||
gpio_set_level(cfg->scl, PIN_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
gpio_set_level(cfg->scl, PIN_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function gets the sda pin state.
|
||||
* @param data
|
||||
* @retval None
|
||||
*/
|
||||
static rt_int32_t esp32c3_get_sda(void *data)
|
||||
{
|
||||
struct esp32c3_soft_i2c_config* cfg = (struct esp32c3_soft_i2c_config*)data;
|
||||
return gpio_get_level(cfg->sda);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function gets the scl pin state.
|
||||
* @param data
|
||||
* @retval None
|
||||
*/
|
||||
static rt_int32_t esp32c3_get_scl(void *data)
|
||||
{
|
||||
struct esp32c3_soft_i2c_config* cfg = (struct esp32c3_soft_i2c_config*)data;
|
||||
return gpio_get_level(cfg->scl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The time delay function.
|
||||
* @param us
|
||||
* @retval None
|
||||
*/
|
||||
static void esp32c3_udelay(rt_uint32_t us)
|
||||
{
|
||||
rt_hw_us_delay(us);
|
||||
}
|
||||
|
||||
/*
|
||||
* if i2c is locked, this function will unlock it
|
||||
*
|
||||
* @param esp32 config class
|
||||
*
|
||||
* @return RT_EOK indicates successful unlock.
|
||||
*/
|
||||
/* */
|
||||
static rt_err_t esp32c3_i2c_bus_unlock(const struct esp32c3_soft_i2c_config *cfg)
|
||||
{
|
||||
rt_int32_t i = 0;
|
||||
|
||||
if (PIN_LOW == rt_pin_read(cfg->sda))
|
||||
{
|
||||
/* 输出9个时钟 解锁IIC死锁 */
|
||||
while (i++ < 9)
|
||||
{
|
||||
gpio_set_level(cfg->scl, PIN_HIGH);
|
||||
esp32c3_udelay(100);
|
||||
gpio_set_level(cfg->scl, PIN_LOW);
|
||||
esp32c3_udelay(100);
|
||||
}
|
||||
}
|
||||
if (PIN_LOW == gpio_get_level(cfg->sda))
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bit_ops esp32c3_bit_ops_default =
|
||||
{
|
||||
.data = RT_NULL,
|
||||
.set_sda = esp32c3_set_sda,
|
||||
.set_scl = esp32c3_set_scl,
|
||||
.get_sda = esp32c3_get_sda,
|
||||
.get_scl = esp32c3_get_scl,
|
||||
.udelay = esp32c3_udelay,
|
||||
.delay_us = 1,
|
||||
.timeout = 100
|
||||
};
|
||||
|
||||
int rt_sw_i2c_init(void)
|
||||
{
|
||||
/* I2C设备数量 */
|
||||
rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct esp32c3_i2c);
|
||||
rt_err_t result;
|
||||
/* 循环初始化 */
|
||||
for (int i = 0; i < obj_num; i++)
|
||||
{
|
||||
/* 注册方法 */
|
||||
i2c_obj[i].ops = esp32c3_bit_ops_default;
|
||||
/* 设备硬件数据 */
|
||||
i2c_obj[i].ops.data = (void*)&soft_i2c_config[i];
|
||||
/* 保存设备方法 */
|
||||
i2c_obj[i].i2c_bus.priv = &i2c_obj[i].ops;
|
||||
|
||||
esp32c3_i2c_gpio_init(&i2c_obj[i]);
|
||||
result = rt_i2c_bit_add_bus(&i2c_obj[i].i2c_bus, soft_i2c_config[i].bus_name);
|
||||
RT_ASSERT(result == RT_EOK);
|
||||
|
||||
esp32c3_i2c_bus_unlock(&soft_i2c_config[i]);
|
||||
LOG_D("software simulation %s init done, pin scl: %d, pin sda %d",
|
||||
soft_i2c_config[i].bus_name,
|
||||
soft_i2c_config[i].scl,
|
||||
soft_i2c_config[i].sda);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_APP_EXPORT(rt_sw_i2c_init);
|
||||
|
||||
#endif /* BSP_USING_SW_I2C */
|
||||
#endif /* RT_USING_I2C */
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2024 RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2024-12-07 wumingzi first version
|
||||
*/
|
||||
#ifndef __DRV_HW_I2C_H__
|
||||
#define __DRV_HW_I2C_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* esp32c3 config class */
|
||||
struct esp32c3_soft_i2c_config
|
||||
{
|
||||
rt_uint8_t scl;
|
||||
rt_uint8_t sda;
|
||||
const char *bus_name;
|
||||
};
|
||||
|
||||
/* esp32c3 i2c dirver class */
|
||||
struct esp32c3_i2c
|
||||
{
|
||||
struct rt_i2c_bit_ops ops;
|
||||
struct rt_i2c_bus_device i2c_bus;
|
||||
};
|
||||
|
||||
int rt_hw_i2c_init(void);
|
||||
|
||||
#endif /* __DRV_HW_I2C_H__ */
|
||||
@@ -18,10 +18,6 @@ if GetDepend(['RT_USING_SERIAL']):
|
||||
else:
|
||||
src += ['drv_uart.c']
|
||||
|
||||
if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
|
||||
if GetDepend('BSP_USING_I2C1'):
|
||||
src += ['drv_soft_i2c.c']
|
||||
|
||||
if GetDepend(['RT_USING_I2C']):
|
||||
if GetDepend('BSP_USING_HW_I2C1') or GetDepend('BSP_USING_HW_I2C3') or GetDepend('BSP_USING_HW_I2C4') or GetDepend('BSP_USING_HW_I2C6'):
|
||||
src += ['drv_i2c.c']
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2024 RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-07-20 Rbb666 first version
|
||||
*/
|
||||
|
||||
#include <board.h>
|
||||
#include "drv_soft_i2c.h"
|
||||
|
||||
#ifdef RT_USING_I2C
|
||||
|
||||
/*#define DRV_DEBUG*/
|
||||
#define LOG_TAG "drv.i2c"
|
||||
#include <drv_log.h>
|
||||
|
||||
#if !defined(BSP_USING_I2C1)
|
||||
#error "Please define at least one BSP_USING_I2Cx"
|
||||
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
|
||||
#endif
|
||||
|
||||
static const struct ifx_soft_i2c_config soft_i2c_config[] =
|
||||
{
|
||||
#ifdef BSP_USING_I2C1
|
||||
I2C1_BUS_CONFIG,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct ifx_i2c i2c_obj[sizeof(soft_i2c_config) / sizeof(soft_i2c_config[0])];
|
||||
|
||||
/**
|
||||
* This function initializes the i2c pin.
|
||||
*
|
||||
* @param ifx i2c dirver class.
|
||||
*/
|
||||
static void ifx_i2c_gpio_init(struct ifx_i2c *i2c)
|
||||
{
|
||||
struct ifx_soft_i2c_config *cfg = (struct ifx_soft_i2c_config *)i2c->ops.data;
|
||||
|
||||
rt_pin_mode(cfg->scl, PIN_MODE_OUTPUT_OD);
|
||||
rt_pin_mode(cfg->sda, PIN_MODE_OUTPUT_OD);
|
||||
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
rt_pin_write(cfg->sda, PIN_HIGH);
|
||||
}
|
||||
|
||||
static void ifx_i2c_pin_init(void)
|
||||
{
|
||||
rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct ifx_i2c);
|
||||
|
||||
for(rt_size_t i = 0; i < obj_num; i++)
|
||||
{
|
||||
ifx_i2c_gpio_init(&i2c_obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sets the sda pin.
|
||||
*
|
||||
* @param ifx config class.
|
||||
* @param The sda pin state.
|
||||
*/
|
||||
static void ifx_set_sda(void *data, rt_int32_t state)
|
||||
{
|
||||
struct ifx_soft_i2c_config *cfg = (struct ifx_soft_i2c_config *)data;
|
||||
|
||||
if (state)
|
||||
{
|
||||
rt_pin_write(cfg->sda, PIN_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_pin_write(cfg->sda, PIN_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sets the scl pin.
|
||||
*
|
||||
* @param ifx config class.
|
||||
* @param The scl pin state.
|
||||
*/
|
||||
static void ifx_set_scl(void *data, rt_int32_t state)
|
||||
{
|
||||
struct ifx_soft_i2c_config *cfg = (struct ifx_soft_i2c_config *)data;
|
||||
|
||||
if (state)
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function gets the sda pin state.
|
||||
*
|
||||
* @param The sda pin state.
|
||||
*/
|
||||
static rt_int32_t ifx_get_sda(void *data)
|
||||
{
|
||||
struct ifx_soft_i2c_config *cfg = (struct ifx_soft_i2c_config *)data;
|
||||
return rt_pin_read(cfg->sda);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function gets the scl pin state.
|
||||
*
|
||||
* @param The scl pin state.
|
||||
*/
|
||||
static rt_int32_t ifx_get_scl(void *data)
|
||||
{
|
||||
struct ifx_soft_i2c_config *cfg = (struct ifx_soft_i2c_config *)data;
|
||||
return rt_pin_read(cfg->scl);
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bit_ops ifx_bit_ops_default =
|
||||
{
|
||||
.data = RT_NULL,
|
||||
.pin_init = ifx_i2c_pin_init,
|
||||
.set_sda = ifx_set_sda,
|
||||
.set_scl = ifx_set_scl,
|
||||
.get_sda = ifx_get_sda,
|
||||
.get_scl = ifx_get_scl,
|
||||
.udelay = rt_hw_us_delay,
|
||||
.delay_us = 1,
|
||||
.timeout = 100,
|
||||
.i2c_pin_init_flag = RT_FALSE
|
||||
};
|
||||
|
||||
/**
|
||||
* if i2c is locked, this function will unlock it
|
||||
*
|
||||
* @param ifx config class
|
||||
*
|
||||
* @return RT_EOK indicates successful unlock.
|
||||
*/
|
||||
static rt_err_t ifx_i2c_bus_unlock(const struct ifx_soft_i2c_config *cfg)
|
||||
{
|
||||
rt_int32_t i = 0;
|
||||
|
||||
if (PIN_LOW == rt_pin_read(cfg->sda))
|
||||
{
|
||||
while (i++ < 9)
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
rt_hw_us_delay(100);
|
||||
rt_pin_write(cfg->scl, PIN_LOW);
|
||||
rt_hw_us_delay(100);
|
||||
}
|
||||
}
|
||||
|
||||
if (PIN_LOW == rt_pin_read(cfg->sda))
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
/* I2C initialization function */
|
||||
int rt_hw_i2c_init(void)
|
||||
{
|
||||
rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct ifx_i2c);
|
||||
rt_err_t result;
|
||||
|
||||
for (int i = 0; i < obj_num; i++)
|
||||
{
|
||||
i2c_obj[i].ops = ifx_bit_ops_default;
|
||||
i2c_obj[i].ops.data = (void *)&soft_i2c_config[i];
|
||||
i2c_obj[i].i2c_bus.priv = &i2c_obj[i].ops;
|
||||
|
||||
result = rt_i2c_bit_add_bus(&i2c_obj[i].i2c_bus, soft_i2c_config[i].bus_name);
|
||||
RT_ASSERT(result == RT_EOK);
|
||||
ifx_i2c_bus_unlock(&soft_i2c_config[i]);
|
||||
|
||||
LOG_D("software simulation %s init done, pin scl: %d, pin sda %d",
|
||||
soft_i2c_config[i].bus_name,
|
||||
soft_i2c_config[i].scl,
|
||||
soft_i2c_config[i].sda);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_BOARD_EXPORT(rt_hw_i2c_init);
|
||||
|
||||
#endif /* RT_USING_I2C */
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2024 RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-07-20 Rbb666 first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_I2C__
|
||||
#define __DRV_I2C__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
/* ifx config class */
|
||||
struct ifx_soft_i2c_config
|
||||
{
|
||||
rt_uint8_t scl;
|
||||
rt_uint8_t sda;
|
||||
const char *bus_name;
|
||||
};
|
||||
/* ifx i2c dirver class */
|
||||
struct ifx_i2c
|
||||
{
|
||||
struct rt_i2c_bit_ops ops;
|
||||
struct rt_i2c_bus_device i2c_bus;
|
||||
};
|
||||
|
||||
#ifdef BSP_USING_I2C1
|
||||
#define I2C1_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C1_SCL_PIN, \
|
||||
.sda = BSP_I2C1_SDA_PIN, \
|
||||
.bus_name = "i2c1", \
|
||||
}
|
||||
#endif
|
||||
|
||||
int rt_hw_i2c_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -173,29 +173,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 105
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
@@ -250,4 +247,16 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -173,29 +173,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 105
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
@@ -250,4 +247,16 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -181,29 +181,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 105
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
@@ -258,4 +255,16 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -180,29 +180,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 105
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_USBD
|
||||
bool "Enable USB Device"
|
||||
@@ -325,4 +322,16 @@ menu "Board extended module Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -9,3 +9,13 @@ utest.pin:
|
||||
- CONFIG_RT_USING_UTESTCASES=y
|
||||
- CONFIG_RT_CONSOLEBUF_SIZE=256
|
||||
- CONFIG_RT_UTEST_PIN=y
|
||||
|
||||
# ------ devices CI ------
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
|
||||
@@ -173,29 +173,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 105
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
@@ -250,4 +247,16 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -180,29 +180,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 105
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_USBD
|
||||
bool "Enable USB Device"
|
||||
@@ -325,4 +322,16 @@ menu "Board extended module Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=105
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=106
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -229,29 +229,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default 65
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable Software I2C Bus"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 Bus (User I2C)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: P13_1 --> 105; P13_2 --> 106"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 1 113
|
||||
default 105
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 1 113
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 105
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 106
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
@@ -487,4 +484,16 @@ menu "Board extended module Drivers"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 105 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 106 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C0=y
|
||||
- CONFIG_RT_SOFT_I2C0_SCL_PIN=54
|
||||
- CONFIG_RT_SOFT_I2C0_SDA_PIN=55
|
||||
- CONFIG_RT_SOFT_I2C0_BUS_NAME="swi2c0"
|
||||
@@ -105,28 +105,26 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
endmenu
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable Soft I2C"
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_I2C0
|
||||
bool "Enable I2C1 BUS (software simulation)"
|
||||
default n
|
||||
if BSP_USING_I2C0
|
||||
config BSP_I2C0_SCL_PIN
|
||||
int "i2c0 scl pin number (PD, 6)"
|
||||
range 0 63
|
||||
default 54
|
||||
config BSP_I2C0_SDA_PIN
|
||||
int "I2C0 sda pin number (PD, 7)"
|
||||
range 0 63
|
||||
default 55
|
||||
endif
|
||||
endif
|
||||
menuconfig BSP_USING_SOFT_I2C0
|
||||
bool "Enable software I2C0 Bus (swi2c0)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C0
|
||||
if BSP_USING_SOFT_I2C0
|
||||
config RT_SOFT_I2C0_SCL_PIN
|
||||
int "swi2c0 SCL pin number"
|
||||
default 54
|
||||
config RT_SOFT_I2C0_SDA_PIN
|
||||
int "swi2c0 SDA pin number"
|
||||
default 55
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menu "Hardware CAN"
|
||||
config BSP_USING_CAN1
|
||||
@@ -256,5 +254,16 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
config RT_SOFT_I2C0_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C0
|
||||
|
||||
config RT_SOFT_I2C0_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 54 if RT_USING_SOFT_I2C0
|
||||
|
||||
config RT_SOFT_I2C0_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 55 if RT_USING_SOFT_I2C0
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2024, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-09-13 AisinoChip first implementation.
|
||||
* 2024-04-23 LZero Modify the I2C framework.
|
||||
*/
|
||||
|
||||
#ifdef BSP_USING_SOFT_I2C
|
||||
|
||||
#include "drv_soft_i2c.h"
|
||||
|
||||
#define DBG_TAG "drv.i2c"
|
||||
#ifdef DRV_DEBUG
|
||||
#define DBG_LVL DBG_LOG
|
||||
#else
|
||||
#define DBG_LVL DBG_INFO
|
||||
#endif /* DRV_DEBUG */
|
||||
|
||||
static struct acm32_soft_i2c_config soft_i2c_config[] =
|
||||
{
|
||||
#ifdef BSP_USING_I2C0
|
||||
I2C0_BUS_CONFIG,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct acm32_i2c i2c_obj[sizeof(soft_i2c_config) / sizeof(soft_i2c_config[0])];
|
||||
|
||||
static void drv_i2c_gpio_init(struct acm32_i2c* i2c)
|
||||
{
|
||||
struct acm32_soft_i2c_config* cfg = (struct acm32_soft_i2c_config*)i2c->ops.data;
|
||||
|
||||
rt_pin_mode(cfg->scl, PIN_MODE_OUTPUT_OD);
|
||||
rt_pin_mode(cfg->sda, PIN_MODE_OUTPUT_OD);
|
||||
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
rt_pin_write(cfg->sda, PIN_HIGH);
|
||||
}
|
||||
|
||||
static void acm32_i2c_pin_init(void)
|
||||
{
|
||||
rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct acm32_i2c);
|
||||
|
||||
for(rt_size_t i = 0; i < obj_num; i++)
|
||||
{
|
||||
drv_i2c_gpio_init(&i2c_obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void _set_sda(void *data, rt_int32_t state)
|
||||
{
|
||||
struct acm32_soft_i2c_config* cfg = (struct acm32_soft_i2c_config*)data;
|
||||
|
||||
if (state)
|
||||
{
|
||||
rt_pin_write(cfg->sda, PIN_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_pin_write(cfg->sda, PIN_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
static void _set_scl(void *data, rt_int32_t state)
|
||||
{
|
||||
struct acm32_soft_i2c_config* cfg = (struct acm32_soft_i2c_config*)data;
|
||||
|
||||
if (state)
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_pin_write(cfg->scl, PIN_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
static rt_int32_t _get_sda(void *data)
|
||||
{
|
||||
struct acm32_soft_i2c_config* cfg = (struct acm32_soft_i2c_config*)data;
|
||||
|
||||
return rt_pin_read(cfg->sda);
|
||||
}
|
||||
|
||||
static rt_int32_t _get_scl(void *data)
|
||||
{
|
||||
struct acm32_soft_i2c_config* cfg = (struct acm32_soft_i2c_config*)data;
|
||||
|
||||
return rt_pin_read(cfg->scl);
|
||||
}
|
||||
|
||||
static void acm32_udelay(rt_uint32_t us)
|
||||
{
|
||||
rt_uint32_t ticks;
|
||||
rt_uint32_t told, tnow, tcnt = 0;
|
||||
rt_uint32_t reload = SysTick->LOAD;
|
||||
|
||||
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||
told = SysTick->VAL;
|
||||
while (1)
|
||||
{
|
||||
tnow = SysTick->VAL;
|
||||
if (tnow != told)
|
||||
{
|
||||
if (tnow < told)
|
||||
{
|
||||
tcnt += told - tnow;
|
||||
}
|
||||
else
|
||||
{
|
||||
tcnt += reload - tnow + told;
|
||||
}
|
||||
told = tnow;
|
||||
if (tcnt >= ticks)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bit_ops acm32_bit_ops_default =
|
||||
{
|
||||
.data = RT_NULL,
|
||||
.pin_init = acm32_i2c_pin_init,
|
||||
.set_sda = _set_sda,
|
||||
.set_scl = _set_scl,
|
||||
.get_sda = _get_sda,
|
||||
.get_scl = _get_scl,
|
||||
.udelay = acm32_udelay,
|
||||
.delay_us = 1,
|
||||
.timeout = 100,
|
||||
.i2c_pin_init_flag = RT_FALSE
|
||||
};
|
||||
|
||||
int rt_soft_i2c_init(void)
|
||||
{
|
||||
rt_err_t result;
|
||||
|
||||
for (rt_size_t i = 0; i < sizeof(i2c_obj) / sizeof(struct acm32_i2c); i++)
|
||||
{
|
||||
i2c_obj[i].ops = acm32_bit_ops_default;
|
||||
i2c_obj[i].ops.data = (void*)&soft_i2c_config[i];
|
||||
i2c_obj[i].i2c_bus.priv = &i2c_obj[i].ops;
|
||||
|
||||
result = rt_i2c_bit_add_bus(&i2c_obj[i].i2c_bus, soft_i2c_config[i].bus_name);
|
||||
RT_ASSERT(result == RT_EOK);
|
||||
|
||||
LOG_D("software simulation %s init done, pin scl: %d, pin sda: %d",
|
||||
soft_i2c_config[i].bus_name,
|
||||
soft_i2c_config[i].scl,
|
||||
soft_i2c_config[i].sda);
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_soft_i2c_init);
|
||||
|
||||
#endif /* RT_USING_I2C_BITOPS */
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2024, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2024-04-23 LZero Modify the I2C framework.
|
||||
*/
|
||||
|
||||
#ifndef __DRV_I2C__
|
||||
#define __DRV_I2C__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <board.h>
|
||||
#include <rtdbg.h>
|
||||
#include <rtdevice.h>
|
||||
#include <drivers/dev_pin.h>
|
||||
|
||||
/* acm32 config class */
|
||||
struct acm32_soft_i2c_config
|
||||
{
|
||||
rt_uint8_t scl;
|
||||
rt_uint8_t sda;
|
||||
const char *bus_name;
|
||||
};
|
||||
/* acm32 i2c dirver class */
|
||||
|
||||
struct acm32_i2c
|
||||
{
|
||||
struct rt_i2c_bit_ops ops;
|
||||
struct rt_i2c_bus_device i2c_bus;
|
||||
};
|
||||
|
||||
#ifdef BSP_USING_I2C0
|
||||
#define I2C0_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C0_SCL_PIN, \
|
||||
.sda = BSP_I2C0_SDA_PIN, \
|
||||
.bus_name = "i2c0", \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //__DRV_I2C__
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=24
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=25
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -48,28 +48,26 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Enable UART3"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFTI2C
|
||||
bool "Enable SOFT I2C"
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
if BSP_USING_SOFTI2C
|
||||
menuconfig BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS (software simulation)"
|
||||
default n
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 24
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 25
|
||||
endif
|
||||
endif
|
||||
select RT_USING_I2C
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 24
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 25
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI BUS"
|
||||
@@ -131,4 +129,16 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 24 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 25 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -45,9 +45,6 @@ if GetDepend(['RT_USING_SERIAL']):
|
||||
else:
|
||||
src += ['rt_drivers/drv_usart.c']
|
||||
|
||||
if GetDepend(['RT_USING_I2C','RT_USING_I2C_BITOPS']):
|
||||
src += ['rt_drivers/drv_soft_i2c.c']
|
||||
|
||||
if GetDepend(['RT_USING_SPI', 'BSP_USING_SPI']):
|
||||
src += ['rt_drivers/drv_spi.c']
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-02-22 airm2m first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_I2C__
|
||||
#define __DRV_I2C__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
/* air32 config class */
|
||||
struct air32_soft_i2c_config
|
||||
{
|
||||
rt_uint8_t scl;
|
||||
rt_uint8_t sda;
|
||||
const char *bus_name;
|
||||
};
|
||||
/* air32 i2c dirver class */
|
||||
struct air32_i2c
|
||||
{
|
||||
struct rt_i2c_bit_ops ops;
|
||||
struct rt_i2c_bus_device i2c_bus;
|
||||
};
|
||||
|
||||
#ifdef BSP_USING_I2C1
|
||||
#define I2C1_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C1_SCL_PIN, \
|
||||
.sda = BSP_I2C1_SDA_PIN, \
|
||||
.bus_name = "i2c1", \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_I2C2
|
||||
#define I2C2_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C2_SCL_PIN, \
|
||||
.sda = BSP_I2C2_SDA_PIN, \
|
||||
.bus_name = "i2c2", \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_I2C3
|
||||
#define I2C3_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C3_SCL_PIN, \
|
||||
.sda = BSP_I2C3_SDA_PIN, \
|
||||
.bus_name = "i2c3", \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_I2C4
|
||||
#define I2C4_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C4_SCL_PIN, \
|
||||
.sda = BSP_I2C4_SDA_PIN, \
|
||||
.bus_name = "i2c4", \
|
||||
}
|
||||
#endif
|
||||
int rt_sw_i2c_init(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -24,9 +24,10 @@ menu "Onboard Peripheral Drivers"
|
||||
default n
|
||||
|
||||
config BSP_USING_EEPROM
|
||||
bool "Enable I2C EEPROM (i2c1)"
|
||||
select BSP_USING_I2C
|
||||
select BSP_USING_I2C1
|
||||
bool "Enable I2C EEPROM (swi2c1)"
|
||||
select RT_USING_I2C
|
||||
select BSP_USING_SOFT_I2C
|
||||
select BSP_USING_SOFT_I2C1
|
||||
default n
|
||||
|
||||
config BSP_USING_SDCARD
|
||||
@@ -41,6 +42,18 @@ menu "Onboard Peripheral Drivers"
|
||||
select BSP_USING_DMC
|
||||
default n
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
@@ -105,54 +118,52 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
comment "Notice: PB0 --> 16; PB1 --> 17"
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -271,4 +282,28 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -86,54 +86,52 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
comment "Notice: PB0 --> 16; PB1 --> 17"
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -248,4 +246,40 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -67,41 +67,39 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB10 --> 26; PB11 --> 27"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -193,4 +191,28 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -16,11 +16,24 @@ menu "Onboard Peripheral Drivers"
|
||||
default y
|
||||
|
||||
config BSP_USING_EEPROM
|
||||
bool "Enable I2C EEPROM (i2c1 software simulation)"
|
||||
select BSP_USING_I2C
|
||||
select BSP_USING_I2C1
|
||||
bool "Enable I2C EEPROM (swi2c1)"
|
||||
select RT_USING_I2C
|
||||
select BSP_USING_SOFT_I2C
|
||||
select BSP_USING_SOFT_I2C1
|
||||
default n
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
@@ -79,41 +92,39 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB10 --> 26; PB11 --> 27"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -205,4 +216,16 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -67,54 +67,52 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB10 --> 26; PB11 --> 27"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
comment "Notice: PB0 --> 16; PB1 --> 17"
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -214,4 +212,40 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -67,54 +67,52 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB10 --> 26; PB11 --> 27"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
comment "Notice: PB0 --> 16; PB1 --> 17"
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -214,4 +212,40 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=0
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=1
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -69,41 +69,39 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 0
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 1
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 0
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 1
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -205,4 +203,28 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 0 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 1 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -80,23 +80,26 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -211,4 +214,16 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=0
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=1
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -24,9 +24,10 @@ menu "Onboard Peripheral Drivers"
|
||||
default n
|
||||
|
||||
config BSP_USING_EEPROM
|
||||
bool "Enable I2C EEPROM (i2c1 software simulation)"
|
||||
select BSP_USING_I2C
|
||||
select BSP_USING_I2C1
|
||||
bool "Enable I2C EEPROM (swi2c1)"
|
||||
select RT_USING_I2C
|
||||
select BSP_USING_SOFT_I2C
|
||||
select BSP_USING_SOFT_I2C1
|
||||
default n
|
||||
|
||||
config BSP_USING_ETH
|
||||
@@ -41,6 +42,18 @@ menu "Onboard Peripheral Drivers"
|
||||
depends on BSP_USING_ETH
|
||||
default y
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
@@ -99,41 +112,39 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 0
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 1
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 0
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 1
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -242,4 +253,16 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 0 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 1 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
@@ -69,23 +69,26 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -214,4 +217,16 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=0
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=1
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -111,41 +111,39 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 0
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 1
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 0
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 1
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -292,4 +290,28 @@ menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 0 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 1 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -74,54 +74,52 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "RTC USING LSI"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
comment "Notice: PA0 --> 0; PA1 --> 1"
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
comment "Notice: PB0 --> 16; PB1 --> 17"
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
@@ -210,4 +208,40 @@ menu "On-chip Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -26,10 +26,6 @@ if GetDepend(['RT_USING_DAC']):
|
||||
if GetDepend('BSP_USING_ONCHIP_RTC'):
|
||||
src += ['drv_rtc.c']
|
||||
|
||||
if GetDepend(['RT_USING_I2C']):
|
||||
if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3') or GetDepend('BSP_USING_I2C4'):
|
||||
src += ['drv_soft_i2c.c']
|
||||
|
||||
if GetDepend(['RT_USING_SPI']):
|
||||
src += ['drv_spi.c']
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -237,51 +237,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -381,4 +382,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -261,39 +261,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI3_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -380,4 +380,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -260,51 +260,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -378,4 +379,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -237,51 +237,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -381,4 +382,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -279,51 +279,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -397,4 +398,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -260,51 +260,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -404,4 +405,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -237,39 +237,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -344,4 +344,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -252,39 +252,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -353,4 +353,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -181,39 +181,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -262,4 +262,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -261,39 +261,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI3_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -380,4 +380,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -261,39 +261,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI3_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -352,4 +352,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -286,51 +286,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -430,4 +431,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -309,51 +309,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -453,4 +454,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -272,51 +272,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -419,4 +420,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -272,51 +272,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -419,4 +420,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
- CONFIG_RT_USING_SOFT_I2C3=y
|
||||
- CONFIG_RT_SOFT_I2C3_SCL_PIN=8
|
||||
- CONFIG_RT_SOFT_I2C3_SDA_PIN=41
|
||||
- CONFIG_RT_SOFT_I2C3_BUS_NAME="swi2c3"
|
||||
@@ -272,51 +272,52 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
config BSP_USING_I2C3
|
||||
bool "Enable I2C3 BUS"
|
||||
if BSP_USING_I2C3
|
||||
config BSP_I2C3_SCL_PIN
|
||||
int "i2c3 scl pin number"
|
||||
range 0 63
|
||||
default 8
|
||||
config BSP_I2C3_SDA_PIN
|
||||
int "I2C3 sda pin number"
|
||||
range 0 63
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C3
|
||||
bool "Enable software I2C3 Bus (swi2c3)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C3
|
||||
if BSP_USING_SOFT_I2C3
|
||||
config RT_SOFT_I2C3_SCL_PIN
|
||||
int "swi2c3 SCL pin number"
|
||||
default 8
|
||||
config RT_SOFT_I2C3_SDA_PIN
|
||||
int "swi2c3 SDA pin number"
|
||||
default 41
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -419,4 +420,40 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C3_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 8 if RT_USING_SOFT_I2C3
|
||||
|
||||
config RT_SOFT_I2C3_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 41 if RT_USING_SOFT_I2C3
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -181,39 +181,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -282,4 +282,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
devices.soft_i2c:
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C=y
|
||||
- CONFIG_RT_USING_SOFT_I2C1=y
|
||||
- CONFIG_RT_SOFT_I2C1_SCL_PIN=22
|
||||
- CONFIG_RT_SOFT_I2C1_SDA_PIN=23
|
||||
- CONFIG_RT_SOFT_I2C1_BUS_NAME="swi2c1"
|
||||
- CONFIG_RT_USING_SOFT_I2C2=y
|
||||
- CONFIG_RT_SOFT_I2C2_SCL_PIN=26
|
||||
- CONFIG_RT_SOFT_I2C2_SDA_PIN=27
|
||||
- CONFIG_RT_SOFT_I2C2_BUS_NAME="swi2c2"
|
||||
@@ -181,39 +181,39 @@ menu "On-chip Peripheral Drivers"
|
||||
select BSP_SPI2_TX_USING_DMA
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_I2C
|
||||
bool "Enable I2C BUS (software simulation)"
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable software I2C (swi2c)"
|
||||
default n
|
||||
select RT_USING_I2C
|
||||
select RT_USING_I2C_BITOPS
|
||||
select RT_USING_PIN
|
||||
if BSP_USING_I2C
|
||||
config BSP_USING_I2C1
|
||||
bool "Enable I2C1 BUS"
|
||||
if BSP_USING_I2C1
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 scl pin number"
|
||||
range 0 63
|
||||
default 22
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "I2C1 sda pin number"
|
||||
range 0 63
|
||||
default 23
|
||||
endif
|
||||
config BSP_USING_I2C2
|
||||
bool "Enable I2C2 BUS"
|
||||
if BSP_USING_I2C2
|
||||
config BSP_I2C2_SCL_PIN
|
||||
int "i2c2 scl pin number"
|
||||
range 0 63
|
||||
default 26
|
||||
config BSP_I2C2_SDA_PIN
|
||||
int "I2C2 sda pin number"
|
||||
range 0 63
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
select RT_USING_SOFT_I2C
|
||||
if BSP_USING_SOFT_I2C
|
||||
menuconfig BSP_USING_SOFT_I2C1
|
||||
bool "Enable software I2C1 Bus (swi2c1)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C1
|
||||
if BSP_USING_SOFT_I2C1
|
||||
config RT_SOFT_I2C1_SCL_PIN
|
||||
int "swi2c1 SCL pin number"
|
||||
default 22
|
||||
config RT_SOFT_I2C1_SDA_PIN
|
||||
int "swi2c1 SDA pin number"
|
||||
default 23
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C2
|
||||
bool "Enable software I2C2 Bus (swi2c2)"
|
||||
default n
|
||||
select RT_USING_SOFT_I2C2
|
||||
if BSP_USING_SOFT_I2C2
|
||||
config RT_SOFT_I2C2_SCL_PIN
|
||||
int "swi2c2 SCL pin number"
|
||||
default 26
|
||||
config RT_SOFT_I2C2_SDA_PIN
|
||||
int "swi2c2 SDA pin number"
|
||||
default 27
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_HARD_I2C
|
||||
bool "Enable I2C BUS (hardware driver)"
|
||||
@@ -282,4 +282,28 @@ menu "On-chip Peripheral Drivers"
|
||||
endif
|
||||
endmenu
|
||||
|
||||
config RT_SOFT_I2C1_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 22 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C1_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 23 if RT_USING_SOFT_I2C1
|
||||
|
||||
config RT_SOFT_I2C2_HAS_PIN_DEFAULT
|
||||
bool
|
||||
default y if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SCL_PIN_DEFAULT
|
||||
int
|
||||
default 26 if RT_USING_SOFT_I2C2
|
||||
|
||||
config RT_SOFT_I2C2_SDA_PIN_DEFAULT
|
||||
int
|
||||
default 27 if RT_USING_SOFT_I2C2
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -40,10 +40,6 @@ if GetDepend('BSP_USING_SDRAM'):
|
||||
if GetDepend(['BSP_USING_EMAC', 'RT_USING_LWIP']):
|
||||
src += ['drv_emac.c']
|
||||
|
||||
if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):
|
||||
if GetDepend('BSP_USING_I2C1') or GetDepend('BSP_USING_I2C2') or GetDepend('BSP_USING_I2C3') or GetDepend('BSP_USING_I2C4'):
|
||||
src += ['drv_soft_i2c.c']
|
||||
|
||||
if GetDepend(['BSP_USING_HARD_I2C']):
|
||||
src += Glob('drv_hard_i2c.c')
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2020-01-09 shelton first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_I2C__
|
||||
#define __DRV_I2C__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
/* at32 config class */
|
||||
struct at32_soft_i2c_config
|
||||
{
|
||||
rt_uint8_t scl;
|
||||
rt_uint8_t sda;
|
||||
const char *bus_name;
|
||||
};
|
||||
/* at32 i2c dirver class */
|
||||
struct at32_i2c
|
||||
{
|
||||
struct rt_i2c_bit_ops ops;
|
||||
struct rt_i2c_bus_device i2c_bus;
|
||||
};
|
||||
|
||||
#ifdef BSP_USING_I2C1
|
||||
#define I2C1_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C1_SCL_PIN, \
|
||||
.sda = BSP_I2C1_SDA_PIN, \
|
||||
.bus_name = "i2c1", \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_I2C2
|
||||
#define I2C2_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C2_SCL_PIN, \
|
||||
.sda = BSP_I2C2_SDA_PIN, \
|
||||
.bus_name = "i2c2", \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BSP_USING_I2C3
|
||||
#define I2C3_BUS_CONFIG \
|
||||
{ \
|
||||
.scl = BSP_I2C3_SCL_PIN, \
|
||||
.sda = BSP_I2C3_SDA_PIN, \
|
||||
.bus_name = "i2c3", \
|
||||
}
|
||||
#endif
|
||||
|
||||
int rt_hw_i2c_init(void);
|
||||
|
||||
#endif
|
||||
@@ -20,9 +20,6 @@ if GetDepend('RT_USING_SDIO'):
|
||||
if GetDepend('RT_USING_LWIP'):
|
||||
src += ['macb.c']
|
||||
|
||||
if GetDepend('RT_USING_I2C') and GetDepend('RT_USING_I2C_BITOPS'):
|
||||
src += ['at91_i2c_gpio.c']
|
||||
|
||||
if GetDepend('RT_USING_MTD_NAND'):
|
||||
src += ['at91_nand.c']
|
||||
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2012-04-25 weety first version
|
||||
*/
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <at91sam926x.h>
|
||||
|
||||
|
||||
static void at91_i2c_gpio_init(void)
|
||||
{
|
||||
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOA); //enable PIOA clock
|
||||
at91_sys_write(AT91_PIOA + PIO_PUER, (1 << 23));
|
||||
at91_sys_write(AT91_PIOA + PIO_PER, (1 << 23));
|
||||
at91_sys_write(AT91_PIOA + PIO_MDER, (1 << 23));
|
||||
at91_sys_write(AT91_PIOA + PIO_PUER, (1 << 24));
|
||||
at91_sys_write(AT91_PIOA + PIO_PER, (1 << 24));
|
||||
at91_sys_write(AT91_PIOA + PIO_MDER, (1 << 24));
|
||||
|
||||
at91_sys_write(AT91_PIOA + PIO_OER, (1 << 23));
|
||||
at91_sys_write(AT91_PIOA + PIO_OER, (1 << 24));
|
||||
|
||||
at91_sys_write(AT91_PIOA + PIO_SODR, (1 << 23));
|
||||
at91_sys_write(AT91_PIOA + PIO_SODR, (1 << 24));
|
||||
}
|
||||
|
||||
static void at91_set_sda(void *data, rt_int32_t state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
at91_sys_write(AT91_PIOA + PIO_SODR, (1 << 23));
|
||||
}
|
||||
else
|
||||
{
|
||||
at91_sys_write(AT91_PIOA + PIO_CODR, (1 << 23));
|
||||
}
|
||||
}
|
||||
|
||||
static void at91_set_scl(void *data, rt_int32_t state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
at91_sys_write(AT91_PIOA + PIO_SODR, (1 << 24));
|
||||
}
|
||||
else
|
||||
{
|
||||
at91_sys_write(AT91_PIOA + PIO_CODR, (1 << 24));
|
||||
}
|
||||
}
|
||||
|
||||
static rt_int32_t at91_get_sda(void *data)
|
||||
{
|
||||
return at91_sys_read(AT91_PIOA + PIO_PDSR) & (1 << 23);
|
||||
}
|
||||
|
||||
static rt_int32_t at91_get_scl(void *data)
|
||||
{
|
||||
return at91_sys_read(AT91_PIOA + PIO_PDSR) & (1 << 24);
|
||||
}
|
||||
|
||||
static void at91_udelay (rt_uint32_t us)
|
||||
{
|
||||
rt_int32_t i;
|
||||
for (; us > 0; us--)
|
||||
{
|
||||
i = 50000;
|
||||
while(i > 0)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bit_ops bit_ops = {
|
||||
RT_NULL,
|
||||
at91_set_sda,
|
||||
at91_set_scl,
|
||||
at91_get_sda,
|
||||
at91_get_scl,
|
||||
at91_udelay,
|
||||
5,
|
||||
100,
|
||||
at91_i2c_gpio_init,
|
||||
RT_FALSE
|
||||
};
|
||||
|
||||
int at91_i2c_init(void)
|
||||
{
|
||||
struct rt_i2c_bus_device *bus;
|
||||
|
||||
bus = rt_malloc(sizeof(struct rt_i2c_bus_device));
|
||||
if (bus == RT_NULL)
|
||||
{
|
||||
rt_kprintf("rt_malloc failed\n");
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
rt_memset((void *)bus, 0, sizeof(struct rt_i2c_bus_device));
|
||||
|
||||
bus->priv = (void *)&bit_ops;
|
||||
|
||||
rt_i2c_bit_add_bus(bus, "i2c0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INIT_DEVICE_EXPORT(at91_i2c_init);
|
||||
|
||||
@@ -20,10 +20,6 @@ if GetDepend('RT_USING_SDIO'):
|
||||
if GetDepend('RT_USING_LWIP'):
|
||||
src += ['macb.c']
|
||||
|
||||
if GetDepend('RT_USING_I2C') and GetDepend('RT_USING_I2C_BITOPS'):
|
||||
src += ['at91_i2c_gpio.c']
|
||||
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2012-04-25 weety first version
|
||||
*/
|
||||
|
||||
#include <rtdevice.h>
|
||||
#include <rthw.h>
|
||||
#include <at91sam9g45.h>
|
||||
|
||||
|
||||
static void at91_i2c_gpio_init(void)
|
||||
{
|
||||
AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOA; //enable PIOA clock
|
||||
AT91C_BASE_PIOA->PIO_PUER = (1 << 23);
|
||||
AT91C_BASE_PIOA->PIO_PER = (1 << 23);
|
||||
AT91C_BASE_PIOA->PIO_MDER = (1 << 23);
|
||||
AT91C_BASE_PIOA->PIO_PUER = (1 << 24);
|
||||
AT91C_BASE_PIOA->PIO_PER = (1 << 24);
|
||||
AT91C_BASE_PIOA->PIO_MDER = (1 << 24);
|
||||
|
||||
AT91C_BASE_PIOA->PIO_OER = (1 << 23);
|
||||
AT91C_BASE_PIOA->PIO_OER = (1 << 24);
|
||||
|
||||
AT91C_BASE_PIOA->PIO_SODR = (1 << 23);
|
||||
AT91C_BASE_PIOA->PIO_SODR = (1 << 24);
|
||||
}
|
||||
|
||||
static void at91_set_sda(void *data, rt_int32_t state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
AT91C_BASE_PIOA->PIO_SODR = (1 << 23);
|
||||
}
|
||||
else
|
||||
{
|
||||
AT91C_BASE_PIOA->PIO_CODR = (1 << 23);
|
||||
}
|
||||
}
|
||||
|
||||
static void at91_set_scl(void *data, rt_int32_t state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
AT91C_BASE_PIOA->PIO_SODR = (1 << 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
AT91C_BASE_PIOA->PIO_CODR = (1 << 24);
|
||||
}
|
||||
}
|
||||
|
||||
static rt_int32_t at91_get_sda(void *data)
|
||||
{
|
||||
return AT91C_BASE_PIOA->PIO_PDSR & (1 << 23);
|
||||
}
|
||||
|
||||
static rt_int32_t at91_get_scl(void *data)
|
||||
{
|
||||
return AT91C_BASE_PIOA->PIO_PDSR & (1 << 24);
|
||||
}
|
||||
|
||||
static void at91_udelay (rt_uint32_t us)
|
||||
{
|
||||
rt_int32_t i;
|
||||
for (; us > 0; us--)
|
||||
{
|
||||
i = 50000;
|
||||
while(i > 0)
|
||||
{
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const struct rt_i2c_bit_ops bit_ops = {
|
||||
RT_NULL,
|
||||
at91_set_sda,
|
||||
at91_set_scl,
|
||||
at91_get_sda,
|
||||
at91_get_scl,
|
||||
at91_udelay,
|
||||
5,
|
||||
100,
|
||||
at91_i2c_gpio_init,
|
||||
RT_FALSE
|
||||
};
|
||||
|
||||
int at91_i2c_init(void)
|
||||
{
|
||||
struct rt_i2c_bus_device *bus;
|
||||
|
||||
bus = rt_malloc(sizeof(struct rt_i2c_bus_device));
|
||||
if (bus == RT_NULL)
|
||||
{
|
||||
rt_kprintf("rt_malloc failed\n");
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
rt_memset((void *)bus, 0, sizeof(struct rt_i2c_bus_device));
|
||||
|
||||
bus->priv = (void *)&bit_ops;
|
||||
|
||||
rt_i2c_bit_add_bus(bus, "i2c0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INIT_DEVICE_EXPORT(at91_i2c_init);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user