120 #include "stm32f4xx_rcc.h" 135 #define SMCR_ETR_MASK ((uint16_t)0x00FF) 136 #define CCMR_OFFSET ((uint16_t)0x0018) 137 #define CCER_CCE_SET ((uint16_t)0x0001) 138 #define CCER_CCNE_SET ((uint16_t)0x0004) 139 #define CCMR_OC13M_MASK ((uint16_t)0xFF8F) 140 #define CCMR_OC24M_MASK ((uint16_t)0x8FFF) 146 uint16_t TIM_ICFilter);
148 uint16_t TIM_ICFilter);
150 uint16_t TIM_ICFilter);
152 uint16_t TIM_ICFilter);
210 else if (TIMx ==
TIM2)
215 else if (TIMx ==
TIM3)
220 else if (TIMx ==
TIM4)
225 else if (TIMx ==
TIM5)
230 else if (TIMx ==
TIM6)
235 else if (TIMx ==
TIM7)
240 else if (TIMx ==
TIM8)
245 else if (TIMx ==
TIM9)
250 else if (TIMx ==
TIM10)
255 else if (TIMx ==
TIM11)
260 else if (TIMx ==
TIM12)
265 else if (TIMx ==
TIM13)
299 if((TIMx ==
TIM1) || (TIMx ==
TIM8)||
308 if((TIMx !=
TIM6) && (TIMx !=
TIM7))
323 if ((TIMx ==
TIM1) || (TIMx ==
TIM8))
343 TIM_TimeBaseInitStruct->
TIM_Period = 0xFFFFFFFF;
366 TIMx->
PSC = Prescaler;
368 TIMx->
EGR = TIM_PSCReloadMode;
397 tmpcr1 |= TIM_CounterMode;
430 TIMx->
ARR = Autoreload;
559 TIMx->
CR1 |= TIM_OPMode;
582 TIMx->
CR1 |= TIM_CKD;
675 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
687 tmpccer = TIMx->
CCER;
692 tmpccmrx = TIMx->
CCMR1;
708 if((TIMx ==
TIM1) || (TIMx ==
TIM8))
736 TIMx->
CCMR1 = tmpccmrx;
742 TIMx->
CCER = tmpccer;
756 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
768 tmpccer = TIMx->
CCER;
773 tmpccmrx = TIMx->
CCMR1;
780 tmpccmrx |= (uint16_t)(TIM_OCInitStruct->
TIM_OCMode << 8);
790 if((TIMx ==
TIM1) || (TIMx ==
TIM8))
818 TIMx->
CCMR1 = tmpccmrx;
824 TIMx->
CCER = tmpccer;
837 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
849 tmpccer = TIMx->
CCER;
854 tmpccmrx = TIMx->
CCMR2;
870 if((TIMx ==
TIM1) || (TIMx ==
TIM8))
898 TIMx->
CCMR2 = tmpccmrx;
904 TIMx->
CCER = tmpccer;
917 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
929 tmpccer = TIMx->
CCER;
934 tmpccmrx = TIMx->
CCMR2;
941 tmpccmrx |= (uint16_t)(TIM_OCInitStruct->
TIM_OCMode << 8);
951 if((TIMx ==
TIM1) || (TIMx ==
TIM8))
963 TIMx->
CCMR2 = tmpccmrx;
969 TIMx->
CCER = tmpccer;
984 TIM_OCInitStruct->
TIM_Pulse = 0x00000000;
1024 tmp = (uint32_t) TIMx;
1030 TIMx->
CCER &= (uint16_t) ~tmp1;
1034 tmp += (TIM_Channel>>1);
1040 *(
__IO uint32_t *) tmp |= TIM_OCMode;
1044 tmp += (uint16_t)(TIM_Channel - (uint16_t)4)>> (uint16_t)1;
1050 *(
__IO uint32_t *) tmp |= (uint16_t)(TIM_OCMode << 8);
1066 TIMx->
CCR1 = Compare1;
1082 TIMx->
CCR2 = Compare2;
1097 TIMx->
CCR3 = Compare3;
1112 TIMx->
CCR4 = Compare4;
1126 uint16_t tmpccmr1 = 0;
1131 tmpccmr1 = TIMx->
CCMR1;
1137 tmpccmr1 |= TIM_ForcedAction;
1140 TIMx->
CCMR1 = tmpccmr1;
1155 uint16_t tmpccmr1 = 0;
1160 tmpccmr1 = TIMx->
CCMR1;
1166 tmpccmr1 |= (uint16_t)(TIM_ForcedAction << 8);
1169 TIMx->
CCMR1 = tmpccmr1;
1183 uint16_t tmpccmr2 = 0;
1189 tmpccmr2 = TIMx->
CCMR2;
1195 tmpccmr2 |= TIM_ForcedAction;
1198 TIMx->
CCMR2 = tmpccmr2;
1212 uint16_t tmpccmr2 = 0;
1217 tmpccmr2 = TIMx->
CCMR2;
1223 tmpccmr2 |= (uint16_t)(TIM_ForcedAction << 8);
1226 TIMx->
CCMR2 = tmpccmr2;
1240 uint16_t tmpccmr1 = 0;
1246 tmpccmr1 = TIMx->
CCMR1;
1252 tmpccmr1 |= TIM_OCPreload;
1255 TIMx->
CCMR1 = tmpccmr1;
1270 uint16_t tmpccmr1 = 0;
1276 tmpccmr1 = TIMx->
CCMR1;
1282 tmpccmr1 |= (uint16_t)(TIM_OCPreload << 8);
1285 TIMx->
CCMR1 = tmpccmr1;
1299 uint16_t tmpccmr2 = 0;
1305 tmpccmr2 = TIMx->
CCMR2;
1311 tmpccmr2 |= TIM_OCPreload;
1314 TIMx->
CCMR2 = tmpccmr2;
1328 uint16_t tmpccmr2 = 0;
1334 tmpccmr2 = TIMx->
CCMR2;
1340 tmpccmr2 |= (uint16_t)(TIM_OCPreload << 8);
1343 TIMx->
CCMR2 = tmpccmr2;
1357 uint16_t tmpccmr1 = 0;
1364 tmpccmr1 = TIMx->
CCMR1;
1370 tmpccmr1 |= TIM_OCFast;
1373 TIMx->
CCMR1 = tmpccmr1;
1388 uint16_t tmpccmr1 = 0;
1395 tmpccmr1 = TIMx->
CCMR1;
1401 tmpccmr1 |= (uint16_t)(TIM_OCFast << 8);
1404 TIMx->
CCMR1 = tmpccmr1;
1418 uint16_t tmpccmr2 = 0;
1425 tmpccmr2 = TIMx->
CCMR2;
1431 tmpccmr2 |= TIM_OCFast;
1434 TIMx->
CCMR2 = tmpccmr2;
1448 uint16_t tmpccmr2 = 0;
1455 tmpccmr2 = TIMx->
CCMR2;
1461 tmpccmr2 |= (uint16_t)(TIM_OCFast << 8);
1464 TIMx->
CCMR2 = tmpccmr2;
1478 uint16_t tmpccmr1 = 0;
1484 tmpccmr1 = TIMx->
CCMR1;
1490 tmpccmr1 |= TIM_OCClear;
1493 TIMx->
CCMR1 = tmpccmr1;
1508 uint16_t tmpccmr1 = 0;
1514 tmpccmr1 = TIMx->
CCMR1;
1520 tmpccmr1 |= (uint16_t)(TIM_OCClear << 8);
1523 TIMx->
CCMR1 = tmpccmr1;
1537 uint16_t tmpccmr2 = 0;
1543 tmpccmr2 = TIMx->
CCMR2;
1549 tmpccmr2 |= TIM_OCClear;
1552 TIMx->
CCMR2 = tmpccmr2;
1566 uint16_t tmpccmr2 = 0;
1572 tmpccmr2 = TIMx->
CCMR2;
1578 tmpccmr2 |= (uint16_t)(TIM_OCClear << 8);
1581 TIMx->
CCMR2 = tmpccmr2;
1595 uint16_t tmpccer = 0;
1601 tmpccer = TIMx->
CCER;
1605 tmpccer |= TIM_OCPolarity;
1608 TIMx->
CCER = tmpccer;
1622 uint16_t tmpccer = 0;
1627 tmpccer = TIMx->
CCER;
1631 tmpccer |= TIM_OCNPolarity;
1634 TIMx->
CCER = tmpccer;
1649 uint16_t tmpccer = 0;
1655 tmpccer = TIMx->
CCER;
1659 tmpccer |= (uint16_t)(TIM_OCPolarity << 4);
1662 TIMx->
CCER = tmpccer;
1676 uint16_t tmpccer = 0;
1682 tmpccer = TIMx->
CCER;
1686 tmpccer |= (uint16_t)(TIM_OCNPolarity << 4);
1689 TIMx->
CCER = tmpccer;
1703 uint16_t tmpccer = 0;
1709 tmpccer = TIMx->
CCER;
1713 tmpccer |= (uint16_t)(TIM_OCPolarity << 8);
1716 TIMx->
CCER = tmpccer;
1730 uint16_t tmpccer = 0;
1736 tmpccer = TIMx->
CCER;
1740 tmpccer |= (uint16_t)(TIM_OCNPolarity << 8);
1743 TIMx->
CCER = tmpccer;
1757 uint16_t tmpccer = 0;
1763 tmpccer = TIMx->
CCER;
1767 tmpccer |= (uint16_t)(TIM_OCPolarity << 12);
1770 TIMx->
CCER = tmpccer;
1798 TIMx->
CCER &= (uint16_t)~ tmp;
1801 TIMx->
CCER |= (uint16_t)(TIM_CCx << TIM_Channel);
1828 TIMx->
CCER &= (uint16_t) ~tmp;
1831 TIMx->
CCER |= (uint16_t)(TIM_CCxN << TIM_Channel);
2105 TIMx->
CCMR1 |= TIM_ICPSC;
2130 TIMx->
CCMR1 |= (uint16_t)(TIM_ICPSC << 8);
2154 TIMx->
CCMR2 |= TIM_ICPSC;
2178 TIMx->
CCMR2 |= (uint16_t)(TIM_ICPSC << 8);
2382 TIMx->
DIER |= TIM_IT;
2387 TIMx->
DIER &= (uint16_t)~TIM_IT;
2417 TIMx->
EGR = TIM_EventSource;
2451 if ((TIMx->
SR & TIM_FLAG) != (uint16_t)
RESET)
2491 TIMx->
SR = (uint16_t)~TIM_FLAG;
2516 uint16_t itstatus = 0x0, itenable = 0x0;
2521 itstatus = TIMx->
SR & TIM_IT;
2523 itenable = TIMx->
DIER & TIM_IT;
2524 if ((itstatus != (uint16_t)
RESET) && (itenable != (uint16_t)RESET))
2560 TIMx->
SR = (uint16_t)~TIM_IT;
2599 TIMx->
DCR = TIM_DMABase | TIM_DMABurstLength;
2628 TIMx->
DIER |= TIM_DMASource;
2633 TIMx->
DIER &= (uint16_t)~TIM_DMASource;
2735 uint16_t TIM_ICPolarity, uint16_t ICFilter)
2775 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
2777 uint16_t tmpsmcr = 0;
2785 TIM_ETRConfig(TIMx, TIM_ExtTRGPrescaler, TIM_ExtTRGPolarity, ExtTRGFilter);
2788 tmpsmcr = TIMx->
SMCR;
2801 TIMx->
SMCR = tmpsmcr;
2822 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
2831 TIM_ETRConfig(TIMx, TIM_ExtTRGPrescaler, TIM_ExtTRGPolarity, ExtTRGFilter);
2894 uint16_t tmpsmcr = 0;
2901 tmpsmcr = TIMx->
SMCR;
2907 tmpsmcr |= TIM_InputTriggerSource;
2910 TIMx->
SMCR = tmpsmcr;
2944 TIMx->
CR2 |= TIM_TRGOSource;
2969 TIMx->
SMCR |= TIM_SlaveMode;
2992 TIMx->
SMCR |= TIM_MasterSlaveMode;
3013 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
3015 uint16_t tmpsmcr = 0;
3023 tmpsmcr = TIMx->
SMCR;
3029 tmpsmcr |= (uint16_t)(TIM_ExtTRGPrescaler | (uint16_t)(TIM_ExtTRGPolarity | (uint16_t)(ExtTRGFilter << (uint16_t)8)));
3032 TIMx->
SMCR = tmpsmcr;
3071 uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity)
3073 uint16_t tmpsmcr = 0;
3074 uint16_t tmpccmr1 = 0;
3075 uint16_t tmpccer = 0;
3084 tmpsmcr = TIMx->
SMCR;
3087 tmpccmr1 = TIMx->
CCMR1;
3090 tmpccer = TIMx->
CCER;
3094 tmpsmcr |= TIM_EncoderMode;
3102 tmpccer |= (uint16_t)(TIM_IC1Polarity | (uint16_t)(TIM_IC2Polarity << (uint16_t)4));
3105 TIMx->
SMCR = tmpsmcr;
3108 TIMx->
CCMR1 = tmpccmr1;
3111 TIMx->
CCER = tmpccer;
3180 TIMx->
OR = TIM_Remap;
3205 uint16_t TIM_ICFilter)
3207 uint16_t tmpccmr1 = 0, tmpccer = 0;
3211 tmpccmr1 = TIMx->
CCMR1;
3212 tmpccer = TIMx->
CCER;
3216 tmpccmr1 |= (uint16_t)(TIM_ICSelection | (uint16_t)(TIM_ICFilter << (uint16_t)4));
3220 tmpccer |= (uint16_t)(TIM_ICPolarity | (uint16_t)
TIM_CCER_CC1E);
3223 TIMx->
CCMR1 = tmpccmr1;
3224 TIMx->
CCER = tmpccer;
3246 uint16_t TIM_ICFilter)
3248 uint16_t tmpccmr1 = 0, tmpccer = 0, tmp = 0;
3252 tmpccmr1 = TIMx->
CCMR1;
3253 tmpccer = TIMx->
CCER;
3254 tmp = (uint16_t)(TIM_ICPolarity << 4);
3258 tmpccmr1 |= (uint16_t)(TIM_ICFilter << 12);
3259 tmpccmr1 |= (uint16_t)(TIM_ICSelection << 8);
3266 TIMx->
CCMR1 = tmpccmr1 ;
3267 TIMx->
CCER = tmpccer;
3288 uint16_t TIM_ICFilter)
3290 uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0;
3294 tmpccmr2 = TIMx->
CCMR2;
3295 tmpccer = TIMx->
CCER;
3296 tmp = (uint16_t)(TIM_ICPolarity << 8);
3300 tmpccmr2 |= (uint16_t)(TIM_ICSelection | (uint16_t)(TIM_ICFilter << (uint16_t)4));
3307 TIMx->
CCMR2 = tmpccmr2;
3308 TIMx->
CCER = tmpccer;
3329 uint16_t TIM_ICFilter)
3331 uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0;
3335 tmpccmr2 = TIMx->
CCMR2;
3336 tmpccer = TIMx->
CCER;
3337 tmp = (uint16_t)(TIM_ICPolarity << 12);
3341 tmpccmr2 |= (uint16_t)(TIM_ICSelection << 8);
3342 tmpccmr2 |= (uint16_t)(TIM_ICFilter << 12);
3349 TIMx->
CCMR2 = tmpccmr2;
3350 TIMx->
CCER = tmpccer ;
void TIM_OC3PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 3 polarity.
void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF1 signal on an external event.
void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
Configures the TIMx Internal Trigger as External Clock.
void TIM_SelectMasterSlaveMode(TIM_TypeDef *TIMx, uint16_t TIM_MasterSlaveMode)
Sets or Resets the TIMx Master/Slave Mode.
#define IS_TIM_COUNTER_MODE(MODE)
uint32_t TIM_GetCapture3(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 3 value.
void TIM_TIxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_TIxExternalCLKSource, uint16_t TIM_ICPolarity, uint16_t ICFilter)
Configures the TIMx Trigger as External Clock.
#define IS_TIM_CKD_DIV(DIV)
void TIM_SetCompare1(TIM_TypeDef *TIMx, uint32_t Compare1)
Sets the TIMx Capture Compare1 Register value.
#define TIM_PSCReloadMode_Immediate
#define IS_TIM_OC_MODE(MODE)
uint16_t TIM_OutputNState
void TIM_UpdateRequestConfig(TIM_TypeDef *TIMx, uint16_t TIM_UpdateSource)
Configures the TIMx Update Request Interrupt source.
#define IS_TIM_EVENT_SOURCE(SOURCE)
void TIM_OC4Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel4 according to the specified parameters in the TIM_OCInitStruct.
#define IS_TIM_SLAVE_MODE(MODE)
void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR4.
#define RCC_APB1Periph_TIM7
void TIM_SelectOnePulseMode(TIM_TypeDef *TIMx, uint16_t TIM_OPMode)
Selects the TIMx's One Pulse Mode.
void TIM_ForcedOC2Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 2 waveform to active or inactive level.
#define IS_TIM_LIST3_PERIPH(PERIPH)
#define TIM_OSSIState_Disable
#define TIM_AutomaticOutput_Disable
void TIM_DMACmd(TIM_TypeDef *TIMx, uint16_t TIM_DMASource, FunctionalState NewState)
Enables or disables the TIMx's DMA Requests.
void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 4 waveform to active or inactive level.
void TIM_OC2NPolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity)
Configures the TIMx Channel 2N polarity.
#define TIM_LOCKLevel_OFF
#define IS_TIM_TRGO_SOURCE(SOURCE)
#define IS_TIM_EXT_POLARITY(POLARITY)
uint32_t TIM_GetCapture1(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 1 value.
static void TI4_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter)
Configure the TI4 as Input.
#define RCC_APB1Periph_TIM5
void TIM_ICInit(TIM_TypeDef *TIMx, TIM_ICInitTypeDef *TIM_ICInitStruct)
Initializes the TIM peripheral according to the specified parameters in the TIM_ICInitStruct.
#define RCC_APB1Periph_TIM13
void TIM_ITConfig(TIM_TypeDef *TIMx, uint16_t TIM_IT, FunctionalState NewState)
Enables or disables the specified TIM interrupts.
void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 1 waveform to active or inactive level.
void TIM_CCxCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx)
Enables or disables the TIM Capture Compare Channel x.
void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF2 signal on an external event.
#define RCC_APB2Periph_TIM9
#define IS_TIM_OUTPUTN_STATE(STATE)
void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR1.
#define TIM_OCNIdleState_Reset
#define TIM_OutputNState_Disable
void TIM_Cmd(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables the specified TIM peripheral.
#define IS_TIM_PRESCALER_RELOAD(RELOAD)
uint16_t TIM_AutomaticOutput
This file contains all the functions prototypes for the TIM firmware library.
#define IS_TIM_GET_IT(IT)
void TIM_DeInit(TIM_TypeDef *TIMx)
Deinitializes the TIMx peripheral registers to their default reset values.
void TIM_SetIC4Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 4 prescaler.
void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables the TIMx's Hall sensor interface.
void TIM_BDTRConfig(TIM_TypeDef *TIMx, TIM_BDTRInitTypeDef *TIM_BDTRInitStruct)
Configures the Break feature, dead time, Lock level, OSSI/OSSR State and the AOE(automatic output ena...
#define IS_TIM_UPDATE_SOURCE(SOURCE)
static void TI2_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter)
Configure the TI2 as Input.
#define TIM_SlaveMode_External1
#define IS_TIM_LIST5_PERIPH(PERIPH)
#define IS_TIM_AUTOMATIC_OUTPUT_STATE(STATE)
#define RCC_APB1Periph_TIM12
void TIM_SelectOutputTrigger(TIM_TypeDef *TIMx, uint16_t TIM_TRGOSource)
Selects the TIMx Trigger Output Mode.
#define IS_TIM_ENCODER_MODE(MODE)
void assert_param(int val)
#define IS_TIM_OCFAST_STATE(STATE)
void TIM_OC2Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel2 according to the specified parameters in the TIM_OCInitStruct.
#define IS_TIM_GET_FLAG(FLAG)
#define IS_FUNCTIONAL_STATE(STATE)
#define RCC_APB1Periph_TIM2
#define IS_TIM_BREAK_POLARITY(POLARITY)
void TIM_DMAConfig(TIM_TypeDef *TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength)
Configures the TIMx's DMA interface.
void TIM_UpdateDisableConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or Disables the TIMx Update event.
#define IS_TIM_OSSI_STATE(STATE)
uint16_t TIM_GetPrescaler(TIM_TypeDef *TIMx)
Gets the TIMx Prescaler value.
void TIM_OCStructInit(TIM_OCInitTypeDef *TIM_OCInitStruct)
Fills each TIM_OCInitStruct member with its default value.
#define RCC_APB2Periph_TIM1
void TIM_SetAutoreload(TIM_TypeDef *TIMx, uint32_t Autoreload)
Sets the TIMx Autoreload Register value.
#define IS_TIM_COMPLEMENTARY_CHANNEL(CHANNEL)
#define TIM_OSSRState_Disable
void TIM_BDTRStructInit(TIM_BDTRInitTypeDef *TIM_BDTRInitStruct)
Fills each TIM_BDTRInitStruct member with its default value.
void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables TIMx peripheral Preload register on ARR.
#define IS_TIM_LIST1_PERIPH(PERIPH)
static void TI3_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter)
Configure the TI3 as Input.
void TIM_SelectCCDMA(TIM_TypeDef *TIMx, FunctionalState NewState)
Selects the TIMx peripheral Capture Compare DMA source.
#define IS_TIM_LOCK_LEVEL(LEVEL)
void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR2.
void TIM_OC1NPolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity)
Configures the TIMx Channel 1N polarity.
void TIM_CCPreloadControl(TIM_TypeDef *TIMx, FunctionalState NewState)
Sets or Resets the TIM peripheral Capture Compare Preload Control bit.
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Forces or releases Low Speed APB (APB1) peripheral reset.
void TIM_EncoderInterfaceConfig(TIM_TypeDef *TIMx, uint16_t TIM_EncoderMode, uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity)
Configures the TIMx Encoder Interface.
#define TIM_TIxExternalCLK1Source_TI2
#define RCC_APB1Periph_TIM3
void TIM_SetIC3Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 3 prescaler.
#define IS_TIM_REMAP(TIM_REMAP)
void TIM_ClearITPendingBit(TIM_TypeDef *TIMx, uint16_t TIM_IT)
Clears the TIMx's interrupt pending bits.
void TIM_ClearFlag(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
Clears the TIMx's pending flags.
#define IS_TIM_OSSR_STATE(STATE)
#define RCC_APB1Periph_TIM14
#define RCC_APB2Periph_TIM11
void TIM_RemapConfig(TIM_TypeDef *TIMx, uint16_t TIM_Remap)
Configures the TIM2, TIM5 and TIM11 Remapping input capabilities.
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
Fills each TIM_TimeBaseInitStruct member with its default value.
#define IS_TIM_LIST2_PERIPH(PERIPH)
void TIM_PWMIConfig(TIM_TypeDef *TIMx, TIM_ICInitTypeDef *TIM_ICInitStruct)
Configures the TIM peripheral according to the specified parameters in the TIM_ICInitStruct to measur...
#define IS_TIM_CHANNEL(CHANNEL)
void TIM_ETRClockMode2Config(TIM_TypeDef *TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
Configures the External clock Mode2.
#define RCC_APB1Periph_TIM4
void TIM_OC1Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel1 according to the specified parameters in the TIM_OCInitStruct.
void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 1 Fast feature.
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode)
Specifies the TIMx Counter Mode to be used.
#define IS_TIM_EXT_FILTER(EXTFILTER)
void TIM_OC2FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 2 Fast feature.
void TIM_SelectCOM(TIM_TypeDef *TIMx, FunctionalState NewState)
Selects the TIM peripheral Commutation event.
void TIM_OC4FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 4 Fast feature.
void TIM_SetCompare3(TIM_TypeDef *TIMx, uint32_t Compare3)
Sets the TIMx Capture Compare3 Register value.
#define IS_TIM_OCCLEAR_STATE(STATE)
uint16_t TIM_ClockDivision
#define IS_TIM_CCXN(CCXN)
void TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter)
Sets the TIMx Counter Register value.
#define IS_TIM_DMA_SOURCE(SOURCE)
void TIM_SetClockDivision(TIM_TypeDef *TIMx, uint16_t TIM_CKD)
Sets the TIMx Clock Division value.
uint8_t TIM_RepetitionCounter
void TIM_ICStructInit(TIM_ICInitTypeDef *TIM_ICInitStruct)
Fills each TIM_ICInitStruct member with its default value.
#define IS_TIM_DMA_LENGTH(LENGTH)
#define IS_TIM_ALL_PERIPH(PERIPH)
TIM Time Base Init structure definition.
#define TIM_OutputState_Disable
#define TIM_OCMode_Timing
TIM Input Capture Init structure definition.
void TIM_ForcedOC3Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 3 waveform to active or inactive level.
static void TI1_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter)
Configure the TI1 as Input.
uint16_t TIM_BreakPolarity
void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
Forces or releases High Speed APB (APB2) peripheral reset.
void TIM_SelectOCxM(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode)
Selects the TIM Output Compare Mode.
void TIM_OC1PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 1 polarity.
void TIM_OC2PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 2 polarity.
uint32_t TIM_GetCapture2(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 2 value.
#define IS_TIM_OCNIDLE_STATE(STATE)
uint16_t TIM_OCNIdleState
#define IS_TIM_TRIGGER_SELECTION(SELECTION)
void TIM_OC4PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 4 polarity.
void TIM_SelectSlaveMode(TIM_TypeDef *TIMx, uint16_t TIM_SlaveMode)
Selects the TIMx Slave Mode.
#define TIM_OCPolarity_High
ITStatus TIM_GetITStatus(TIM_TypeDef *TIMx, uint16_t TIM_IT)
Checks whether the TIM interrupt has occurred or not.
#define RCC_APB1Periph_TIM6
#define TIM_BreakPolarity_Low
#define RCC_APB2Periph_TIM10
void TIM_TimeBaseInit(TIM_TypeDef *TIMx, TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
Initializes the TIMx Time Base Unit peripheral according to the specified parameters in the TIM_TimeB...
void TIM_SetIC1Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 1 prescaler.
void TIM_SetCompare2(TIM_TypeDef *TIMx, uint32_t Compare2)
Sets the TIMx Capture Compare2 Register value.
#define IS_TIM_LIST4_PERIPH(PERIPH)
void TIM_PrescalerConfig(TIM_TypeDef *TIMx, uint16_t Prescaler, uint16_t TIM_PSCReloadMode)
Configures the TIMx Prescaler.
void TIM_ClearOC3Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF3 signal on an external event.
#define TIM_OCIdleState_Reset
#define TIM_UpdateSource_Global
#define IS_TIM_LIST6_PERIPH(TIMx)
#define IS_TIM_OC_POLARITY(POLARITY)
#define IS_TIM_OUTPUT_STATE(STATE)
#define IS_TIM_DMA_BASE(BASE)
uint32_t TIM_GetCounter(TIM_TypeDef *TIMx)
Gets the TIMx Counter value.
void TIM_CCxNCmd(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
Enables or disables the TIM Capture Compare Channel xN.
void TIM_ETRConfig(TIM_TypeDef *TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
Configures the TIMx External Trigger (ETR).
void TIM_SetIC2Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 2 prescaler.
TIM Output Compare Init structure definition.
void TIM_OC3PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR3.
#define IS_TIM_MSM_STATE(STATE)
void TIM_ETRClockMode1Config(TIM_TypeDef *TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
Configures the External clock Mode1.
uint32_t TIM_GetCapture4(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 4 value.
void TIM_OC3Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel3 according to the specified parameters in the TIM_OCInitStruct.
BDTR structure definition.
#define IS_TIM_OCIDLE_STATE(STATE)
#define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION)
#define TIM_CounterMode_Up
#define IS_TIM_OPM_MODE(MODE)
#define RCC_APB2Periph_TIM8
void TIM_SetCompare4(TIM_TypeDef *TIMx, uint32_t Compare4)
Sets the TIMx Capture Compare4 Register value.
void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables the TIM peripheral Main Outputs.
#define IS_TIM_OCPRELOAD_STATE(STATE)
void TIM_GenerateEvent(TIM_TypeDef *TIMx, uint16_t TIM_EventSource)
Configures the TIMx event to be generate by software.
#define IS_TIM_OCN_POLARITY(POLARITY)
#define IS_TIM_FORCED_ACTION(ACTION)
void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF4 signal on an external event.
void TIM_SelectInputTrigger(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
Selects the Input Trigger source.
void TIM_InternalClockConfig(TIM_TypeDef *TIMx)
Configures the TIMx internal Clock.
#define IS_TIM_EXT_PRESCALER(PRESCALER)
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
Checks whether the specified TIM flag is set or not.
void TIM_OC3NPolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity)
Configures the TIMx Channel 3N polarity.
void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 3 Fast feature.