/** * @file : lpc17xx_timer.h * @brief : Contains all functions support for Timer firmware library on LPC17xx * @version : 1.0 * @date : 14. April. 2009 * @author : HieuNguyen ************************************************************************** * Software that is described herein is for illustrative purposes only * which provides customers with programming information regarding the * products. This software is supplied "AS IS" without any warranties. * NXP Semiconductors assumes no responsibility or liability for the * use of the software, conveys no license or title under any patent, * copyright, or mask work right to the product. NXP Semiconductors * reserves the right to make changes in the software without * notification. NXP Semiconductors also make no representation or * warranty that such application will be suitable for the specified * use without further testing or modification. **********************************************************************/ /* Peripheral group ----------------------------------------------------------- */ /** @defgroup TIM * @ingroup LPC1700CMSIS_FwLib_Drivers * @{ */ #ifndef __LPC17XX_TIMER_H_ #define __LPC17XX_TIMER_H_ /* Includes ------------------------------------------------------------------- */ #include "LPC17xx.h" #include "lpc_types.h" /* Private Macros ------------------------------------------------------------- */ /** @defgroup TIM_Private_Macros * @{ */ /************************** TIMER/COUNTER Control **************************/ /** @defgroup TIM_REGISTER_BIT_DEFINITION * @{ */ /********************************************************************** ** Interrupt information **********************************************************************/ /** Macro to clean interrupt pending */ #define TIM_IR_CLR(n) _BIT(n) /********************************************************************** ** Timer interrupt register definitions **********************************************************************/ /** Macro for getting a timer match interrupt bit */ #define TIM_MATCH_INT(n) (_BIT(n & 0x0F)) /** Macro for getting a capture event interrupt bit */ #define TIM_CAP_INT(n) (_BIT(((n & 0x0F) + 4))) /********************************************************************** * Timer control register definitions **********************************************************************/ /** Timer/counter enable bit */ #define TIM_ENABLE ((uint32_t)(1<<0)) /** Timer/counter reset bit */ #define TIM_RESET ((uint32_t)(1<<1)) /** Timer control bit mask */ #define TIM_TCR_MASKBIT ((uint32_t)(3)) /********************************************************************** * Timer match control register definitions **********************************************************************/ /** Bit location for interrupt on MRx match, n = 0 to 3 */ #define TIM_INT_ON_MATCH(n) (_BIT((n * 3))) /** Bit location for reset on MRx match, n = 0 to 3 */ #define TIM_RESET_ON_MATCH(n) (_BIT(((n * 3) + 1))) /** Bit location for stop on MRx match, n = 0 to 3 */ #define TIM_STOP_ON_MATCH(n) (_BIT(((n * 3) + 2))) /** Timer Match control bit mask */ #define TIM_MCR_MASKBIT ((uint32_t)(0x0FFF)) /** Timer Match control bit mask for specific channel*/ #define TIM_MCR_CHANNEL_MASKBIT(n) ((uint32_t)(7<