drv_pwm.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Copyright (c) 2006-2024 RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-07-13 Rbb666 first version
  9. */
  10. #ifndef __PWM_CONFIG_H__
  11. #define __PWM_CONFIG_H__
  12. #include <rtthread.h>
  13. #include <board.h>
  14. #ifdef __cplusplus
  15. extern "C"
  16. {
  17. #endif
  18. #define MAX_PERIOD 65535
  19. #ifdef BSP_USING_PWM0
  20. #ifndef PWM0_CH0_PORT0_CONFIG
  21. #define PWM0_CH0_PORT0_CONFIG \
  22. { \
  23. .name = "pwm0", \
  24. .channel = 0, \
  25. .gpio = GET_PIN(0, 0), \
  26. }
  27. #endif /* PWM0_CH0_PORT2_CONFIG */
  28. #ifndef PWM0_CH2_PORT11_COMPL_CONFIG
  29. #define PWM0_CH2_PORT11_COMPL_CONFIG \
  30. { \
  31. .name = "pwm0", \
  32. .channel = 2, \
  33. .gpio = GET_PIN(11, 3), \
  34. }
  35. #endif /*PWM0_CH2_PORT11_COMPL_CONFIG*/
  36. #ifndef PWM0_CH3_PORT11_CONFIG
  37. #define PWM0_CH3_PORT11_CONFIG \
  38. { \
  39. .name = "pwm0", \
  40. .channel = 3, \
  41. .gpio = GET_PIN(11, 4), \
  42. }
  43. #endif /*PWM0_CH3_PORT11_CONFIG*/
  44. #ifndef PWM0_CH4_PORT5_COMPL_CONFIG
  45. #define PWM0_CH4_PORT5_COMPL_CONFIG \
  46. { \
  47. .name = "pwm0", \
  48. .channel = 4, \
  49. .gpio = GET_PIN(5, 1), \
  50. }
  51. #endif /*PWM0_CH4_PORT5_COMPL_CONFIG*/
  52. #ifndef PWM0_CH7_PORT2_CONFIG
  53. #define PWM0_CH7_PORT2_CONFIG \
  54. { \
  55. .name = "pwm0", \
  56. .channel = 7, \
  57. .gpio = GET_PIN(2, 2), \
  58. }
  59. #endif /* PWM0_CH7_PORT2_CONFIG */
  60. #ifndef PWM0_CH7_PORT5_CONFIG
  61. #define PWM0_CH7_PORT5_CONFIG \
  62. { \
  63. .name = "pwm0", \
  64. .channel = 7, \
  65. .gpio = GET_PIN(5, 6), \
  66. }
  67. #endif /* PWM0_CH7_PORT5_CONFIG */
  68. #ifndef PWM0_CH7_PORT5_COMPL_CONFIG
  69. #define PWM0_CH7_PORT5_COMPL_CONFIG \
  70. { \
  71. .name = "pwm0", \
  72. .channel = 7, \
  73. .gpio = GET_PIN(5, 7), \
  74. }
  75. #endif /*PWM0_CH7_PORT5_COMPL_CONFIG*/
  76. #ifndef PWM0_CH7_PORT7_CONFIG
  77. #define PWM0_CH7_PORT7_CONFIG \
  78. { \
  79. .name = "pwm0", \
  80. .channel = 7, \
  81. .gpio = GET_PIN(7, 7), \
  82. }
  83. #endif /* PWM0_CH7_PORT7_CONFIG */
  84. #ifndef PWM0_CH7_PORT9_CONFIG
  85. #define PWM0_CH7_PORT9_CONFIG \
  86. { \
  87. .name = "pwm0", \
  88. .channel = 7, \
  89. .gpio = GET_PIN(9, 4), \
  90. }
  91. #endif /* PWM0_CH7_PORT9_CONFIG */
  92. #ifndef PWM0_CH7_PORT10_CONFIG
  93. #define PWM0_CH7_PORT10_CONFIG \
  94. { \
  95. .name = "pwm0", \
  96. .channel = 7, \
  97. .gpio = GET_PIN(10, 2), \
  98. }
  99. #endif /* PWM0_CH7_PORT10_CONFIG */
  100. #ifndef PWM0_CH7_PORT12_CONFIG
  101. #define PWM0_CH7_PORT12_CONFIG \
  102. { \
  103. .name = "pwm0", \
  104. .channel = 7, \
  105. .gpio = GET_PIN(12, 6), \
  106. }
  107. #endif /* PWM0_CH7_PORT12_CONFIG */
  108. #ifndef PWM0_CH3_PORT13_CONFIG
  109. #define PWM0_CH3_PORT13_CONFIG \
  110. { \
  111. .name = "pwm0", \
  112. .channel = 3, \
  113. .gpio = GET_PIN(13, 7), \
  114. }
  115. #endif /* PWM0_CH3_PORT13_CONFIG */
  116. #endif /* BSP_USING_PWM0 */
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif