rt-thread-official/bsp/CME_M7/StdPeriph_Driver/inc/cmem7_tim.h

102 lines
3.2 KiB
C
Raw Normal View History

2014-08-30 00:19:16 +08:00
/**
2023-04-05 11:26:18 +08:00
*****************************************************************************
* @file cmem7_tim.h
*
* @brief CMEM7 timer header file
*
*
* @version V1.0
* @date 3. September 2013
*
* @note
*
*****************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
*****************************************************************************
*/
2014-08-30 00:19:16 +08:00
#ifndef __CMEM7_TIM_H
#define __CMEM7_TIM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "cmem7.h"
#include "cmem7_conf.h"
#define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIMER0) || \
((PERIPH) == TIMER1) || \
((PERIPH) == TIMER2) || \
((PERIPH) == TIMER3))
2023-04-05 11:26:18 +08:00
2014-08-30 00:19:16 +08:00
/**
* @brief Timer initialization
* @note This function should be called at first before any other interfaces.
2023-04-05 11:26:18 +08:00
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @param[in] Ms overflow micro-seconds of the specific timer
2014-08-30 00:19:16 +08:00
* @retval None
2023-04-05 11:26:18 +08:00
*/
2014-08-30 00:19:16 +08:00
void TIM_Init(TIMER0_Type* Timx, uint16_t Ms);
/**
2023-04-05 11:26:18 +08:00
* @brief Enable or disable timer interrupt.
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @param[in] Enable The bit indicates if the specific interrupt is enable or not
2014-08-30 00:19:16 +08:00
* @retval None
2023-04-05 11:26:18 +08:00
*/
2014-08-30 00:19:16 +08:00
void TIM_EnableInt(TIMER0_Type* Timx, BOOL Enable);
/**
2023-04-05 11:26:18 +08:00
* @brief Check the specific interrupt is set or not
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @retval BOOL The bit indicates if the specific interrupt is set or not
*/
2014-08-30 00:19:16 +08:00
BOOL TIM_GetIntStatus(TIMER0_Type* Timx);
/**
* @brief Clear specific interrupts
2023-04-05 11:26:18 +08:00
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @retval None
*/
2014-08-30 00:19:16 +08:00
void TIM_ClearInt(TIMER0_Type* Timx);
/**
2023-04-05 11:26:18 +08:00
* @brief Enable or disable timer.
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @param[in] Enable The bit indicates if the specific timer is enable or not
2014-08-30 00:19:16 +08:00
* @retval None
2023-04-05 11:26:18 +08:00
*/
2014-08-30 00:19:16 +08:00
void TIM_Enable(TIMER0_Type* Timx, BOOL Enable);
/**
2023-04-05 11:26:18 +08:00
* @brief Check the specific timer is overflow or not
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @retval BOOL The bit indicates if the specific timer is overflow or not
*/
2014-08-30 00:19:16 +08:00
BOOL TIM_IsOverflow(TIMER0_Type* Timx);
/**
* @brief Get current counter of timer
2023-04-05 11:26:18 +08:00
* @param[in] Timx Timer peripheral, which is timer0, timer1, timer2 or timer3
* @retval uint32_t current counter
*/
2014-08-30 00:19:16 +08:00
uint32_t TIM_GetCounter(TIMER0_Type* Timx);
#ifdef __cplusplus
}
#endif
#endif /*__CMEM7_TIM_H */