gpio_ctl.c 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "gd32f30x.h"
  2. #include <stdio.h>
  3. ///#include "gd32f350r_eval.h"
  4. #include "systick.h"
  5. #include "gpio_ctl.h"
  6. #include "global.h"
  7. #include "./mcu_sdk/mcu_api.h"
  8. #include "./mcu_sdk/protocol.h"
  9. /*******************************************************************************
  10. Function: ledSetParam()
  11. Description: 设置led控制参数,onCycle和ledCycle相等,且不为0时,led常亮;
  12. onCycle和ledCycle相等,且为0时,led常灭;
  13. Calls:
  14. Called By:
  15. Input: onCycle -- LED亮时间,单位10ms,最大值255
  16. ledCycle -- LED控制周期,单位10ms,最大255
  17. Output: no
  18. Return: no
  19. Others: no
  20. ********************************************************************************/
  21. void ledSetParam(u08 onCycle, u08 ledCycle)
  22. {
  23. if (onCycle <= ledCycle)
  24. {
  25. if (onCycle == ledCycle)
  26. {
  27. if (onCycle == 0)
  28. {
  29. CLR_LED1();
  30. CLR_LED2();
  31. CLR_LED3();
  32. CLR_LED4();
  33. }
  34. else
  35. {
  36. SET_LED1();
  37. SET_LED2();
  38. SET_LED3();
  39. SET_LED4();
  40. }
  41. }
  42. }
  43. }