tim_config.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-12-12 zylx first version
  9. */
  10. #ifndef __TIM_CONFIG_H__
  11. #define __TIM_CONFIG_H__
  12. #include <rtthread.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifndef TIM_DEV_INFO_CONFIG
  17. #ifdef BSP_USING_TIM2
  18. #define TIM_DEV_INFO_CONFIG \
  19. { \
  20. .maxfreq = 1000000, \
  21. .minfreq = 2000, \
  22. .maxcnt = 0xFFFFFFFF, \
  23. .cntmode = HWTIMER_CNTMODE_UP, \
  24. }
  25. #else
  26. #define TIM_DEV_INFO_CONFIG \
  27. { \
  28. .maxfreq = 1000000, \
  29. .minfreq = 2000, \
  30. .maxcnt = 0xFFFF, \
  31. .cntmode = HWTIMER_CNTMODE_UP, \
  32. }
  33. #endif
  34. #endif /* TIM_DEV_INFO_CONFIG */
  35. #ifdef BSP_USING_TIM2
  36. #ifndef TIM2_CONFIG
  37. #define TIM2_CONFIG \
  38. { \
  39. .tim_handle.Instance = TIM2, \
  40. .tim_irqn = TIM2_IRQn, \
  41. .name = "timer2", \
  42. }
  43. #endif /* TIM2_CONFIG */
  44. #endif /* BSP_USING_TIM2 */
  45. #ifdef BSP_USING_TIM15
  46. #ifndef TIM15_CONFIG
  47. #define TIM15_CONFIG \
  48. { \
  49. .tim_handle.Instance = TIM15, \
  50. .tim_irqn = TIM1_BRK_TIM15_IRQn, \
  51. .name = "timer15", \
  52. }
  53. #endif /* TIM15_CONFIG */
  54. #endif /* BSP_USING_TIM15 */
  55. #ifdef BSP_USING_TIM16
  56. #ifndef TIM16_CONFIG
  57. #define TIM16_CONFIG \
  58. { \
  59. .tim_handle.Instance = TIM16, \
  60. .tim_irqn = TIM1_UP_TIM16_IRQn, \
  61. .name = "timer16", \
  62. }
  63. #endif /* TIM16_CONFIG */
  64. #endif /* BSP_USING_TIM16 */
  65. #ifdef BSP_USING_TIM17
  66. #ifndef TIM17_CONFIG
  67. #define TIM17_CONFIG \
  68. { \
  69. .tim_handle.Instance = TIM17, \
  70. .tim_irqn = TIM1_TRG_COM_TIM17_IRQn, \
  71. .name = "timer17", \
  72. }
  73. #endif /* TIM17_CONFIG */
  74. #endif /* BSP_USING_TIM17 */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* __TIM_CONFIG_H__ */