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)
145 static void TI1_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
146 uint16_t TIM_ICFilter);
147 static void TI2_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
148 uint16_t TIM_ICFilter);
149 static void TI3_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
150 uint16_t TIM_ICFilter);
151 static void TI4_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
152 uint16_t TIM_ICFilter);
203 assert_param(IS_TIM_ALL_PERIPH(TIMx));
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)
293 assert_param(IS_TIM_ALL_PERIPH(TIMx));
294 assert_param(IS_TIM_COUNTER_MODE(TIM_TimeBaseInitStruct->
TIM_CounterMode));
299 if((TIMx == TIM1) || (TIMx == TIM8)||
300 (TIMx == TIM2) || (TIMx == TIM3)||
301 (TIMx == TIM4) || (TIMx == TIM5))
304 tmpcr1 &= (uint16_t)(~(TIM_CR1_DIR | TIM_CR1_CMS));
308 if((TIMx != TIM6) && (TIMx != TIM7))
311 tmpcr1 &= (uint16_t)(~TIM_CR1_CKD);
318 TIMx->ARR = TIM_TimeBaseInitStruct->
TIM_Period ;
323 if ((TIMx == TIM1) || (TIMx == TIM8))
331 TIMx->EGR = TIM_PSCReloadMode_Immediate;
343 TIM_TimeBaseInitStruct->
TIM_Period = 0xFFFFFFFF;
363 assert_param(IS_TIM_ALL_PERIPH(TIMx));
364 assert_param(IS_TIM_PRESCALER_RELOAD(TIM_PSCReloadMode));
366 TIMx->PSC = Prescaler;
368 TIMx->EGR = TIM_PSCReloadMode;
388 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
389 assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode));
394 tmpcr1 &= (uint16_t)~(TIM_CR1_DIR | TIM_CR1_CMS);
397 tmpcr1 |= TIM_CounterMode;
412 assert_param(IS_TIM_ALL_PERIPH(TIMx));
427 assert_param(IS_TIM_ALL_PERIPH(TIMx));
430 TIMx->ARR = Autoreload;
441 assert_param(IS_TIM_ALL_PERIPH(TIMx));
455 assert_param(IS_TIM_ALL_PERIPH(TIMx));
471 assert_param(IS_TIM_ALL_PERIPH(TIMx));
472 assert_param(IS_FUNCTIONAL_STATE(NewState));
474 if (NewState != DISABLE)
477 TIMx->CR1 |= TIM_CR1_UDIS;
482 TIMx->CR1 &= (uint16_t)~TIM_CR1_UDIS;
500 assert_param(IS_TIM_ALL_PERIPH(TIMx));
501 assert_param(IS_TIM_UPDATE_SOURCE(TIM_UpdateSource));
506 TIMx->CR1 |= TIM_CR1_URS;
511 TIMx->CR1 &= (uint16_t)~TIM_CR1_URS;
525 assert_param(IS_TIM_ALL_PERIPH(TIMx));
526 assert_param(IS_FUNCTIONAL_STATE(NewState));
528 if (NewState != DISABLE)
531 TIMx->CR1 |= TIM_CR1_ARPE;
536 TIMx->CR1 &= (uint16_t)~TIM_CR1_ARPE;
552 assert_param(IS_TIM_ALL_PERIPH(TIMx));
553 assert_param(IS_TIM_OPM_MODE(TIM_OPMode));
556 TIMx->CR1 &= (uint16_t)~TIM_CR1_OPM;
559 TIMx->CR1 |= TIM_OPMode;
575 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
576 assert_param(IS_TIM_CKD_DIV(TIM_CKD));
579 TIMx->CR1 &= (uint16_t)(~TIM_CR1_CKD);
582 TIMx->CR1 |= TIM_CKD;
592 void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState)
595 assert_param(IS_TIM_ALL_PERIPH(TIMx));
596 assert_param(IS_FUNCTIONAL_STATE(NewState));
598 if (NewState != DISABLE)
601 TIMx->CR1 |= TIM_CR1_CEN;
606 TIMx->CR1 &= (uint16_t)~TIM_CR1_CEN;
675 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
678 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
679 assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->
TIM_OCMode));
681 assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->
TIM_OCPolarity));
684 TIMx->CCER &= (uint16_t)~TIM_CCER_CC1E;
687 tmpccer = TIMx->CCER;
692 tmpccmrx = TIMx->CCMR1;
695 tmpccmrx &= (uint16_t)~TIM_CCMR1_OC1M;
696 tmpccmrx &= (uint16_t)~TIM_CCMR1_CC1S;
701 tmpccer &= (uint16_t)~TIM_CCER_CC1P;
708 if((TIMx == TIM1) || (TIMx == TIM8))
716 tmpccer &= (uint16_t)~TIM_CCER_CC1NP;
720 tmpccer &= (uint16_t)~TIM_CCER_CC1NE;
725 tmpcr2 &= (uint16_t)~TIM_CR2_OIS1;
726 tmpcr2 &= (uint16_t)~TIM_CR2_OIS1N;
736 TIMx->CCMR1 = tmpccmrx;
739 TIMx->CCR1 = TIM_OCInitStruct->
TIM_Pulse;
742 TIMx->CCER = tmpccer;
756 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
759 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
760 assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->
TIM_OCMode));
762 assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->
TIM_OCPolarity));
765 TIMx->CCER &= (uint16_t)~TIM_CCER_CC2E;
768 tmpccer = TIMx->CCER;
773 tmpccmrx = TIMx->CCMR1;
776 tmpccmrx &= (uint16_t)~TIM_CCMR1_OC2M;
777 tmpccmrx &= (uint16_t)~TIM_CCMR1_CC2S;
780 tmpccmrx |= (uint16_t)(TIM_OCInitStruct->
TIM_OCMode << 8);
783 tmpccer &= (uint16_t)~TIM_CCER_CC2P;
790 if((TIMx == TIM1) || (TIMx == TIM8))
798 tmpccer &= (uint16_t)~TIM_CCER_CC2NP;
802 tmpccer &= (uint16_t)~TIM_CCER_CC2NE;
807 tmpcr2 &= (uint16_t)~TIM_CR2_OIS2;
808 tmpcr2 &= (uint16_t)~TIM_CR2_OIS2N;
818 TIMx->CCMR1 = tmpccmrx;
821 TIMx->CCR2 = TIM_OCInitStruct->
TIM_Pulse;
824 TIMx->CCER = tmpccer;
837 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
840 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
841 assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->
TIM_OCMode));
843 assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->
TIM_OCPolarity));
846 TIMx->CCER &= (uint16_t)~TIM_CCER_CC3E;
849 tmpccer = TIMx->CCER;
854 tmpccmrx = TIMx->CCMR2;
857 tmpccmrx &= (uint16_t)~TIM_CCMR2_OC3M;
858 tmpccmrx &= (uint16_t)~TIM_CCMR2_CC3S;
863 tmpccer &= (uint16_t)~TIM_CCER_CC3P;
870 if((TIMx == TIM1) || (TIMx == TIM8))
878 tmpccer &= (uint16_t)~TIM_CCER_CC3NP;
882 tmpccer &= (uint16_t)~TIM_CCER_CC3NE;
887 tmpcr2 &= (uint16_t)~TIM_CR2_OIS3;
888 tmpcr2 &= (uint16_t)~TIM_CR2_OIS3N;
898 TIMx->CCMR2 = tmpccmrx;
901 TIMx->CCR3 = TIM_OCInitStruct->
TIM_Pulse;
904 TIMx->CCER = tmpccer;
917 uint16_t tmpccmrx = 0, tmpccer = 0, tmpcr2 = 0;
920 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
921 assert_param(IS_TIM_OC_MODE(TIM_OCInitStruct->
TIM_OCMode));
923 assert_param(IS_TIM_OC_POLARITY(TIM_OCInitStruct->
TIM_OCPolarity));
926 TIMx->CCER &= (uint16_t)~TIM_CCER_CC4E;
929 tmpccer = TIMx->CCER;
934 tmpccmrx = TIMx->CCMR2;
937 tmpccmrx &= (uint16_t)~TIM_CCMR2_OC4M;
938 tmpccmrx &= (uint16_t)~TIM_CCMR2_CC4S;
941 tmpccmrx |= (uint16_t)(TIM_OCInitStruct->
TIM_OCMode << 8);
944 tmpccer &= (uint16_t)~TIM_CCER_CC4P;
951 if((TIMx == TIM1) || (TIMx == TIM8))
955 tmpcr2 &=(uint16_t) ~TIM_CR2_OIS4;
963 TIMx->CCMR2 = tmpccmrx;
966 TIMx->CCR4 = TIM_OCInitStruct->
TIM_Pulse;
969 TIMx->CCER = tmpccer;
981 TIM_OCInitStruct->
TIM_OCMode = TIM_OCMode_Timing;
984 TIM_OCInitStruct->
TIM_Pulse = 0x00000000;
1020 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1021 assert_param(IS_TIM_CHANNEL(TIM_Channel));
1022 assert_param(IS_TIM_OCM(TIM_OCMode));
1024 tmp = (uint32_t) TIMx;
1027 tmp1 = CCER_CCE_SET << (uint16_t)TIM_Channel;
1030 TIMx->CCER &= (uint16_t) ~tmp1;
1032 if((TIM_Channel == TIM_Channel_1) ||(TIM_Channel == TIM_Channel_3))
1034 tmp += (TIM_Channel>>1);
1037 *(__IO uint32_t *) tmp &= CCMR_OC13M_MASK;
1040 *(__IO uint32_t *) tmp |= TIM_OCMode;
1044 tmp += (uint16_t)(TIM_Channel - (uint16_t)4)>> (uint16_t)1;
1047 *(__IO uint32_t *) tmp &= CCMR_OC24M_MASK;
1050 *(__IO uint32_t *) tmp |= (uint16_t)(TIM_OCMode << 8);
1063 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1066 TIMx->CCR1 = Compare1;
1079 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1082 TIMx->CCR2 = Compare2;
1094 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1097 TIMx->CCR3 = Compare3;
1109 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1112 TIMx->CCR4 = Compare4;
1126 uint16_t tmpccmr1 = 0;
1129 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1130 assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
1131 tmpccmr1 = TIMx->CCMR1;
1134 tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC1M;
1137 tmpccmr1 |= TIM_ForcedAction;
1140 TIMx->CCMR1 = tmpccmr1;
1155 uint16_t tmpccmr1 = 0;
1158 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1159 assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
1160 tmpccmr1 = TIMx->CCMR1;
1163 tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC2M;
1166 tmpccmr1 |= (uint16_t)(TIM_ForcedAction << 8);
1169 TIMx->CCMR1 = tmpccmr1;
1183 uint16_t tmpccmr2 = 0;
1186 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1187 assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
1189 tmpccmr2 = TIMx->CCMR2;
1192 tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC3M;
1195 tmpccmr2 |= TIM_ForcedAction;
1198 TIMx->CCMR2 = tmpccmr2;
1212 uint16_t tmpccmr2 = 0;
1215 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1216 assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
1217 tmpccmr2 = TIMx->CCMR2;
1220 tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC4M;
1223 tmpccmr2 |= (uint16_t)(TIM_ForcedAction << 8);
1226 TIMx->CCMR2 = tmpccmr2;
1240 uint16_t tmpccmr1 = 0;
1243 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1244 assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
1246 tmpccmr1 = TIMx->CCMR1;
1249 tmpccmr1 &= (uint16_t)(~TIM_CCMR1_OC1PE);
1252 tmpccmr1 |= TIM_OCPreload;
1255 TIMx->CCMR1 = tmpccmr1;
1270 uint16_t tmpccmr1 = 0;
1273 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1274 assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
1276 tmpccmr1 = TIMx->CCMR1;
1279 tmpccmr1 &= (uint16_t)(~TIM_CCMR1_OC2PE);
1282 tmpccmr1 |= (uint16_t)(TIM_OCPreload << 8);
1285 TIMx->CCMR1 = tmpccmr1;
1299 uint16_t tmpccmr2 = 0;
1302 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1303 assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
1305 tmpccmr2 = TIMx->CCMR2;
1308 tmpccmr2 &= (uint16_t)(~TIM_CCMR2_OC3PE);
1311 tmpccmr2 |= TIM_OCPreload;
1314 TIMx->CCMR2 = tmpccmr2;
1328 uint16_t tmpccmr2 = 0;
1331 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1332 assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
1334 tmpccmr2 = TIMx->CCMR2;
1337 tmpccmr2 &= (uint16_t)(~TIM_CCMR2_OC4PE);
1340 tmpccmr2 |= (uint16_t)(TIM_OCPreload << 8);
1343 TIMx->CCMR2 = tmpccmr2;
1357 uint16_t tmpccmr1 = 0;
1360 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1361 assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
1364 tmpccmr1 = TIMx->CCMR1;
1367 tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC1FE;
1370 tmpccmr1 |= TIM_OCFast;
1373 TIMx->CCMR1 = tmpccmr1;
1388 uint16_t tmpccmr1 = 0;
1391 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1392 assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
1395 tmpccmr1 = TIMx->CCMR1;
1398 tmpccmr1 &= (uint16_t)(~TIM_CCMR1_OC2FE);
1401 tmpccmr1 |= (uint16_t)(TIM_OCFast << 8);
1404 TIMx->CCMR1 = tmpccmr1;
1418 uint16_t tmpccmr2 = 0;
1421 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1422 assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
1425 tmpccmr2 = TIMx->CCMR2;
1428 tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC3FE;
1431 tmpccmr2 |= TIM_OCFast;
1434 TIMx->CCMR2 = tmpccmr2;
1448 uint16_t tmpccmr2 = 0;
1451 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1452 assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
1455 tmpccmr2 = TIMx->CCMR2;
1458 tmpccmr2 &= (uint16_t)(~TIM_CCMR2_OC4FE);
1461 tmpccmr2 |= (uint16_t)(TIM_OCFast << 8);
1464 TIMx->CCMR2 = tmpccmr2;
1478 uint16_t tmpccmr1 = 0;
1481 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1482 assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
1484 tmpccmr1 = TIMx->CCMR1;
1487 tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC1CE;
1490 tmpccmr1 |= TIM_OCClear;
1493 TIMx->CCMR1 = tmpccmr1;
1508 uint16_t tmpccmr1 = 0;
1511 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1512 assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
1514 tmpccmr1 = TIMx->CCMR1;
1517 tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC2CE;
1520 tmpccmr1 |= (uint16_t)(TIM_OCClear << 8);
1523 TIMx->CCMR1 = tmpccmr1;
1537 uint16_t tmpccmr2 = 0;
1540 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1541 assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
1543 tmpccmr2 = TIMx->CCMR2;
1546 tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC3CE;
1549 tmpccmr2 |= TIM_OCClear;
1552 TIMx->CCMR2 = tmpccmr2;
1566 uint16_t tmpccmr2 = 0;
1569 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1570 assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
1572 tmpccmr2 = TIMx->CCMR2;
1575 tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC4CE;
1578 tmpccmr2 |= (uint16_t)(TIM_OCClear << 8);
1581 TIMx->CCMR2 = tmpccmr2;
1595 uint16_t tmpccer = 0;
1598 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1599 assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity));
1601 tmpccer = TIMx->CCER;
1604 tmpccer &= (uint16_t)(~TIM_CCER_CC1P);
1605 tmpccer |= TIM_OCPolarity;
1608 TIMx->CCER = tmpccer;
1622 uint16_t tmpccer = 0;
1624 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
1625 assert_param(IS_TIM_OCN_POLARITY(TIM_OCNPolarity));
1627 tmpccer = TIMx->CCER;
1630 tmpccer &= (uint16_t)~TIM_CCER_CC1NP;
1631 tmpccer |= TIM_OCNPolarity;
1634 TIMx->CCER = tmpccer;
1649 uint16_t tmpccer = 0;
1652 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1653 assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity));
1655 tmpccer = TIMx->CCER;
1658 tmpccer &= (uint16_t)(~TIM_CCER_CC2P);
1659 tmpccer |= (uint16_t)(TIM_OCPolarity << 4);
1662 TIMx->CCER = tmpccer;
1676 uint16_t tmpccer = 0;
1679 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
1680 assert_param(IS_TIM_OCN_POLARITY(TIM_OCNPolarity));
1682 tmpccer = TIMx->CCER;
1685 tmpccer &= (uint16_t)~TIM_CCER_CC2NP;
1686 tmpccer |= (uint16_t)(TIM_OCNPolarity << 4);
1689 TIMx->CCER = tmpccer;
1703 uint16_t tmpccer = 0;
1706 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1707 assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity));
1709 tmpccer = TIMx->CCER;
1712 tmpccer &= (uint16_t)~TIM_CCER_CC3P;
1713 tmpccer |= (uint16_t)(TIM_OCPolarity << 8);
1716 TIMx->CCER = tmpccer;
1730 uint16_t tmpccer = 0;
1733 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
1734 assert_param(IS_TIM_OCN_POLARITY(TIM_OCNPolarity));
1736 tmpccer = TIMx->CCER;
1739 tmpccer &= (uint16_t)~TIM_CCER_CC3NP;
1740 tmpccer |= (uint16_t)(TIM_OCNPolarity << 8);
1743 TIMx->CCER = tmpccer;
1757 uint16_t tmpccer = 0;
1760 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1761 assert_param(IS_TIM_OC_POLARITY(TIM_OCPolarity));
1763 tmpccer = TIMx->CCER;
1766 tmpccer &= (uint16_t)~TIM_CCER_CC4P;
1767 tmpccer |= (uint16_t)(TIM_OCPolarity << 12);
1770 TIMx->CCER = tmpccer;
1786 void TIM_CCxCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx)
1791 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1792 assert_param(IS_TIM_CHANNEL(TIM_Channel));
1793 assert_param(IS_TIM_CCX(TIM_CCx));
1795 tmp = CCER_CCE_SET << TIM_Channel;
1798 TIMx->CCER &= (uint16_t)~ tmp;
1801 TIMx->CCER |= (uint16_t)(TIM_CCx << TIM_Channel);
1816 void TIM_CCxNCmd(TIM_TypeDef* TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN)
1821 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
1822 assert_param(IS_TIM_COMPLEMENTARY_CHANNEL(TIM_Channel));
1823 assert_param(IS_TIM_CCXN(TIM_CCxN));
1825 tmp = CCER_CCNE_SET << TIM_Channel;
1828 TIMx->CCER &= (uint16_t) ~tmp;
1831 TIMx->CCER |= (uint16_t)(TIM_CCxN << TIM_Channel);
1903 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
1904 assert_param(IS_TIM_IC_POLARITY(TIM_ICInitStruct->
TIM_ICPolarity));
1907 assert_param(IS_TIM_IC_FILTER(TIM_ICInitStruct->
TIM_ICFilter));
1909 if (TIM_ICInitStruct->
TIM_Channel == TIM_Channel_1)
1918 else if (TIM_ICInitStruct->
TIM_Channel == TIM_Channel_2)
1921 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1928 else if (TIM_ICInitStruct->
TIM_Channel == TIM_Channel_3)
1931 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1941 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
1977 uint16_t icoppositepolarity = TIM_ICPolarity_Rising;
1981 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
1986 icoppositepolarity = TIM_ICPolarity_Falling;
1990 icoppositepolarity = TIM_ICPolarity_Rising;
2001 if (TIM_ICInitStruct->
TIM_Channel == TIM_Channel_1)
2035 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
2050 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
2064 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2078 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2098 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
2099 assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC));
2102 TIMx->CCMR1 &= (uint16_t)~TIM_CCMR1_IC1PSC;
2105 TIMx->CCMR1 |= TIM_ICPSC;
2123 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
2124 assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC));
2127 TIMx->CCMR1 &= (uint16_t)~TIM_CCMR1_IC2PSC;
2130 TIMx->CCMR1 |= (uint16_t)(TIM_ICPSC << 8);
2147 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2148 assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC));
2151 TIMx->CCMR2 &= (uint16_t)~TIM_CCMR2_IC3PSC;
2154 TIMx->CCMR2 |= TIM_ICPSC;
2171 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2172 assert_param(IS_TIM_IC_PRESCALER(TIM_ICPSC));
2175 TIMx->CCMR2 &= (uint16_t)~TIM_CCMR2_IC4PSC;
2178 TIMx->CCMR2 |= (uint16_t)(TIM_ICPSC << 8);
2224 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
2225 assert_param(IS_TIM_OSSR_STATE(TIM_BDTRInitStruct->
TIM_OSSRState));
2226 assert_param(IS_TIM_OSSI_STATE(TIM_BDTRInitStruct->
TIM_OSSIState));
2227 assert_param(IS_TIM_LOCK_LEVEL(TIM_BDTRInitStruct->
TIM_LOCKLevel));
2228 assert_param(IS_TIM_BREAK_STATE(TIM_BDTRInitStruct->
TIM_Break));
2253 TIM_BDTRInitStruct->
TIM_Break = TIM_Break_Disable;
2268 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
2269 assert_param(IS_FUNCTIONAL_STATE(NewState));
2271 if (NewState != DISABLE)
2274 TIMx->BDTR |= TIM_BDTR_MOE;
2279 TIMx->BDTR &= (uint16_t)~TIM_BDTR_MOE;
2293 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
2294 assert_param(IS_FUNCTIONAL_STATE(NewState));
2296 if (NewState != DISABLE)
2299 TIMx->CR2 |= TIM_CR2_CCUS;
2304 TIMx->CR2 &= (uint16_t)~TIM_CR2_CCUS;
2318 assert_param(IS_TIM_LIST4_PERIPH(TIMx));
2319 assert_param(IS_FUNCTIONAL_STATE(NewState));
2320 if (NewState != DISABLE)
2323 TIMx->CR2 |= TIM_CR2_CCPC;
2328 TIMx->CR2 &= (uint16_t)~TIM_CR2_CCPC;
2372 void TIM_ITConfig(TIM_TypeDef* TIMx, uint16_t TIM_IT, FunctionalState NewState)
2375 assert_param(IS_TIM_ALL_PERIPH(TIMx));
2376 assert_param(IS_TIM_IT(TIM_IT));
2377 assert_param(IS_FUNCTIONAL_STATE(NewState));
2379 if (NewState != DISABLE)
2382 TIMx->DIER |= TIM_IT;
2387 TIMx->DIER &= (uint16_t)~TIM_IT;
2413 assert_param(IS_TIM_ALL_PERIPH(TIMx));
2414 assert_param(IS_TIM_EVENT_SOURCE(TIM_EventSource));
2417 TIMx->EGR = TIM_EventSource;
2445 ITStatus bitstatus = RESET;
2447 assert_param(IS_TIM_ALL_PERIPH(TIMx));
2448 assert_param(IS_TIM_GET_FLAG(TIM_FLAG));
2451 if ((TIMx->SR & TIM_FLAG) != (uint16_t)RESET)
2488 assert_param(IS_TIM_ALL_PERIPH(TIMx));
2491 TIMx->SR = (uint16_t)~TIM_FLAG;
2515 ITStatus bitstatus = RESET;
2516 uint16_t itstatus = 0x0, itenable = 0x0;
2518 assert_param(IS_TIM_ALL_PERIPH(TIMx));
2519 assert_param(IS_TIM_GET_IT(TIM_IT));
2521 itstatus = TIMx->SR & TIM_IT;
2523 itenable = TIMx->DIER & TIM_IT;
2524 if ((itstatus != (uint16_t)RESET) && (itenable != (uint16_t)RESET))
2557 assert_param(IS_TIM_ALL_PERIPH(TIMx));
2560 TIMx->SR = (uint16_t)~TIM_IT;
2591 void TIM_DMAConfig(TIM_TypeDef* TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength)
2594 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2595 assert_param(IS_TIM_DMA_BASE(TIM_DMABase));
2596 assert_param(IS_TIM_DMA_LENGTH(TIM_DMABurstLength));
2599 TIMx->DCR = TIM_DMABase | TIM_DMABurstLength;
2618 void TIM_DMACmd(TIM_TypeDef* TIMx, uint16_t TIM_DMASource, FunctionalState NewState)
2621 assert_param(IS_TIM_LIST5_PERIPH(TIMx));
2622 assert_param(IS_TIM_DMA_SOURCE(TIM_DMASource));
2623 assert_param(IS_FUNCTIONAL_STATE(NewState));
2625 if (NewState != DISABLE)
2628 TIMx->DIER |= TIM_DMASource;
2633 TIMx->DIER &= (uint16_t)~TIM_DMASource;
2647 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2648 assert_param(IS_FUNCTIONAL_STATE(NewState));
2650 if (NewState != DISABLE)
2653 TIMx->CR2 |= TIM_CR2_CCDS;
2658 TIMx->CR2 &= (uint16_t)~TIM_CR2_CCDS;
2686 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
2689 TIMx->SMCR &= (uint16_t)~TIM_SMCR_SMS;
2707 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
2708 assert_param(IS_TIM_INTERNAL_TRIGGER_SELECTION(TIM_InputTriggerSource));
2714 TIMx->SMCR |= TIM_SlaveMode_External1;
2735 uint16_t TIM_ICPolarity, uint16_t ICFilter)
2738 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
2739 assert_param(IS_TIM_IC_POLARITY(TIM_ICPolarity));
2740 assert_param(IS_TIM_IC_FILTER(ICFilter));
2743 if (TIM_TIxExternalCLKSource == TIM_TIxExternalCLK1Source_TI2)
2754 TIMx->SMCR |= TIM_SlaveMode_External1;
2775 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
2777 uint16_t tmpsmcr = 0;
2780 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2781 assert_param(IS_TIM_EXT_PRESCALER(TIM_ExtTRGPrescaler));
2782 assert_param(IS_TIM_EXT_POLARITY(TIM_ExtTRGPolarity));
2783 assert_param(IS_TIM_EXT_FILTER(ExtTRGFilter));
2785 TIM_ETRConfig(TIMx, TIM_ExtTRGPrescaler, TIM_ExtTRGPolarity, ExtTRGFilter);
2788 tmpsmcr = TIMx->SMCR;
2791 tmpsmcr &= (uint16_t)~TIM_SMCR_SMS;
2794 tmpsmcr |= TIM_SlaveMode_External1;
2797 tmpsmcr &= (uint16_t)~TIM_SMCR_TS;
2798 tmpsmcr |= TIM_TS_ETRF;
2801 TIMx->SMCR = tmpsmcr;
2822 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
2825 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
2826 assert_param(IS_TIM_EXT_PRESCALER(TIM_ExtTRGPrescaler));
2827 assert_param(IS_TIM_EXT_POLARITY(TIM_ExtTRGPolarity));
2828 assert_param(IS_TIM_EXT_FILTER(ExtTRGFilter));
2831 TIM_ETRConfig(TIMx, TIM_ExtTRGPrescaler, TIM_ExtTRGPolarity, ExtTRGFilter);
2834 TIMx->SMCR |= TIM_SMCR_ECE;
2894 uint16_t tmpsmcr = 0;
2897 assert_param(IS_TIM_LIST1_PERIPH(TIMx));
2898 assert_param(IS_TIM_TRIGGER_SELECTION(TIM_InputTriggerSource));
2901 tmpsmcr = TIMx->SMCR;
2904 tmpsmcr &= (uint16_t)~TIM_SMCR_TS;
2907 tmpsmcr |= TIM_InputTriggerSource;
2910 TIMx->SMCR = tmpsmcr;
2938 assert_param(IS_TIM_LIST5_PERIPH(TIMx));
2939 assert_param(IS_TIM_TRGO_SOURCE(TIM_TRGOSource));
2942 TIMx->CR2 &= (uint16_t)~TIM_CR2_MMS;
2944 TIMx->CR2 |= TIM_TRGOSource;
2962 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
2963 assert_param(IS_TIM_SLAVE_MODE(TIM_SlaveMode));
2966 TIMx->SMCR &= (uint16_t)~TIM_SMCR_SMS;
2969 TIMx->SMCR |= TIM_SlaveMode;
2985 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
2986 assert_param(IS_TIM_MSM_STATE(TIM_MasterSlaveMode));
2989 TIMx->SMCR &= (uint16_t)~TIM_SMCR_MSM;
2992 TIMx->SMCR |= TIM_MasterSlaveMode;
3013 uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
3015 uint16_t tmpsmcr = 0;
3018 assert_param(IS_TIM_LIST3_PERIPH(TIMx));
3019 assert_param(IS_TIM_EXT_PRESCALER(TIM_ExtTRGPrescaler));
3020 assert_param(IS_TIM_EXT_POLARITY(TIM_ExtTRGPolarity));
3021 assert_param(IS_TIM_EXT_FILTER(ExtTRGFilter));
3023 tmpsmcr = TIMx->SMCR;
3026 tmpsmcr &= SMCR_ETR_MASK;
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;
3078 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
3079 assert_param(IS_TIM_ENCODER_MODE(TIM_EncoderMode));
3080 assert_param(IS_TIM_IC_POLARITY(TIM_IC1Polarity));
3081 assert_param(IS_TIM_IC_POLARITY(TIM_IC2Polarity));
3084 tmpsmcr = TIMx->SMCR;
3087 tmpccmr1 = TIMx->CCMR1;
3090 tmpccer = TIMx->CCER;
3093 tmpsmcr &= (uint16_t)~TIM_SMCR_SMS;
3094 tmpsmcr |= TIM_EncoderMode;
3097 tmpccmr1 &= ((uint16_t)~TIM_CCMR1_CC1S) & ((uint16_t)~TIM_CCMR1_CC2S);
3098 tmpccmr1 |= TIM_CCMR1_CC1S_0 | TIM_CCMR1_CC2S_0;
3101 tmpccer &= ((uint16_t)~TIM_CCER_CC1P) & ((uint16_t)~TIM_CCER_CC2P);
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;
3125 assert_param(IS_TIM_LIST2_PERIPH(TIMx));
3126 assert_param(IS_FUNCTIONAL_STATE(NewState));
3128 if (NewState != DISABLE)
3131 TIMx->CR2 |= TIM_CR2_TI1S;
3136 TIMx->CR2 &= (uint16_t)~TIM_CR2_TI1S;
3176 assert_param(IS_TIM_LIST6_PERIPH(TIMx));
3177 assert_param(IS_TIM_REMAP(TIM_Remap));
3180 TIMx->OR = TIM_Remap;
3204 static void TI1_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
3205 uint16_t TIM_ICFilter)
3207 uint16_t tmpccmr1 = 0, tmpccer = 0;
3210 TIMx->CCER &= (uint16_t)~TIM_CCER_CC1E;
3211 tmpccmr1 = TIMx->CCMR1;
3212 tmpccer = TIMx->CCER;
3215 tmpccmr1 &= ((uint16_t)~TIM_CCMR1_CC1S) & ((uint16_t)~TIM_CCMR1_IC1F);
3216 tmpccmr1 |= (uint16_t)(TIM_ICSelection | (uint16_t)(TIM_ICFilter << (uint16_t)4));
3219 tmpccer &= (uint16_t)~(TIM_CCER_CC1P | TIM_CCER_CC1NP);
3220 tmpccer |= (uint16_t)(TIM_ICPolarity | (uint16_t)TIM_CCER_CC1E);
3223 TIMx->CCMR1 = tmpccmr1;
3224 TIMx->CCER = tmpccer;
3245 static void TI2_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
3246 uint16_t TIM_ICFilter)
3248 uint16_t tmpccmr1 = 0, tmpccer = 0, tmp = 0;
3251 TIMx->CCER &= (uint16_t)~TIM_CCER_CC2E;
3252 tmpccmr1 = TIMx->CCMR1;
3253 tmpccer = TIMx->CCER;
3254 tmp = (uint16_t)(TIM_ICPolarity << 4);
3257 tmpccmr1 &= ((uint16_t)~TIM_CCMR1_CC2S) & ((uint16_t)~TIM_CCMR1_IC2F);
3258 tmpccmr1 |= (uint16_t)(TIM_ICFilter << 12);
3259 tmpccmr1 |= (uint16_t)(TIM_ICSelection << 8);
3262 tmpccer &= (uint16_t)~(TIM_CCER_CC2P | TIM_CCER_CC2NP);
3263 tmpccer |= (uint16_t)(tmp | (uint16_t)TIM_CCER_CC2E);
3266 TIMx->CCMR1 = tmpccmr1 ;
3267 TIMx->CCER = tmpccer;
3287 static void TI3_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
3288 uint16_t TIM_ICFilter)
3290 uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0;
3293 TIMx->CCER &= (uint16_t)~TIM_CCER_CC3E;
3294 tmpccmr2 = TIMx->CCMR2;
3295 tmpccer = TIMx->CCER;
3296 tmp = (uint16_t)(TIM_ICPolarity << 8);
3299 tmpccmr2 &= ((uint16_t)~TIM_CCMR1_CC1S) & ((uint16_t)~TIM_CCMR2_IC3F);
3300 tmpccmr2 |= (uint16_t)(TIM_ICSelection | (uint16_t)(TIM_ICFilter << (uint16_t)4));
3303 tmpccer &= (uint16_t)~(TIM_CCER_CC3P | TIM_CCER_CC3NP);
3304 tmpccer |= (uint16_t)(tmp | (uint16_t)TIM_CCER_CC3E);
3307 TIMx->CCMR2 = tmpccmr2;
3308 TIMx->CCER = tmpccer;
3328 static void TI4_Config(TIM_TypeDef* TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection,
3329 uint16_t TIM_ICFilter)
3331 uint16_t tmpccmr2 = 0, tmpccer = 0, tmp = 0;
3334 TIMx->CCER &= (uint16_t)~TIM_CCER_CC4E;
3335 tmpccmr2 = TIMx->CCMR2;
3336 tmpccer = TIMx->CCER;
3337 tmp = (uint16_t)(TIM_ICPolarity << 12);
3340 tmpccmr2 &= ((uint16_t)~TIM_CCMR1_CC2S) & ((uint16_t)~TIM_CCMR1_IC2F);
3341 tmpccmr2 |= (uint16_t)(TIM_ICSelection << 8);
3342 tmpccmr2 |= (uint16_t)(TIM_ICFilter << 12);
3345 tmpccer &= (uint16_t)~(TIM_CCER_CC4P | TIM_CCER_CC4NP);
3346 tmpccer |= (uint16_t)(tmp | (uint16_t)TIM_CCER_CC4E);
3349 TIMx->CCMR2 = tmpccmr2;
3350 TIMx->CCER = tmpccer ;
This file contains all the functions prototypes for the RCC firmware library.
uint32_t TIM_GetCapture3(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 3 value.
void TIM_OC1NPolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity)
Configures the TIMx Channel 1N polarity.
uint16_t TIM_BreakPolarity
void TIM_BDTRStructInit(TIM_BDTRInitTypeDef *TIM_BDTRInitStruct)
Fills each TIM_BDTRInitStruct member with its default value.
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...
void TIM_SetIC2Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 2 prescaler.
void TIM_ClearOC2Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF2 signal on an external event.
uint32_t TIM_GetCounter(TIM_TypeDef *TIMx)
Gets the TIMx Counter value.
void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 3 Fast feature.
void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR2.
void TIM_EncoderInterfaceConfig(TIM_TypeDef *TIMx, uint16_t TIM_EncoderMode, uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity)
Configures the TIMx Encoder Interface.
void TIM_Cmd(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables the specified TIM peripheral.
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_DMAConfig(TIM_TypeDef *TIMx, uint16_t TIM_DMABase, uint16_t TIM_DMABurstLength)
Configures the TIMx's DMA interface.
void TIM_GenerateEvent(TIM_TypeDef *TIMx, uint16_t TIM_EventSource)
Configures the TIMx event to be generate by software.
#define TIM_UpdateSource_Global
This file contains all the functions prototypes for the TIM firmware library.
ITStatus TIM_GetITStatus(TIM_TypeDef *TIMx, uint16_t TIM_IT)
Checks whether the TIM interrupt has occurred or not.
void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF4 signal on an external event.
void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables the TIM peripheral Main Outputs.
void TIM_SetCompare4(TIM_TypeDef *TIMx, uint32_t Compare4)
Sets the TIMx Capture Compare4 Register value.
void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables the TIMx's Hall sensor interface.
void TIM_SetIC3Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 3 prescaler.
void TIM_SelectSlaveMode(TIM_TypeDef *TIMx, uint16_t TIM_SlaveMode)
Selects the TIMx Slave Mode.
void TIM_OC4PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 4 polarity.
void TIM_OCStructInit(TIM_OCInitTypeDef *TIM_OCInitStruct)
Fills each TIM_OCInitStruct member with its default 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.
uint16_t TIM_OCNIdleState
void TIM_OC4FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 4 Fast feature.
uint16_t TIM_ClockDivision
void TIM_OC4Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel4 according to the specified parameters in the TIM_OCInitStruct.
void TIM_ETRClockMode2Config(TIM_TypeDef *TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
Configures the External clock Mode2.
void TIM_CCPreloadControl(TIM_TypeDef *TIMx, FunctionalState NewState)
Sets or Resets the TIM peripheral Capture Compare Preload Control bit.
void TIM_SelectCCDMA(TIM_TypeDef *TIMx, FunctionalState NewState)
Selects the TIMx peripheral Capture Compare DMA source.
void TIM_DMACmd(TIM_TypeDef *TIMx, uint16_t TIM_DMASource, FunctionalState NewState)
Enables or disables the TIMx's DMA Requests.
void TIM_SetIC4Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 4 prescaler.
void TIM_SetCompare2(TIM_TypeDef *TIMx, uint32_t Compare2)
Sets the TIMx Capture Compare2 Register value.
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
Checks whether the specified TIM flag is set or not.
void TIM_ITConfig(TIM_TypeDef *TIMx, uint16_t TIM_IT, FunctionalState NewState)
Enables or disables the specified TIM interrupts.
void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF1 signal on an external event.
void TIM_SetCompare1(TIM_TypeDef *TIMx, uint32_t Compare1)
Sets the TIMx Capture Compare1 Register value.
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode)
Specifies the TIMx Counter Mode to be used.
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_OC2NPolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity)
Configures the TIMx Channel 2N polarity.
void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 4 waveform to active or inactive level.
void TIM_ICStructInit(TIM_ICInitTypeDef *TIM_ICInitStruct)
Fills each TIM_ICInitStruct member with its default value.
void TIM_OC1PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 1 polarity.
void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
Configures the TIMx Internal Trigger as External Clock.
void TIM_OC3PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR3.
TIM Output Compare Init structure definition.
TIM Time Base Init structure definition.
void TIM_OC2PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 2 polarity.
void TIM_InternalClockConfig(TIM_TypeDef *TIMx)
Configures the TIMx internal Clock.
uint32_t TIM_GetCapture4(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 4 value.
void TIM_SetCompare3(TIM_TypeDef *TIMx, uint32_t Compare3)
Sets the TIMx Capture Compare3 Register value.
void TIM_SelectCOM(TIM_TypeDef *TIMx, FunctionalState NewState)
Selects the TIM peripheral Commutation event.
void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 1 Fast feature.
void TIM_UpdateRequestConfig(TIM_TypeDef *TIMx, uint16_t TIM_UpdateSource)
Configures the TIMx Update Request Interrupt source.
void TIM_ClearITPendingBit(TIM_TypeDef *TIMx, uint16_t TIM_IT)
Clears the TIMx's interrupt pending bits.
void TIM_RemapConfig(TIM_TypeDef *TIMx, uint16_t TIM_Remap)
Configures the TIM2, TIM5 and TIM11 Remapping input capabilities.
void TIM_PrescalerConfig(TIM_TypeDef *TIMx, uint16_t Prescaler, uint16_t TIM_PSCReloadMode)
Configures the TIMx Prescaler.
void TIM_OC2Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel2 according to the specified parameters in the TIM_OCInitStruct.
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...
uint32_t TIM_GetCapture1(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 1 value.
void TIM_SetAutoreload(TIM_TypeDef *TIMx, uint32_t Autoreload)
Sets the TIMx Autoreload Register value.
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_OC3Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel3 according to the specified parameters in the TIM_OCInitStruct.
void TIM_TIxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_TIxExternalCLKSource, uint16_t TIM_ICPolarity, uint16_t ICFilter)
Configures the TIMx Trigger as External Clock.
void TIM_OC3NPolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity)
Configures the TIMx Channel 3N polarity.
void TIM_UpdateDisableConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or Disables the TIMx Update event.
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_OC2FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
Configures the TIMx Output Compare 2 Fast feature.
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
Fills each TIM_TimeBaseInitStruct member with its default value.
void TIM_SelectOnePulseMode(TIM_TypeDef *TIMx, uint16_t TIM_OPMode)
Selects the TIMx's One Pulse Mode.
void TIM_SelectOCxM(TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode)
Selects the TIM Output Compare Mode.
void TIM_SetClockDivision(TIM_TypeDef *TIMx, uint16_t TIM_CKD)
Sets the TIMx Clock Division value.
void TIM_ClearFlag(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
Clears the TIMx's pending flags.
void TIM_SelectInputTrigger(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource)
Selects the Input Trigger source.
TIM Input Capture Init structure definition.
void TIM_OC4PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR4.
static void TI1_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter)
Configure the TI1 as Input.
void TIM_SetCounter(TIM_TypeDef *TIMx, uint32_t Counter)
Sets the TIMx Counter Register value.
void TIM_ForcedOC3Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 3 waveform to active or inactive level.
void TIM_SelectMasterSlaveMode(TIM_TypeDef *TIMx, uint16_t TIM_MasterSlaveMode)
Sets or Resets the TIMx Master/Slave Mode.
void TIM_ClearOC3Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
Clears or safeguards the OCREF3 signal on an external event.
void TIM_SetIC1Prescaler(TIM_TypeDef *TIMx, uint16_t TIM_ICPSC)
Sets the TIMx Input Capture 1 prescaler.
uint16_t TIM_AutomaticOutput
uint16_t TIM_GetPrescaler(TIM_TypeDef *TIMx)
Gets the TIMx Prescaler value.
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...
void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
Enables or disables the TIMx peripheral Preload register on CCR1.
void TIM_OC3PolarityConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity)
Configures the TIMx channel 3 polarity.
void TIM_OC1Init(TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct)
Initializes the TIMx Channel1 according to the specified parameters in the TIM_OCInitStruct.
void RCC_APB1PeriphResetCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
Forces or releases Low Speed APB (APB1) peripheral reset.
static void TI2_Config(TIM_TypeDef *TIMx, uint16_t TIM_ICPolarity, uint16_t TIM_ICSelection, uint16_t TIM_ICFilter)
Configure the TI2 as Input.
uint16_t TIM_OutputNState
void TIM_SelectOutputTrigger(TIM_TypeDef *TIMx, uint16_t TIM_TRGOSource)
Selects the TIMx Trigger Output Mode.
void TIM_DeInit(TIM_TypeDef *TIMx)
Deinitializes the TIMx peripheral registers to their default reset values.
uint32_t TIM_GetCapture2(TIM_TypeDef *TIMx)
Gets the TIMx Input Capture 2 value.
void TIM_ARRPreloadConfig(TIM_TypeDef *TIMx, FunctionalState NewState)
Enables or disables TIMx peripheral Preload register on ARR.
BDTR structure definition.
void TIM_ICInit(TIM_TypeDef *TIMx, TIM_ICInitTypeDef *TIM_ICInitStruct)
Initializes the TIM peripheral according to the specified parameters in the TIM_ICInitStruct.
uint8_t TIM_RepetitionCounter
void TIM_ForcedOC2Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 2 waveform to active or inactive level.
void RCC_APB2PeriphResetCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
Forces or releases High Speed APB (APB2) peripheral reset.
void TIM_ForcedOC1Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
Forces the TIMx output 1 waveform to active or inactive level.
void TIM_ETRClockMode1Config(TIM_TypeDef *TIMx, uint16_t TIM_ExtTRGPrescaler, uint16_t TIM_ExtTRGPolarity, uint16_t ExtTRGFilter)
Configures the External clock Mode1.