| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /*********************************************************************************************************
- * Module : R_Led.c
- * Abstract : R_Led module displays the relay status!
- * Version : 1.0.0
- * Author : Leopul(COPYRIGHT 2025 - 2027 Leopul. All rights reserved.)
- * Complete : 2025-02-16
- * Content : None
- * Note : None
- *********************************************************************************************************/
- #include "R_Led.h"
- #include "gd32e230x_conf.h"
- void r_led_init(void)
- {
- rcu_periph_clock_enable(RCU_GPIOB);
-
- gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_2);
- gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_2);
- gpio_bit_reset(GPIOB, GPIO_PIN_2);
- gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_10);
- gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_10);
- gpio_bit_reset(GPIOB, GPIO_PIN_10);
- gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_11);
- gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_11);
- gpio_bit_reset(GPIOB, GPIO_PIN_11);
- }
- void in_r_led_on_off(unsigned char channel)
- {
- if(channel == 0)
- {
- gpio_bit_set(GPIOB, GPIO_PIN_2);
- gpio_bit_reset(GPIOB, GPIO_PIN_10);
- }else
- {
- gpio_bit_reset(GPIOB, GPIO_PIN_2);
- gpio_bit_set(GPIOB, GPIO_PIN_10);
- }
- }
- void out_r_led(unsigned char status)
- {
- if(status == 0)
- {
- gpio_bit_set(GPIOB, GPIO_PIN_11);
- }else
- {
- gpio_bit_reset(GPIOB, GPIO_PIN_11);
- }
- }
|