【火牛STM32F103VC】RT-Thread 开发测试环境搭建
最编程
2024-01-06 11:12:19
...
#include <led.h>
#include <board.h>
int led_gpio_init(void)
{
/* set LED0 pin mode to output */
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED4_PIN, PIN_MODE_OUTPUT);
return 0;
}
void led1_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED1_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED1_PIN, PIN_HIGH);
}
}
void led2_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED2_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED2_PIN, PIN_HIGH);
}
}
void led3_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED3_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED3_PIN, PIN_HIGH);
}
}
void led4_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED4_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED4_PIN, PIN_HIGH);
}
}
#include <board.h>
int led_gpio_init(void)
{
/* set LED0 pin mode to output */
rt_pin_mode(LED1_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED2_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED3_PIN, PIN_MODE_OUTPUT);
rt_pin_mode(LED4_PIN, PIN_MODE_OUTPUT);
return 0;
}
void led1_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED1_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED1_PIN, PIN_HIGH);
}
}
void led2_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED2_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED2_PIN, PIN_HIGH);
}
}
void led3_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED3_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED3_PIN, PIN_HIGH);
}
}
void led4_power_on(rt_uint8_t bon)
{
if (bon == 0x00)
{
rt_pin_write(LED4_PIN, PIN_LOW);
}
else
{
rt_pin_write(LED4_PIN, PIN_HIGH);
}
}
上一篇: 操作步骤:在Linux环境下下载和编译TRDP源码
下一篇: 在C#同步方法中如何调用异步方法
推荐阅读
-
前端搭建指南:调试本地开发环境的实用技巧 - 在CLI脚手架项目里,别忘了添加库文件及其版本依赖 1. 实时联动与修改: a) 首先确保在当前CLI脚手架项目的`package.json`依赖中加入所用库文件及其正确版本。 b) 通过npm link在本地创建硬连接,使得库与项目能实时修改、同步。运行如下命令: ``` $ cd your-lib-dir $ npm link $ cd your-cli-dir $ npm link your-lib ``` 2. 模拟部署环境: 当需测试线上环境时,解除本地软链接。回到库文件目录并执行: ``` $ cd your-lib-dir $ npm unlink ``` 同样,在CLI项目目录执行: ``` $ cd your-cli-dir $ npm uninstall your-lib --save ``` 注意此时可能会出现因缺少库文件依赖导致的错误,但可暂且忽略,这样能避免将来遗漏或重复安装的问题。 3. 发布后的操作: 如果库已上线,可先清空CLI项目的`node_modules`目录(`rm -rf node_modules`),然后重新安装所有依赖: ``` $ npm install ``` 通过以上步骤,您就能顺畅地调试和部署您的脚手架项目了。 总结 `link` & `unlink` 命令的运用: 1. `npm link`:在本地创建硬连接,便于实时协作与同步。 2. `npm unlink`:模拟线上环境并解除软链接,为正式部署做准备。
-
【火牛STM32F103VC】RT-Thread 开发测试环境搭建