欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

【火牛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);
}
}