mirror of https://github.com/RT-Thread/rt-thread
parent
8027291e09
commit
2ece5c277d
|
@ -47,6 +47,9 @@ if GetDepend(['RT_USING_WDT']):
|
||||||
src += ['n32g45x_std_periph_driver/src/n32g45x_wwdg.c']
|
src += ['n32g45x_std_periph_driver/src/n32g45x_wwdg.c']
|
||||||
src += ['n32g45x_std_periph_driver/src/n32g45x_iwdg.c']
|
src += ['n32g45x_std_periph_driver/src/n32g45x_iwdg.c']
|
||||||
|
|
||||||
|
if GetDepend(['BSP_USING_RTC']):
|
||||||
|
src += ['n32g45x_std_periph_driver/src/n32g45x_bkp.c']
|
||||||
|
|
||||||
if GetDepend(['RT_USING_SDIO']):
|
if GetDepend(['RT_USING_SDIO']):
|
||||||
src += ['n32g45x_std_periph_driver/src/n32g45x_sdio.c']
|
src += ['n32g45x_std_periph_driver/src/n32g45x_sdio.c']
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ if GetDepend(['RT_USING_DAC']):
|
||||||
if GetDepend(['RT_USING_CAN']):
|
if GetDepend(['RT_USING_CAN']):
|
||||||
src += ['drv_can.c']
|
src += ['drv_can.c']
|
||||||
|
|
||||||
|
if GetDepend(['BSP_USING_RTC']):
|
||||||
|
src += ['drv_rtc.c']
|
||||||
|
|
||||||
if GetDepend(['BSP_USING_WDT']):
|
if GetDepend(['BSP_USING_WDT']):
|
||||||
src += ['drv_wdt.c']
|
src += ['drv_wdt.c']
|
||||||
|
|
|
@ -50,97 +50,193 @@
|
||||||
#endif
|
#endif
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
|
||||||
#define I2CT_FLAG_TIMEOUT ((uint32_t)0x1000)
|
|
||||||
#define I2CT_LONG_TIMEOUT ((uint32_t)(10 * I2CT_FLAG_TIMEOUT))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef RT_USING_I2C_BITOPS
|
#ifdef RT_USING_I2C_BITOPS
|
||||||
|
static const struct n32_soft_i2c_config soft_i2c_config[] =
|
||||||
/*user can change this*/
|
|
||||||
#define I2C_BUS_NAME "i2c1"
|
|
||||||
|
|
||||||
/*user should change this to adapt specific board*/
|
|
||||||
#define I2C_SCL_PIN GPIO_PIN_8
|
|
||||||
#define I2C_SCL_PORT GPIOB
|
|
||||||
#define I2C_SCL_CLK RCC_APB2_PERIPH_GPIOB
|
|
||||||
#define I2C_SDA_PIN GPIO_PIN_9
|
|
||||||
#define I2C_SDA_PORT GPIOB
|
|
||||||
#define I2C_SDA_CLK RCC_APB2_PERIPH_GPIOB
|
|
||||||
|
|
||||||
struct n32_i2c_bit_data
|
|
||||||
{
|
{
|
||||||
struct
|
#ifdef BSP_USING_I2C1
|
||||||
{
|
I2C1_BUS_CONFIG,
|
||||||
rt_uint32_t clk;
|
#endif
|
||||||
GPIO_Module* port;
|
|
||||||
rt_uint32_t pin;
|
#ifdef BSP_USING_I2C2
|
||||||
}scl, sda;
|
I2C2_BUS_CONFIG,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BSP_USING_I2C3
|
||||||
|
I2C3_BUS_CONFIG,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BSP_USING_I2C4
|
||||||
|
I2C4_BUS_CONFIG,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gpio_set_sda(void *data, rt_int32_t state)
|
static struct n32_i2c i2c_obj[sizeof(soft_i2c_config) / sizeof(soft_i2c_config[0])];
|
||||||
{
|
|
||||||
struct n32_i2c_bit_data* bd = data;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*\*\name n32_i2c_gpio_init
|
||||||
|
*\*\fun Initializes the i2c pin.
|
||||||
|
*\*\param i2c dirver class
|
||||||
|
*\*\return none
|
||||||
|
**/
|
||||||
|
static void n32_i2c_gpio_init(struct n32_i2c *i2c)
|
||||||
|
{
|
||||||
|
struct n32_soft_i2c_config* cfg = (struct n32_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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*\*\name n32_set_sda
|
||||||
|
*\*\fun sets the sda pin.
|
||||||
|
*\*\param data config class
|
||||||
|
*\*\param state sda pin state
|
||||||
|
*\*\return none
|
||||||
|
**/
|
||||||
|
static void n32_set_sda(void *data, rt_int32_t state)
|
||||||
|
{
|
||||||
|
struct n32_soft_i2c_config* cfg = (struct n32_soft_i2c_config*)data;
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
GPIO_SetBits((GPIO_Module*)bd->sda.port, bd->sda.pin);
|
rt_pin_write(cfg->sda, PIN_HIGH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GPIO_ResetBits((GPIO_Module*)bd->sda.port, bd->sda.pin);
|
rt_pin_write(cfg->sda, PIN_LOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gpio_set_scl(void *data, rt_int32_t state)
|
/**
|
||||||
|
*\*\name n32_set_scl
|
||||||
|
*\*\fun sets the scl pin.
|
||||||
|
*\*\param data config class
|
||||||
|
*\*\param state scl pin state
|
||||||
|
*\*\return none
|
||||||
|
**/
|
||||||
|
static void n32_set_scl(void *data, rt_int32_t state)
|
||||||
{
|
{
|
||||||
struct n32_i2c_bit_data* bd = data;
|
struct n32_soft_i2c_config* cfg = (struct n32_soft_i2c_config*)data;
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
GPIO_SetBits((GPIO_Module*)bd->scl.port, bd->scl.pin);
|
rt_pin_write(cfg->scl, PIN_HIGH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GPIO_ResetBits((GPIO_Module*)bd->scl.port, bd->scl.pin);
|
rt_pin_write(cfg->scl, PIN_LOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_int32_t gpio_get_sda(void *data)
|
/**
|
||||||
|
*\*\name n32_get_sda
|
||||||
|
*\*\fun gets the sda pin state.
|
||||||
|
*\*\param data config class
|
||||||
|
*\*\return sda pin state
|
||||||
|
**/
|
||||||
|
static rt_int32_t n32_get_sda(void *data)
|
||||||
{
|
{
|
||||||
struct n32_i2c_bit_data* bd = data;
|
struct n32_soft_i2c_config* cfg = (struct n32_soft_i2c_config*)data;
|
||||||
|
return rt_pin_read(cfg->sda);
|
||||||
return GPIO_ReadInputDataBit((GPIO_Module*)bd->sda.port, bd->sda.pin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static rt_int32_t gpio_get_scl(void *data)
|
/**
|
||||||
|
*\*\name n32_get_scl
|
||||||
|
*\*\fun gets the scl pin state.
|
||||||
|
*\*\param data config class
|
||||||
|
*\*\return scl pin state
|
||||||
|
**/
|
||||||
|
static rt_int32_t n32_get_scl(void *data)
|
||||||
{
|
{
|
||||||
struct n32_i2c_bit_data* bd = data;
|
struct n32_soft_i2c_config* cfg = (struct n32_soft_i2c_config*)data;
|
||||||
|
return rt_pin_read(cfg->scl);
|
||||||
return GPIO_ReadInputDataBit((GPIO_Module*)bd->scl.port, bd->scl.pin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gpio_udelay(rt_uint32_t us)
|
|
||||||
|
/**
|
||||||
|
*\*\name n32_udelay
|
||||||
|
*\*\fun The time delay function.
|
||||||
|
*\*\param us
|
||||||
|
*\*\return none
|
||||||
|
**/
|
||||||
|
static void n32_udelay(rt_uint32_t us)
|
||||||
{
|
{
|
||||||
RCC_ClocksType* RCC_Clocks = {0};
|
rt_uint32_t ticks;
|
||||||
RCC_GetClocksFreqValue(RCC_Clocks);
|
rt_uint32_t told, tnow, tcnt = 0;
|
||||||
int i = ( RCC_Clocks->SysclkFreq / 4000000 * us);
|
rt_uint32_t reload = SysTick->LOAD;
|
||||||
while(i)
|
|
||||||
|
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||||
|
told = SysTick->VAL;
|
||||||
|
|
||||||
|
while(1)
|
||||||
{
|
{
|
||||||
i--;
|
tnow = SysTick->VAL;
|
||||||
}
|
if(tnow != told)
|
||||||
}
|
|
||||||
|
|
||||||
static void drv_i2c_gpio_init(const struct n32_i2c_bit_data* bd)
|
|
||||||
{
|
{
|
||||||
RCC_EnableAPB2PeriphClk(bd->sda.clk | bd->scl.clk, ENABLE);
|
if(tnow < told)
|
||||||
GPIOInit((GPIO_Module*)bd->sda.port, GPIO_Mode_Out_OD, GPIO_Speed_10MHz, bd->sda.pin);
|
{
|
||||||
GPIOInit((GPIO_Module*)bd->scl.port, GPIO_Mode_Out_OD, GPIO_Speed_10MHz, bd->scl.pin);
|
tcnt += told - tnow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tcnt += reload - tnow + told;
|
||||||
|
}
|
||||||
|
told = tnow;
|
||||||
|
|
||||||
GPIO_SetBits((GPIO_Module*)bd->sda.port, bd->sda.pin);
|
if(tcnt >= ticks)
|
||||||
GPIO_SetBits((GPIO_Module*)bd->scl.port, bd->scl.pin);
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* use hardware i2c */
|
static const struct rt_i2c_bit_ops n32_bit_ops_default =
|
||||||
|
{
|
||||||
|
.data = RT_NULL,
|
||||||
|
.set_sda = n32_set_sda,
|
||||||
|
.set_scl = n32_set_scl,
|
||||||
|
.get_sda = n32_get_sda,
|
||||||
|
.get_scl = n32_get_scl,
|
||||||
|
.udelay = n32_udelay,
|
||||||
|
.delay_us = 1,
|
||||||
|
.timeout = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*\*\name n32_i2c_bus_unlock
|
||||||
|
*\*\fun If i2c is locked, this function will unlock it.
|
||||||
|
*\*\param cfg
|
||||||
|
*\*\return RT_EOK indicates successful unlock
|
||||||
|
**/
|
||||||
|
static rt_err_t n32_i2c_bus_unlock(const struct n32_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);
|
||||||
|
n32_udelay(100);
|
||||||
|
rt_pin_write(cfg->scl, PIN_LOW);
|
||||||
|
n32_udelay(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(PIN_LOW == rt_pin_read(cfg->sda))
|
||||||
|
{
|
||||||
|
return -RT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RT_EOK;
|
||||||
|
}
|
||||||
|
#endif /* RT_USING_I2C_BITOPS */
|
||||||
|
|
||||||
|
#ifdef RT_USING_HARDWARE_I2C
|
||||||
|
|
||||||
static uint32_t I2CTimeout = I2CT_LONG_TIMEOUT;
|
static uint32_t I2CTimeout = I2CT_LONG_TIMEOUT;
|
||||||
|
|
||||||
|
@ -323,40 +419,35 @@ static const struct rt_i2c_bus_device_ops i2c_ops =
|
||||||
RT_NULL
|
RT_NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* RT_USING_I2C_BITOPS */
|
#endif /* RT_USING_HARDWARE_I2C */
|
||||||
|
|
||||||
int rt_hw_i2c_init(void)
|
int rt_hw_i2c_init(void)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_I2C_BITOPS
|
#ifdef RT_USING_I2C_BITOPS
|
||||||
{
|
|
||||||
static struct rt_i2c_bus_device i2c_device;
|
|
||||||
static const struct n32_i2c_bit_data _i2c_bdata =
|
|
||||||
{
|
|
||||||
/* SCL */
|
|
||||||
{ I2C_SCL_CLK, I2C_SCL_PORT, I2C_SCL_PIN},
|
|
||||||
/* SDA */
|
|
||||||
{ I2C_SDA_CLK, I2C_SDA_PORT, I2C_SDA_PIN},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct rt_i2c_bit_ops _i2c_bit_ops =
|
rt_size_t obj_num = sizeof(i2c_obj) / sizeof(struct n32_i2c);
|
||||||
|
rt_err_t result;
|
||||||
|
|
||||||
|
for(int i = 0; i < obj_num; i++)
|
||||||
{
|
{
|
||||||
(void*)&_i2c_bdata,
|
i2c_obj[i].ops = n32_bit_ops_default;
|
||||||
gpio_set_sda,
|
i2c_obj[i].ops.data = (void*)&soft_i2c_config[i];
|
||||||
gpio_set_scl,
|
i2c_obj[i].i2c2_bus.priv = &i2c_obj[i].ops;
|
||||||
gpio_get_sda,
|
|
||||||
gpio_get_scl,
|
|
||||||
gpio_udelay,
|
|
||||||
1,
|
|
||||||
100
|
|
||||||
};
|
|
||||||
|
|
||||||
drv_i2c_gpio_init(&_i2c_bdata);
|
n32_i2c_gpio_init(&i2c_obj[i]);
|
||||||
|
result = rt_i2c_bit_add_bus(&i2c_obj[i].i2c2_bus, soft_i2c_config[i].bus_name);
|
||||||
|
|
||||||
i2c_device.priv = (void *)&_i2c_bit_ops;
|
RT_ASSERT(result == RT_EOK);
|
||||||
rt_i2c_bit_add_bus(&i2c_device, I2C_BUS_NAME);
|
n32_i2c_bus_unlock(&soft_i2c_config[i]);
|
||||||
|
|
||||||
|
rt_kprintf("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);
|
||||||
}
|
}
|
||||||
|
#endif /* RT_USING_I2C_BITOPS */
|
||||||
|
|
||||||
#else /* register hardware I2C */
|
#ifdef RT_USING_HARDWARE_I2C
|
||||||
|
|
||||||
#ifdef BSP_USING_I2C1
|
#ifdef BSP_USING_I2C1
|
||||||
#define I2C1_SPEED 400000
|
#define I2C1_SPEED 400000
|
||||||
|
@ -475,9 +566,9 @@ int rt_hw_i2c_init(void)
|
||||||
rt_i2c_bus_device_register(&i2c_bus4.parent, "i2c4");
|
rt_i2c_bus_device_register(&i2c_bus4.parent, "i2c4");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* RT_USING_I2C_BITOPS */
|
#endif /* RT_USING_HARDWARE_I2C */
|
||||||
|
|
||||||
return 0;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
INIT_DEVICE_EXPORT(rt_hw_i2c_init);
|
INIT_DEVICE_EXPORT(rt_hw_i2c_init);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,60 @@
|
||||||
#ifndef __DRV_I2C__
|
#ifndef __DRV_I2C__
|
||||||
#define __DRV_I2C__
|
#define __DRV_I2C__
|
||||||
|
|
||||||
#include "i2c.h"
|
#include <rtthread.h>
|
||||||
|
#include <rthw.h>
|
||||||
|
#include <rtdevice.h>
|
||||||
|
|
||||||
|
/* n32 config class */
|
||||||
|
struct n32_soft_i2c_config
|
||||||
|
{
|
||||||
|
rt_uint8_t scl;
|
||||||
|
rt_uint8_t sda;
|
||||||
|
const char *bus_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* n32 i2c dirver class */
|
||||||
|
struct n32_i2c
|
||||||
|
{
|
||||||
|
struct rt_i2c_bit_ops ops;
|
||||||
|
struct rt_i2c_bus_device i2c2_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
|
||||||
|
|
||||||
struct rt_i2c_bus
|
struct rt_i2c_bus
|
||||||
{
|
{
|
||||||
|
@ -46,4 +99,4 @@ struct rt_i2c_bus
|
||||||
|
|
||||||
int rt_hw_i2c_init(void);
|
int rt_hw_i2c_init(void);
|
||||||
|
|
||||||
#endif
|
#endif /* __DRV_I2C__ */
|
||||||
|
|
|
@ -32,12 +32,9 @@
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
|
* @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include <rtthread.h>
|
|
||||||
#include <n32g45x.h>
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "time.h"
|
#include <sys/time.h>
|
||||||
#include "rtdef.h"
|
#include <rtdevice.h>
|
||||||
#include "rtc.h"
|
|
||||||
|
|
||||||
#ifdef BSP_USING_RTC
|
#ifdef BSP_USING_RTC
|
||||||
|
|
||||||
|
@ -105,8 +102,8 @@ static rt_err_t rt_rtc_config(void)
|
||||||
RTC_InitType RTC_InitStructure;
|
RTC_InitType RTC_InitStructure;
|
||||||
|
|
||||||
/* Configure the RTC data register and RTC prescaler */
|
/* Configure the RTC data register and RTC prescaler */
|
||||||
RTC_InitStructure.RTC_AsynchPrediv = 128;
|
RTC_InitStructure.RTC_AsynchPrediv = AsynchPrediv;
|
||||||
RTC_InitStructure.RTC_SynchPrediv = 128;
|
RTC_InitStructure.RTC_SynchPrediv = SynchPrediv;
|
||||||
RTC_InitStructure.RTC_HourFormat = RTC_24HOUR_FORMAT;
|
RTC_InitStructure.RTC_HourFormat = RTC_24HOUR_FORMAT;
|
||||||
|
|
||||||
/* Check on RTC init */
|
/* Check on RTC init */
|
||||||
|
|
|
@ -224,6 +224,7 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
||||||
#
|
#
|
||||||
# IoT - internet of things
|
# IoT - internet of things
|
||||||
#
|
#
|
||||||
|
|
||||||
# CONFIG_PKG_USING_LWIP is not set
|
# CONFIG_PKG_USING_LWIP is not set
|
||||||
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
|
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
|
||||||
# CONFIG_PKG_USING_PAHOMQTT is not set
|
# CONFIG_PKG_USING_PAHOMQTT is not set
|
||||||
|
@ -237,7 +238,6 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
|
||||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||||
# CONFIG_PKG_USING_LIBMODBUS is not set
|
# CONFIG_PKG_USING_LIBMODBUS is not set
|
||||||
# CONFIG_PKG_USING_FREEMODBUS is not set
|
# CONFIG_PKG_USING_FREEMODBUS is not set
|
||||||
# CONFIG_PKG_USING_NANOPB is not set
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Wi-Fi
|
# Wi-Fi
|
||||||
|
@ -689,7 +689,8 @@ CONFIG_BSP_USING_USART1=y
|
||||||
# CONFIG_BSP_USING_UART6 is not set
|
# CONFIG_BSP_USING_UART6 is not set
|
||||||
# CONFIG_BSP_USING_UART7 is not set
|
# CONFIG_BSP_USING_UART7 is not set
|
||||||
# CONFIG_BSP_USING_SPI is not set
|
# CONFIG_BSP_USING_SPI is not set
|
||||||
# CONFIG_BSP_USING_I2C is not set
|
# CONFIG_BSP_USING_I2C1 is not set
|
||||||
|
# CONFIG_BSP_USING_RTC is not set
|
||||||
# CONFIG_BSP_USING_WDT is not set
|
# CONFIG_BSP_USING_WDT is not set
|
||||||
# CONFIG_BSP_USING_HWTIMER is not set
|
# CONFIG_BSP_USING_HWTIMER is not set
|
||||||
# CONFIG_BSP_USING_ADC is not set
|
# CONFIG_BSP_USING_ADC is not set
|
||||||
|
|
|
@ -75,27 +75,38 @@ menu "On-chip Peripheral Drivers"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C
|
menuconfig BSP_USING_I2C1
|
||||||
bool "Enable I2C BUS"
|
bool "Enable I2C1 BUS (software simulation)"
|
||||||
default n
|
default n
|
||||||
select RT_USING_I2C
|
select RT_USING_I2C
|
||||||
if BSP_USING_I2C
|
select RT_USING_I2C_BITOPS
|
||||||
config BSP_USING_I2C1
|
select RT_USING_PIN
|
||||||
bool "Enable I2C1"
|
if BSP_USING_I2C1
|
||||||
default n
|
config BSP_I2C1_SCL_PIN
|
||||||
|
int "i2c1 scl pin number"
|
||||||
|
range 0 111
|
||||||
|
default 22
|
||||||
|
config BSP_I2C1_SDA_PIN
|
||||||
|
int "I2C1 sda pin number"
|
||||||
|
range 0 111
|
||||||
|
default 23
|
||||||
|
endif
|
||||||
|
|
||||||
config BSP_USING_I2C2
|
menuconfig BSP_USING_RTC
|
||||||
bool "Enable I2C2"
|
bool "Enable RTC"
|
||||||
|
select RT_USING_RTC
|
||||||
default n
|
default n
|
||||||
|
if BSP_USING_RTC
|
||||||
|
choice
|
||||||
|
prompt "Select clock source"
|
||||||
|
default BSP_RTC_USING_LSE
|
||||||
|
|
||||||
config BSP_USING_I2C3
|
config BSP_RTC_USING_LSE
|
||||||
bool "Enable I2C3"
|
bool "RTC USING LSE"
|
||||||
default n
|
|
||||||
|
|
||||||
config BSP_USING_I2C4
|
|
||||||
bool "Enable I2C4"
|
|
||||||
default n
|
|
||||||
|
|
||||||
|
config BSP_RTC_USING_LSI
|
||||||
|
bool "RTC USING LSI"
|
||||||
|
endchoice
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config BSP_USING_WDT
|
config BSP_USING_WDT
|
||||||
|
|
Loading…
Reference in New Issue