Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
宁楠萍
rt-thread
提交
64c9eaa7
R
rt-thread
项目概览
宁楠萍
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
64c9eaa7
编写于
9月 29, 2018
作者:
wuhanstudio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add I2C1 in Kconfig
上级
52fa0189
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
8 deletion
+14
-8
bsp/stm32f10x/drivers/Kconfig
bsp/stm32f10x/drivers/Kconfig
+6
-0
bsp/stm32f10x/drivers/SConscript
bsp/stm32f10x/drivers/SConscript
+1
-1
bsp/stm32f10x/drivers/i2c.c
bsp/stm32f10x/drivers/i2c.c
+7
-7
未找到文件。
bsp/stm32f10x/drivers/Kconfig
浏览文件 @
64c9eaa7
config BSP_USING_I2C
bool "Enable I2C1 (PB6/7)"
default n
select RT_USING_I2C
select RT_USING_I2C_BITOPS
config RT_USING_UART1
bool "Enable UART1 (PA9/10)"
default y
...
...
bsp/stm32f10x/drivers/SConscript
浏览文件 @
64c9eaa7
...
...
@@ -15,7 +15,7 @@ usart.c
if
GetDepend
([
'RT_USING_PIN'
]):
src
+=
[
'gpio.c'
]
if
GetDepend
([
'
RT_USING_I2C_BITOPS
'
]):
if
GetDepend
([
'
BSP_USING_I2C
'
]):
src
+=
[
'i2c.c'
]
# add canbus driver.
...
...
bsp/stm32f10x/drivers/i2c.c
浏览文件 @
64c9eaa7
...
...
@@ -12,7 +12,7 @@ void stm32_set_sda(void *data, rt_int32_t state)
void
stm32_set_scl
(
void
*
data
,
rt_int32_t
state
)
{
if
(
state
==
1
)
GPIO_SetBits
(
I2C1_GPIO
,
I2C1_GPIO_SCL
);
//GPIOB->BSRRL = I2C1_GPIO_SCL
GPIO_SetBits
(
I2C1_GPIO
,
I2C1_GPIO_SCL
);
//GPIOB->BSRRL = I2C1_GPIO_SCL
else
if
(
state
==
0
)
GPIO_ResetBits
(
I2C1_GPIO
,
I2C1_GPIO_SCL
);
//GPIOB->BSRRH = I2C1_GPIO_SCL
}
...
...
@@ -62,17 +62,17 @@ static void RCC_Configuration(void)
static
void
GPIO_Configuration
(
void
)
{
GPIO_InitTypeDef
GPIO_InitStructure
;
GPIO_InitStructure
.
GPIO_Pin
=
I2C1_GPIO_SDA
|
I2C1_GPIO_SCL
;
GPIO_InitStructure
.
GPIO_Mode
=
GPIO_Mode_Out_OD
;
GPIO_InitStructure
.
GPIO_Speed
=
GPIO_Speed_50MHz
;
GPIO_Init
(
I2C1_GPIO
,
&
GPIO_InitStructure
);
GPIO_InitTypeDef
GPIO_InitStructure
;
GPIO_InitStructure
.
GPIO_Pin
=
I2C1_GPIO_SDA
|
I2C1_GPIO_SCL
;
GPIO_InitStructure
.
GPIO_Mode
=
GPIO_Mode_Out_OD
;
GPIO_InitStructure
.
GPIO_Speed
=
GPIO_Speed_50MHz
;
GPIO_Init
(
I2C1_GPIO
,
&
GPIO_InitStructure
);
}
int
rt_hw_i2c_init
(
void
)
{
static
struct
rt_i2c_bus_device
stm32_i2c
;
RCC_Configuration
();
GPIO_Configuration
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录