cmem7_tim.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**
  2. *****************************************************************************
  3. * @file cmem7_tim.h
  4. *
  5. * @brief CMEM7 timer header file
  6. *
  7. *
  8. * @version V1.0
  9. * @date 3. September 2013
  10. *
  11. * @note
  12. *
  13. *****************************************************************************
  14. * @attention
  15. *
  16. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  17. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  18. * TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
  19. * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  20. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  21. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  22. *
  23. * <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
  24. *****************************************************************************
  25. */
  26. #ifndef __CMEM7_TIM_H
  27. #define __CMEM7_TIM_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #include "cmem7.h"
  32. #include "cmem7_conf.h"
  33. #define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIMER0) || \
  34. ((PERIPH) == TIMER1) || \
  35. ((PERIPH) == TIMER2) || \
  36. ((PERIPH) == TIMER3))
  37. /**
  38. * @brief Timer initialization
  39. * @note This function should be called at first before any other interfaces.
  40. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  41. * @param[in] Ms overflow micro-seconds of the specific timer
  42. * @retval None
  43. */
  44. void TIM_Init(TIMER0_Type* Timx, uint16_t Ms);
  45. /**
  46. * @brief Enable or disable timer interrupt.
  47. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  48. * @param[in] Enable The bit indicates if the specific interrupt is enable or not
  49. * @retval None
  50. */
  51. void TIM_EnableInt(TIMER0_Type* Timx, BOOL Enable);
  52. /**
  53. * @brief Check the specific interrupt is set or not
  54. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  55. * @retval BOOL The bit indicates if the specific interrupt is set or not
  56. */
  57. BOOL TIM_GetIntStatus(TIMER0_Type* Timx);
  58. /**
  59. * @brief Clear specific interrupts
  60. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  61. * @retval None
  62. */
  63. void TIM_ClearInt(TIMER0_Type* Timx);
  64. /**
  65. * @brief Enable or disable timer.
  66. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  67. * @param[in] Enable The bit indicates if the specific timer is enable or not
  68. * @retval None
  69. */
  70. void TIM_Enable(TIMER0_Type* Timx, BOOL Enable);
  71. /**
  72. * @brief Check the specific timer is overflow or not
  73. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  74. * @retval BOOL The bit indicates if the specific timer is overflow or not
  75. */
  76. BOOL TIM_IsOverflow(TIMER0_Type* Timx);
  77. /**
  78. * @brief Get current counter of timer
  79. * @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
  80. * @retval uint32_t current counter
  81. */
  82. uint32_t TIM_GetCounter(TIMER0_Type* Timx);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif /*__CMEM7_TIM_H */