RT-Thread学习笔记(一)

tm32H743pro
版本:rt-thread v4.0.3

两种方案: 一. 使用rt-thread studio编写程序
二. 使用env 工具配合keil5 编程

各种接口函数、驱动以及编程规范参见官方文档

<a href="https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-standard/README">点击此处了解</a>

在bsp中打开工程,可以看到main.c中的主线程代码如下:

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

/* defined the LED0 pin: PB1 */
#define LED0_PIN    GET_PIN(B, 1)

int main(void)
{
    int count = 1;
    /* set LED0 pin mode to output */	
    rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);	
	
while (count++)
{
    rt_pin_write(LED0_PIN, PIN_HIGH);
    rt_thread_mdelay(500);
    rt_pin_write(LED0_PIN, PIN_LOW);
    rt_thread_mdelay(500);
}
return RT_EOK;
}

频率为1hz的led灯闪烁。

在有新功能可添加到applications文件夹中。同时可使用ST官方软件STM Cube MX配置各个功能及时钟。

在这里插入图片描述

​ 配置完成,按此处的generate生成代码,之后将main.c中的SystemClock_Config函数复制,覆盖board.c中的SystemClock_Config函数。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值