Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
20f1a641
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看板
提交
20f1a641
编写于
7月 30, 2017
作者:
z13955633063
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unused code for uart in led.c
上级
b032dff1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
2 addition
and
86 deletion
+2
-86
bsp/risc-v/drivers/led.c
bsp/risc-v/drivers/led.c
+0
-85
bsp/risc-v/drivers/usart.c
bsp/risc-v/drivers/usart.c
+2
-1
未找到文件。
bsp/risc-v/drivers/led.c
浏览文件 @
20f1a641
...
...
@@ -2,75 +2,9 @@ void rt_hw_led_init(void)
{
return
;
}
// See LICENSE for license details.
// This is the program which ships on the HiFive1
// board, executing out of SPI Flash at 0x20400000.
#include <stdint.h>
#include "platform.h"
#ifndef _SIFIVE_HIFIVE1_H
#error "'led_fade' is designed to run on HiFive1 and/or E300 Arty Dev Kit."
#endif
static
const
char
led_msg
[]
=
"
\a\n\r\n\r
\
55555555555555555555555555555555555555555555555
\n\r
\
5555555 Are the LEDs Changing? [y/n] 555555555
\n\r
\
55555555555555555555555555555555555555555555555
\n\r
"
;
static
const
char
sifive_msg
[]
=
"
\n\r
\
\n\r
\
SIFIVE, INC.
\n\r
\
\n\r
\
5555555555555555555555555
\n\r
\
5555 5555
\n\r
\
5555 5555
\n\r
\
5555 5555
\n\r
\
5555 5555555555555555555555
\n\r
\
5555 555555555555555555555555
\n\r
\
5555 5555
\n\r
\
5555 5555
\n\r
\
5555 5555
\n\r
\
5555555555555555555555555555 55555
\n\r
\
55555 555555555 55555
\n\r
\
55555 55555 55555
\n\r
\
55555 5 55555
\n\r
\
55555 55555
\n\r
\
55555 55555
\n\r
\
55555 55555
\n\r
\
55555 55555
\n\r
\
55555 55555
\n\r
\
555555555
\n\r
\
55555
\n\r
\
5
\n\r
\
\n\r
\
'led_fade' Demo
\n\r
\
\n\r
"
;
static
void
_putc
(
char
c
)
{
while
((
int32_t
)
UART0_REG
(
UART_REG_TXFIFO
)
<
0
);
UART0_REG
(
UART_REG_TXFIFO
)
=
c
;
}
int
_getc
(
char
*
c
){
int32_t
val
=
(
int32_t
)
UART0_REG
(
UART_REG_RXFIFO
);
if
(
val
>
0
)
{
*
c
=
val
&
0xFF
;
return
1
;
}
return
0
;
}
static
void
_puts
(
const
char
*
s
)
{
while
(
*
s
!=
'\0'
){
_putc
(
*
s
++
);
}
}
void
rt_hw_led_on
(
int
led
)
{
...
...
@@ -94,11 +28,6 @@ void rt_hw_led_on(int led)
volatile
int
i
=
0
;
while
(
i
<
10000
){
i
++
;}
_puts
(
sifive_msg
);
//_puts("Config String:\n\r");
//_puts(*((const char **) 0x100C));
//_puts("\n\r");
_puts
(
led_msg
);
uint16_t
r
=
0xFF
;
uint16_t
g
=
0
;
uint16_t
b
=
0
;
...
...
@@ -137,20 +66,6 @@ void rt_hw_led_on(int led)
PWM1_REG
(
PWM_CMP1
)
=
G
<<
4
;
// PWM is low on the left, GPIO is low on the left side, LED is ON on the left.
PWM1_REG
(
PWM_CMP2
)
=
(
B
<<
1
)
<<
4
;
// PWM is high on the middle, GPIO is low in the middle, LED is ON in the middle.
PWM1_REG
(
PWM_CMP3
)
=
0xFFFF
-
(
R
<<
4
);
// PWM is low on the left, GPIO is low on the right, LED is on on the right.
// Check for user input
if
(
c
==
0
){
if
(
_getc
(
&
c
)
!=
0
){
_putc
(
c
);
_puts
(
"
\n\r
"
);
if
((
c
==
'y'
)
||
(
c
==
'Y'
)){
_puts
(
"PASS
\n\r
"
);
}
else
{
_puts
(
"FAIL
\n\r
"
);
}
}
}
return
;
}
void
rt_hw_led_off
(
int
led
)
...
...
bsp/risc-v/drivers/usart.c
浏览文件 @
20f1a641
...
...
@@ -48,7 +48,8 @@ static int usart_putc(struct rt_serial_device *serial, char c)
}
static
int
usart_getc
(
struct
rt_serial_device
*
serial
)
{
return
0
;
rt_uint8_t
val
=
(
rt_uint8_t
)
UART0_REG
(
UART_REG_RXFIFO
);
return
val
;
}
static
struct
rt_uart_ops
ops
=
{
usart_configure
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录