generated from hulk/gd32e23x_template_cmake_vscode
Initial commit
This commit is contained in:
20
Src/led.c
Normal file
20
Src/led.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "led.h"
|
||||
|
||||
void led_init(void) {
|
||||
rcu_periph_clock_enable(LED_RCU);
|
||||
gpio_mode_set(LED_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_PIN);
|
||||
gpio_output_options_set(LED_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, LED_PIN);
|
||||
gpio_bit_reset(LED_PORT, LED_PIN);
|
||||
}
|
||||
|
||||
void led_on(void) {
|
||||
gpio_bit_set(LED_PORT, LED_PIN);
|
||||
}
|
||||
|
||||
void led_off(void) {
|
||||
gpio_bit_reset(LED_PORT, LED_PIN);
|
||||
}
|
||||
|
||||
void led_toggle(void) {
|
||||
gpio_bit_toggle(LED_PORT, LED_PIN);
|
||||
}
|
Reference in New Issue
Block a user