Beep.c 916 B

12345678910111213141516171819202122232425262728293031323334
  1. /*********************************************************************************************************
  2. * Module : Beep.c
  3. * Abstract : Beep modules is generated alarms!
  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 "Beep.h"
  11. #include "gd32e230x_conf.h"
  12. #include "main.h"
  13. static void beep(void)
  14. {
  15. gpio_bit_toggle(GPIOB, GPIO_PIN_1);
  16. }
  17. void beep_init(void)
  18. {
  19. rcu_periph_clock_enable(RCU_GPIOB);
  20. gpio_mode_set(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO_PIN_1);
  21. gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_1);
  22. gpio_bit_reset(GPIOB, GPIO_PIN_1);
  23. sts_data_t *data = get_sts();
  24. data->beep = beep;
  25. }