Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
e4823f32
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / 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看板
提交
e4823f32
编写于
5月 27, 2017
作者:
B
Bernard Xiong
提交者:
GitHub
5月 27, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #743 from geniusgogo/NRF52832
[BSP] update NRF52832 bsp
上级
4d4597aa
92d8e4cb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
38 deletion
+63
-38
bsp/nrf52832/applications/application.c
bsp/nrf52832/applications/application.c
+3
-2
bsp/nrf52832/applications/ble_nus_app.c
bsp/nrf52832/applications/ble_nus_app.c
+1
-1
bsp/nrf52832/board/board.c
bsp/nrf52832/board/board.c
+59
-33
bsp/nrf52832/board/board.h
bsp/nrf52832/board/board.h
+0
-2
未找到文件。
bsp/nrf52832/applications/application.c
浏览文件 @
e4823f32
...
...
@@ -27,7 +27,8 @@
void
rt_init_thread_entry
(
void
*
parameter
)
{
rt_os_ready
();
extern
rt_err_t
ble_init
(
void
);
ble_init
();
}
...
...
@@ -39,7 +40,7 @@ int rt_application_init(void)
RT_THREAD_PRIORITY_MAX
/
3
,
20
);
if
(
tid
!=
RT_NULL
)
rt_thread_startup
(
tid
);
return
0
;
}
...
...
bsp/nrf52832/applications/ble_nus_app.c
浏览文件 @
e4823f32
...
...
@@ -592,7 +592,7 @@ static rt_bool_t _stack_init(void)
static
void
_stack_thread
(
void
*
parameter
)
{
rt_tick_t
next_timeout
=
(
rt_tick_t
)
RT_WAITING_FOREVER
;
FAST_ADV
();
// Enter main loop.
for
(;;)
...
...
bsp/nrf52832/board/board.c
浏览文件 @
e4823f32
...
...
@@ -10,8 +10,7 @@
#include "nrf_gpio.h"
#include <rtthread.h>
static
rt_bool_t
osready
=
RT_FALSE
;
#include <rthw.h>
#if 0
...
...
@@ -39,7 +38,7 @@ void SysTick_Configuration(void)
void SysTick_Handler(void)
{
if (
osready
)
if (
rt_thread_self() != RT_NULL
)
{
/* enter interrupt */
rt_interrupt_enter();
...
...
@@ -84,7 +83,7 @@ void SysTick_Configuration(void)
NVIC_EnableIRQ
(
NRF_RTC_IRQn
);
}
void
OSTick_Handler
(
void
)
static
rt_tick_t
_tick_distance
(
void
)
{
nrf_rtc_event_clear
(
NRF_RTC_REG
,
NRF_RTC_EVENT_COMPARE_0
);
...
...
@@ -98,40 +97,71 @@ void OSTick_Handler( void )
m_tick_overflow_count
++
;
}
{
uint32_t
diff
;
diff
=
((
m_tick_overflow_count
<<
NRF_RTC_BITWIDTH
)
+
systick_counter
)
-
rt_tick_get
();
return
((
m_tick_overflow_count
<<
NRF_RTC_BITWIDTH
)
+
systick_counter
)
-
rt_tick_get
();
}
while
((
diff
--
)
>
0
)
void
OSTick_Handler
(
void
)
{
uint32_t
diff
;
diff
=
_tick_distance
();
while
((
diff
--
)
>
0
)
{
if
(
rt_thread_self
()
!=
RT_NULL
)
{
if
(
osready
)
{
/* enter interrupt */
rt_interrupt_enter
();
/* enter interrupt */
rt_interrupt_enter
();
rt_tick_increase
();
rt_tick_increase
();
/* leave interrupt */
rt_interrupt_leave
();
}
/* leave interrupt */
rt_interrupt_leave
();
}
}
}
static
void
_wakeup_tick_adjust
(
void
)
{
uint32_t
diff
;
uint32_t
level
;
level
=
rt_hw_interrupt_disable
();
diff
=
_tick_distance
();
rt_tick_set
(
rt_tick_get
()
+
diff
);
if
(
rt_thread_self
()
!=
RT_NULL
)
{
struct
rt_thread
*
thread
;
/* check time slice */
thread
=
rt_thread_self
();
if
(
thread
->
remaining_tick
<=
diff
)
{
/* change to initialized tick */
thread
->
remaining_tick
=
thread
->
init_tick
;
/* yield */
rt_thread_yield
();
}
else
{
thread
->
remaining_tick
-=
diff
;
}
/* check timer */
rt_timer_check
();
}
rt_hw_interrupt_enable
(
level
);
}
static
void
_sleep_ongo
(
uint32_t
sleep_tick
)
{
/*
* Implementation note:
*
* To help debugging the option configUSE_TICKLESS_IDLE_SIMPLE_DEBUG was presented.
* This option would make sure that even if program execution was stopped inside
* this function no more than expected number of ticks would be skipped.
*
* Normally RTC works all the time even if firmware execution was stopped
* and that may lead to skipping too much of ticks.
*/
uint32_t
enterTime
;
uint32_t
entry_tick
;
/* Make sure the SysTick reload value does not overflow the counter. */
...
...
@@ -144,7 +174,6 @@ static void _sleep_ongo( uint32_t sleep_tick )
enterTime
=
nrf_rtc_counter_get
(
NRF_RTC_REG
);
// if ( eTaskConfirmSleepModeStatus() != eAbortSleep )
{
uint32_t
wakeupTime
=
(
enterTime
+
sleep_tick
)
&
NRF_RTC_MAXTICKS
;
...
...
@@ -183,6 +212,8 @@ static void _sleep_ongo( uint32_t sleep_tick )
nrf_rtc_int_disable
(
NRF_RTC_REG
,
NRF_RTC_INT_COMPARE0_MASK
);
nrf_rtc_event_clear
(
NRF_RTC_REG
,
NRF_RTC_EVENT_COMPARE_0
);
_wakeup_tick_adjust
();
/* Correct the system ticks */
{
...
...
@@ -200,11 +231,6 @@ static void _sleep_ongo( uint32_t sleep_tick )
#endif
void
rt_os_ready
(
void
)
{
osready
=
1
;
}
void
rt_hw_system_powersave
(
void
)
{
uint32_t
sleep_tick
;
...
...
bsp/nrf52832/board/board.h
浏览文件 @
e4823f32
...
...
@@ -9,7 +9,5 @@
void
rt_hw_board_init
(
void
);
void
rt_os_ready
(
void
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录