Fan.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*********************************************************************************************************
  2. * Module : Fans.c
  3. * Abstract : Fans modules is used to cool down the device!
  4. * Version : 1.0.0
  5. * Author : Leopul(COPYRIGHT 2025 - 2027 Leopul. All rights reserved.)
  6. * Complete : 2025-02-16
  7. * Content : None
  8. * Note : None
  9. *********************************************************************************************************/
  10. #include "Fan.h"
  11. #include "gd32e230x_conf.h"
  12. #include "main.h"
  13. void fans_init(void)
  14. {
  15. rcu_periph_clock_enable(RCU_GPIOB);
  16. gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_6);
  17. gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_6);
  18. gpio_bit_reset(GPIOB, GPIO_PIN_6);
  19. sts_data_t *data = get_sts();
  20. data->fans = fans_on_off;
  21. }
  22. void fans_on_off(unsigned char status)
  23. {
  24. if(status == FANS_OFF)
  25. {
  26. gpio_bit_reset(GPIOB, GPIO_PIN_6);
  27. }else if(status == FANS_ON)
  28. {
  29. gpio_bit_set(GPIOB, GPIO_PIN_6);
  30. }else{
  31. }
  32. }