uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpc17xx_timer.h File Reference

Contains all functions support for Timer firmware library on LPC17xx. More...

#include "LPC17xx.h"
#include "lpc_types.h"

Go to the source code of this file.

Classes

struct  TIM_TIMERCFG_Type
 Configuration structure in TIMER mode. More...
 
struct  TIM_COUNTERCFG_Type
 Configuration structure in COUNTER mode. More...
 
struct  TIM_MATCHCFG_Type
 Match channel configuration structure. More...
 
struct  TIM_CAPTURECFG_Type
 Capture Input configuration structure. More...
 

Macros

#define TIM_IR_CLR(n)   _BIT(n)
 
#define TIM_MATCH_INT(n)   (_BIT(n & 0x0F))
 
#define TIM_CAP_INT(n)   (_BIT(((n & 0x0F) + 4)))
 
#define TIM_ENABLE   ((uint32_t)(1<<0))
 
#define TIM_RESET   ((uint32_t)(1<<1))
 
#define TIM_TCR_MASKBIT   ((uint32_t)(3))
 
#define TIM_INT_ON_MATCH(n)   (_BIT((n * 3)))
 
#define TIM_RESET_ON_MATCH(n)   (_BIT(((n * 3) + 1)))
 
#define TIM_STOP_ON_MATCH(n)   (_BIT(((n * 3) + 2)))
 
#define TIM_MCR_MASKBIT   ((uint32_t)(0x0FFF))
 
#define TIM_MCR_CHANNEL_MASKBIT(n)   ((uint32_t)(7<<(n*3)))
 
#define TIM_CAP_RISING(n)   (_BIT((n * 3)))
 
#define TIM_CAP_FALLING(n)   (_BIT(((n * 3) + 1)))
 
#define TIM_INT_ON_CAP(n)   (_BIT(((n * 3) + 2)))
 
#define TIM_EDGE_MASK(n)   (_SBF((n * 3), 0x03))
 
#define TIM_CCR_MASKBIT   ((uint32_t)(0x3F))
 
#define TIM_CCR_CHANNEL_MASKBIT(n)   ((uint32_t)(7<<(n*3)))
 
#define TIM_EM(n)   _BIT(n)
 
#define TIM_EM_NOTHING   ((uint8_t)(0x0))
 
#define TIM_EM_LOW   ((uint8_t)(0x1))
 
#define TIM_EM_HIGH   ((uint8_t)(0x2))
 
#define TIM_EM_TOGGLE   ((uint8_t)(0x3))
 
#define TIM_EM_SET(n, s)   (_SBF(((n << 1) + 4), (s & 0x03)))
 
#define TIM_EM_MASK(n)   (_SBF(((n << 1) + 4), 0x03))
 
#define TIM_EMR_MASKBIT   0x0FFF
 
#define TIM_CTCR_MODE_MASK   0x3
 
#define TIM_CTCR_INPUT_MASK   0xC
 
#define TIM_CTCR_MASKBIT   0xF
 
#define TIM_COUNTER_MODE   ((uint8_t)(1))
 
#define PARAM_TIMx(n)
 
#define PARAM_TIM_INT_TYPE(TYPE)
 
#define PARAM_TIM_MODE_OPT(MODE)
 
#define PARAM_TIM_PRESCALE_OPT(OPT)   ((OPT == TIM_PRESCALE_TICKVAL)||(OPT == TIM_PRESCALE_USVAL))
 
#define PARAM_TIM_COUNTER_INPUT_OPT(OPT)   ((OPT == TIM_COUNTER_INCAP0)||(OPT == TIM_COUNTER_INCAP1))
 
#define PARAM_TIM_EXTMATCH_OPT(OPT)
 
#define PARAM_TIM_CAP_MODE_OPT(OPT)
 

Enumerations

enum  TIM_INT_TYPE {
  TIM_MR0_INT =0, TIM_MR1_INT =1, TIM_MR2_INT =2, TIM_MR3_INT =3,
  TIM_CR0_INT =4, TIM_CR1_INT =5
}
 interrupt type More...
 
enum  TIM_MODE_OPT { TIM_TIMER_MODE = 0, TIM_COUNTER_RISING_MODE, TIM_COUNTER_FALLING_MODE, TIM_COUNTER_ANY_MODE }
 Timer/counter operating mode. More...
 
enum  TIM_PRESCALE_OPT { TIM_PRESCALE_TICKVAL = 0, TIM_PRESCALE_USVAL }
 Timer/Counter prescale option. More...
 
enum  TIM_COUNTER_INPUT_OPT { TIM_COUNTER_INCAP0 = 0, TIM_COUNTER_INCAP1 }
 Counter input option. More...
 
enum  TIM_EXTMATCH_OPT { TIM_EXTMATCH_NOTHING = 0, TIM_EXTMATCH_LOW, TIM_EXTMATCH_HIGH, TIM_EXTMATCH_TOGGLE }
 Timer/Counter external match option. More...
 
enum  TIM_CAP_MODE_OPT { TIM_CAPTURE_NONE = 0, TIM_CAPTURE_RISING, TIM_CAPTURE_FALLING, TIM_CAPTURE_ANY }
 Timer/counter capture mode options. More...
 

Functions

void TIM_Init (LPC_TIM_TypeDef *TIMx, TIM_MODE_OPT TimerCounterMode, void *TIM_ConfigStruct)
 
void TIM_DeInit (LPC_TIM_TypeDef *TIMx)
 
void TIM_ClearIntPending (LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
 
void TIM_ClearIntCapturePending (LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
 
FlagStatus TIM_GetIntStatus (LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
 
FlagStatus TIM_GetIntCaptureStatus (LPC_TIM_TypeDef *TIMx, TIM_INT_TYPE IntFlag)
 
void TIM_ConfigStructInit (TIM_MODE_OPT TimerCounterMode, void *TIM_ConfigStruct)
 
void TIM_ConfigMatch (LPC_TIM_TypeDef *TIMx, TIM_MATCHCFG_Type *TIM_MatchConfigStruct)
 
void TIM_UpdateMatchValue (LPC_TIM_TypeDef *TIMx, uint8_t MatchChannel, uint32_t MatchValue)
 
void TIM_SetMatchExt (LPC_TIM_TypeDef *TIMx, TIM_EXTMATCH_OPT ext_match)
 
void TIM_ConfigCapture (LPC_TIM_TypeDef *TIMx, TIM_CAPTURECFG_Type *TIM_CaptureConfigStruct)
 
void TIM_Cmd (LPC_TIM_TypeDef *TIMx, FunctionalState NewState)
 
uint32_t TIM_GetCaptureValue (LPC_TIM_TypeDef *TIMx, TIM_COUNTER_INPUT_OPT CaptureChannel)
 
void TIM_ResetCounter (LPC_TIM_TypeDef *TIMx)
 

Detailed Description

Contains all functions support for Timer firmware library on LPC17xx.

Version
2.0
Date
21. May. 2010
Author
NXP MCU SW Application Team

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.

Definition in file lpc17xx_timer.h.