pile_com_stm32/main/stm32/led.c

28 lines
451 B
C
Raw Normal View History

2024-03-30 18:47:02 +08:00
#include "led.h"
void led_init(void)
{
gpio_config_t io_conf = {};
io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
io_conf.pull_down_en = 0;
io_conf.pull_up_en = 0;
gpio_config(&io_conf);
}
void LED_Toggle(gpio_num_t gpio_num)
{
static unsigned char flg = 1;
if (flg)
{
gpio_set_level(gpio_num, 0);
flg = 0;
}
else
{
gpio_set_level(gpio_num, 1);
flg = 1;
}
}