drv_hwtimer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-07-29 rtthread qiu first version
  9. */
  10. #ifndef __DRV_HWTIMER_H__
  11. #define __DRV_HWTIMER_H__
  12. #include <rtthread.h>
  13. #include "cy_pdl.h"
  14. #include "cyhal.h"
  15. #include "cybsp.h"
  16. #include "cy_retarget_io.h"
  17. #ifndef TIM_DEV_INFO_CONFIG
  18. #define TIM_DEV_INFO_CONFIG \
  19. { \
  20. .maxfreq = 1000000, \
  21. .minfreq = 2000, \
  22. .maxcnt = 0xFFFF, \
  23. .cntmode = HWTIMER_CNTMODE_UP, \
  24. }
  25. #endif /* TIM_DEV_INFO_CONFIG */
  26. #ifdef BSP_USING_TIM1
  27. #ifndef TIM1_CONFIG
  28. #define TIM1_CONFIG \
  29. { \
  30. .tim_irqn = tcpwm_0_interrupts_0_IRQn, \
  31. .name = "time1", \
  32. }
  33. #endif /*TIM1_CONFIG*/
  34. #endif /* BSP_USING_TIM1 */
  35. #ifdef BSP_USING_TIM2
  36. #ifndef TIM2_CONFIG
  37. #define TIM2_CONFIG \
  38. { \
  39. .tim_irqn = tcpwm_1_interrupts_0_IRQn, \
  40. .name = "time2", \
  41. }
  42. #endif /*TIM2_CONFIG*/
  43. #endif /* BSP_USING_TIM2 */
  44. #endif /* __DRV_HWTIMER_H__ */