Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
混口饭吃,
rt-thread
提交
edd3fd21
R
rt-thread
项目概览
混口饭吃,
/
rt-thread
与 Fork 源项目一致
Fork自
Mr_Pangza / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
edd3fd21
编写于
12月 05, 2020
作者:
T
thread-liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[add] wwdg driver.
上级
73539c6b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
124 addition
and
0 deletion
+124
-0
bsp/stm32/stm32mp157a-st-ev1/board/Kconfig
bsp/stm32/stm32mp157a-st-ev1/board/Kconfig
+6
-0
bsp/stm32/stm32mp157a-st-ev1/board/SConscript
bsp/stm32/stm32mp157a-st-ev1/board/SConscript
+3
-0
bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_wwdg.c
bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_wwdg.c
+115
-0
未找到文件。
bsp/stm32/stm32mp157a-st-ev1/board/Kconfig
浏览文件 @
edd3fd21
...
...
@@ -101,6 +101,12 @@ menu "On-chip Peripheral Drivers"
bool "Enable GPIO"
select RT_USING_PIN
default y
config BSP_USING_WWDG
bool "Enable WWDG"
select RT_USING_WWDG
select RT_USING_WDT
default n
config BSP_USING_QSPI
bool "Enable QSPI BUS"
...
...
bsp/stm32/stm32mp157a-st-ev1/board/SConscript
浏览文件 @
edd3fd21
...
...
@@ -52,6 +52,9 @@ if GetDepend(['BSP_USING_SPDIFRX']):
if
GetDepend
([
'BSP_USING_DFSDM'
]):
src
+=
Glob
(
'ports/drv_dfsdm.c'
)
if
GetDepend
([
'BSP_USING_WWDG'
]):
src
+=
Glob
(
'ports/drv_wwdg.c'
)
if
GetDepend
([
'BSP_USING_OPENAMP'
]):
src
+=
Glob
(
'CubeMX_Config/CM4/Src/ipcc.c'
)
src
+=
Glob
(
'CubeMX_Config/CM4/Src/openamp.c'
)
...
...
bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_wwdg.c
0 → 100644
浏览文件 @
edd3fd21
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-06-18 thread-liu the first version
*/
#include <board.h>
#if defined(BSP_USING_WWDG)
#include "drv_config.h"
#include <string.h>
#include <stdlib.h>
//#define DRV_DEBUG
#define LOG_TAG "drv.wwg"
#include <drv_log.h>
#define LED5_PIN GET_PIN(A, 14)
static
rt_uint8_t
feed_flag
=
0
;
static
WWDG_HandleTypeDef
hwwdg1
;
void
WWDG1_IRQHandler
(
void
)
{
/* enter interrupt */
rt_interrupt_enter
();
HAL_WWDG_IRQHandler
(
&
hwwdg1
);
/* leave interrupt */
rt_interrupt_leave
();
}
void
HAL_WWDG_EarlyWakeupCallback
(
WWDG_HandleTypeDef
*
hwwdg
)
{
if
(
hwwdg
->
Instance
==
WWDG1
)
{
if
(
feed_flag
)
{
HAL_WWDG_Refresh
(
&
hwwdg1
);
HAL_GPIO_TogglePin
(
GPIOA
,
GPIO_PIN_14
);
}
}
}
static
void
wwdg_init
()
{
rt_pin_mode
(
LED5_PIN
,
PIN_MODE_OUTPUT
);
hwwdg1
.
Instance
=
WWDG1
;
hwwdg1
.
Init
.
Prescaler
=
WWDG_PRESCALER_8
;
hwwdg1
.
Init
.
Window
=
0X5F
;
hwwdg1
.
Init
.
Counter
=
0x7F
;
hwwdg1
.
Init
.
EWIMode
=
WWDG_EWI_ENABLE
;
if
(
HAL_WWDG_Init
(
&
hwwdg1
)
!=
HAL_OK
)
{
Error_Handler
();
}
feed_flag
=
1
;
}
static
void
wwdg_control
(
uint8_t
pre_value
)
{
if
(
pre_value
>
7
)
{
pre_value
=
7
;
}
hwwdg1
.
Instance
->
CFR
&=
~
(
7
<<
11
);
/* clear WDGTB[2:0] */
hwwdg1
.
Instance
->
CFR
|=
pre_value
<<
11
;
/* set WDGTB[2:0] */
}
static
void
wwdg_stop
(
void
)
{
feed_flag
=
0
;
}
static
int
wwdg_sample
(
int
argc
,
char
*
argv
[])
{
if
(
argc
>
1
)
{
if
(
!
strcmp
(
argv
[
1
],
"run"
))
{
wwdg_init
();
}
else
if
(
!
strcmp
(
argv
[
1
],
"set"
))
{
if
(
argc
>
2
)
{
wwdg_control
(
atoi
(
argv
[
2
]));
}
}
else
if
(
!
strcmp
(
argv
[
1
],
"stop"
))
{
wwdg_stop
();
}
}
else
{
rt_kprintf
(
"Usage:
\n
"
);
rt_kprintf
(
"wwdg_sample run - open wwdg, when feed wwdg in wwdg irq, the LD5 will blink
\n
"
);
rt_kprintf
(
"wwdg_sample stop - stop to feed wwdg, system will reset
\n
"
);
rt_kprintf
(
"wwdg_sample set - set the wwdg prescaler, wwdg_sample set [0 - 7]
\n
"
);
}
return
RT_EOK
;
}
MSH_CMD_EXPORT
(
wwdg_sample
,
window
watch
dog
sample
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录