You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #include "port.h"
  2. static void led_gpio_init(void) {
  3. GPIO_InitSettingType x;
  4. x.Signal = GPIO_Pin_Signal_Digital;
  5. x.Dir = GPIO_Direction_Output;
  6. x.Func = GPIO_Reuse_Func0;
  7. x.ODE = GPIO_ODE_Output_Disable;
  8. x.DS = GPIO_DS_Output_Normal;
  9. x.PUE = GPIO_PUE_Input_Disable;
  10. x.PDE = GPIO_PDE_Input_Disable;
  11. GPIO_Init(GPIO_Pin_A3, &x);
  12. GPIO_Init(GPIO_Pin_B13, &x);
  13. GPIO_Init(GPIO_Pin_A5, &x);
  14. GPIO_Init(GPIO_Pin_A6, &x);
  15. GPIO_Init(GPIO_Pin_A7, &x);
  16. GPIO_Init(GPIO_Pin_A8, &x);
  17. GPIO_Init(GPIO_Pin_A9, &x);
  18. GPIO_Init(GPIO_Pin_B1, &x);
  19. GPIO_Init(GPIO_Pin_A28, &x);
  20. // GPIO_Init(GPIO_Pin_A2, &x);
  21. // GPIO_WriteBit(GPIO_Pin_A2,1);
  22. }
  23. static void key_gpio_init(void) {
  24. /**
  25. * @brief PA11~PA13?????? ????? ??????
  26. *
  27. */
  28. GPIO_InitSettingType x;
  29. x.Signal = GPIO_Pin_Signal_Digital;
  30. x.Dir = GPIO_Direction_Input;
  31. x.Func = GPIO_Reuse_Func0;
  32. x.PUE = GPIO_PUE_Input_Disable;
  33. x.PDE = GPIO_PDE_Input_Enable;
  34. GPIO_Init(GPIO_Pin_A11, &x); //??H
  35. GPIO_Init(GPIO_Pin_A16, &x); //??M
  36. GPIO_Init(GPIO_Pin_A13, &x);
  37. GPIO_Init(GPIO_Pin_A12, &x);
  38. }
  39. void gpio_init(void) {
  40. led_gpio_init();
  41. key_gpio_init();
  42. }
  43. void port_debug_set(bool state) { GPIO_SET(A, 28, !, state); }
  44. void port_fan_set(bool state) { GPIO_SET(B, 1, !!, state); }
  45. void port_led0_set(bool state) { GPIO_SET(A, 3, !, state); }
  46. void port_led1_set(bool state) { GPIO_SET(B, 13, !, state); }
  47. void port_led2_set(bool state) { GPIO_SET(A, 5, !, state); }
  48. void port_led3_set(bool state) { GPIO_SET(A, 6, !, state); }
  49. void port_led_r_set(bool state) { GPIO_SET(A, 7, !, state); }
  50. void port_led_g_set(bool state) { GPIO_SET(A, 8, !, state); }
  51. void port_led_b_set(bool state) { GPIO_SET(A, 9, !, state); }
  52. bool port_gpio_get_timer_key_state(void) { return GPIO_GET(A, 11, !!); } //??H
  53. bool port_gpio_get_gears_key_state(void) { return GPIO_GET(A, 16, !!); } //??M
  54. bool port_gpio_get_switch_key_state(void) { return GPIO_GET(A, 12, !!); }
  55. bool port_gpio_get_interval_key_state(void) { return GPIO_GET(A, 13, !!); }
  56. bool port_led0_get_state(void) { return GPIO_GET(A, 3, !); } //??H
  57. bool port_led1_get_state(void) { return GPIO_GET(B, 13,!); } //??M
  58. bool port_led2_get_state(void) { return GPIO_GET(A, 5, !); }
  59. bool port_led3_get_state(void) { return GPIO_GET(A, 6, !); }