stm32f4xx_hal_tim.c
Go to the documentation of this file.
1 
185 /* Includes ------------------------------------------------------------------*/
186 #include "stm32f4xx_hal.h"
187 
197 #ifdef HAL_TIM_MODULE_ENABLED
198 
199 /* Private typedef -----------------------------------------------------------*/
200 /* Private define ------------------------------------------------------------*/
201 /* Private macro -------------------------------------------------------------*/
202 /* Private variables ---------------------------------------------------------*/
203 /* Private function prototypes -----------------------------------------------*/
207 static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
208 static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
209 static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
210 static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter);
211 static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
212  uint32_t TIM_ICFilter);
213 static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter);
214 static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
215  uint32_t TIM_ICFilter);
216 static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
217  uint32_t TIM_ICFilter);
218 static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource);
219 static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma);
220 static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma);
221 static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma);
222 static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma);
223 static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
224  TIM_SlaveConfigTypeDef *sSlaveConfig);
228 /* Exported functions --------------------------------------------------------*/
229 
266 {
267  /* Check the TIM handle allocation */
268  if (htim == NULL)
269  {
270  return HAL_ERROR;
271  }
272 
273  /* Check the parameters */
278 
279  if (htim->State == HAL_TIM_STATE_RESET)
280  {
281  /* Allocate lock resource and initialize it */
282  htim->Lock = HAL_UNLOCKED;
283 
284 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
285  /* Reset interrupt callbacks to legacy weak callbacks */
286  TIM_ResetCallback(htim);
287 
288  if (htim->Base_MspInitCallback == NULL)
289  {
290  htim->Base_MspInitCallback = HAL_TIM_Base_MspInit;
291  }
292  /* Init the low level hardware : GPIO, CLOCK, NVIC */
293  htim->Base_MspInitCallback(htim);
294 #else
295  /* Init the low level hardware : GPIO, CLOCK, NVIC */
296  HAL_TIM_Base_MspInit(htim);
297 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
298  }
299 
300  /* Set the TIM state */
301  htim->State = HAL_TIM_STATE_BUSY;
302 
303  /* Set the Time Base configuration */
304  TIM_Base_SetConfig(htim->Instance, &htim->Init);
305 
306  /* Initialize the TIM state*/
307  htim->State = HAL_TIM_STATE_READY;
308 
309  return HAL_OK;
310 }
311 
318 {
319  /* Check the parameters */
321 
322  htim->State = HAL_TIM_STATE_BUSY;
323 
324  /* Disable the TIM Peripheral Clock */
325  __HAL_TIM_DISABLE(htim);
326 
327 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
328  if (htim->Base_MspDeInitCallback == NULL)
329  {
330  htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit;
331  }
332  /* DeInit the low level hardware */
333  htim->Base_MspDeInitCallback(htim);
334 #else
335  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
337 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
338 
339  /* Change TIM state */
340  htim->State = HAL_TIM_STATE_RESET;
341 
342  /* Release Lock */
343  __HAL_UNLOCK(htim);
344 
345  return HAL_OK;
346 }
347 
353 __weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
354 {
355  /* Prevent unused argument(s) compilation warning */
356  UNUSED(htim);
357 
358  /* NOTE : This function should not be modified, when the callback is needed,
359  the HAL_TIM_Base_MspInit could be implemented in the user file
360  */
361 }
362 
368 __weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim)
369 {
370  /* Prevent unused argument(s) compilation warning */
371  UNUSED(htim);
372 
373  /* NOTE : This function should not be modified, when the callback is needed,
374  the HAL_TIM_Base_MspDeInit could be implemented in the user file
375  */
376 }
377 
378 
385 {
386  uint32_t tmpsmcr;
387 
388  /* Check the parameters */
390 
391  /* Set the TIM state */
392  htim->State = HAL_TIM_STATE_BUSY;
393 
394  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
395  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
396  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
397  {
398  __HAL_TIM_ENABLE(htim);
399  }
400 
401  /* Change the TIM state*/
402  htim->State = HAL_TIM_STATE_READY;
403 
404  /* Return function status */
405  return HAL_OK;
406 }
407 
414 {
415  /* Check the parameters */
417 
418  /* Set the TIM state */
419  htim->State = HAL_TIM_STATE_BUSY;
420 
421  /* Disable the Peripheral */
422  __HAL_TIM_DISABLE(htim);
423 
424  /* Change the TIM state*/
425  htim->State = HAL_TIM_STATE_READY;
426 
427  /* Return function status */
428  return HAL_OK;
429 }
430 
437 {
438  uint32_t tmpsmcr;
439 
440  /* Check the parameters */
442 
443  /* Enable the TIM Update interrupt */
445 
446  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
447  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
448  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
449  {
450  __HAL_TIM_ENABLE(htim);
451  }
452 
453  /* Return function status */
454  return HAL_OK;
455 }
456 
463 {
464  /* Check the parameters */
466  /* Disable the TIM Update interrupt */
468 
469  /* Disable the Peripheral */
470  __HAL_TIM_DISABLE(htim);
471 
472  /* Return function status */
473  return HAL_OK;
474 }
475 
483 HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
484 {
485  uint32_t tmpsmcr;
486 
487  /* Check the parameters */
489 
490  if (htim->State == HAL_TIM_STATE_BUSY)
491  {
492  return HAL_BUSY;
493  }
494  else if (htim->State == HAL_TIM_STATE_READY)
495  {
496  if ((pData == NULL) && (Length > 0U))
497  {
498  return HAL_ERROR;
499  }
500  else
501  {
502  htim->State = HAL_TIM_STATE_BUSY;
503  }
504  }
505  else
506  {
507  /* nothing to do */
508  }
509 
510  /* Set the DMA Period elapsed callbacks */
511  htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
512  htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt;
513 
514  /* Set the DMA error callback */
516 
517  /* Enable the DMA stream */
518  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData, (uint32_t)&htim->Instance->ARR, Length) != HAL_OK)
519  {
520  return HAL_ERROR;
521  }
522 
523  /* Enable the TIM Update DMA request */
525 
526  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
527  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
528  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
529  {
530  __HAL_TIM_ENABLE(htim);
531  }
532 
533  /* Return function status */
534  return HAL_OK;
535 }
536 
543 {
544  /* Check the parameters */
546 
547  /* Disable the TIM Update DMA request */
549 
551 
552  /* Disable the Peripheral */
553  __HAL_TIM_DISABLE(htim);
554 
555  /* Change the htim state */
556  htim->State = HAL_TIM_STATE_READY;
557 
558  /* Return function status */
559  return HAL_OK;
560 }
561 
598 {
599  /* Check the TIM handle allocation */
600  if (htim == NULL)
601  {
602  return HAL_ERROR;
603  }
604 
605  /* Check the parameters */
610 
611  if (htim->State == HAL_TIM_STATE_RESET)
612  {
613  /* Allocate lock resource and initialize it */
614  htim->Lock = HAL_UNLOCKED;
615 
616 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
617  /* Reset interrupt callbacks to legacy weak callbacks */
618  TIM_ResetCallback(htim);
619 
620  if (htim->OC_MspInitCallback == NULL)
621  {
622  htim->OC_MspInitCallback = HAL_TIM_OC_MspInit;
623  }
624  /* Init the low level hardware : GPIO, CLOCK, NVIC */
625  htim->OC_MspInitCallback(htim);
626 #else
627  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
628  HAL_TIM_OC_MspInit(htim);
629 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
630  }
631 
632  /* Set the TIM state */
633  htim->State = HAL_TIM_STATE_BUSY;
634 
635  /* Init the base time for the Output Compare */
636  TIM_Base_SetConfig(htim->Instance, &htim->Init);
637 
638  /* Initialize the TIM state*/
639  htim->State = HAL_TIM_STATE_READY;
640 
641  return HAL_OK;
642 }
643 
650 {
651  /* Check the parameters */
653 
654  htim->State = HAL_TIM_STATE_BUSY;
655 
656  /* Disable the TIM Peripheral Clock */
657  __HAL_TIM_DISABLE(htim);
658 
659 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
660  if (htim->OC_MspDeInitCallback == NULL)
661  {
662  htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit;
663  }
664  /* DeInit the low level hardware */
665  htim->OC_MspDeInitCallback(htim);
666 #else
667  /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */
668  HAL_TIM_OC_MspDeInit(htim);
669 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
670 
671  /* Change TIM state */
672  htim->State = HAL_TIM_STATE_RESET;
673 
674  /* Release Lock */
675  __HAL_UNLOCK(htim);
676 
677  return HAL_OK;
678 }
679 
685 __weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
686 {
687  /* Prevent unused argument(s) compilation warning */
688  UNUSED(htim);
689 
690  /* NOTE : This function should not be modified, when the callback is needed,
691  the HAL_TIM_OC_MspInit could be implemented in the user file
692  */
693 }
694 
700 __weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim)
701 {
702  /* Prevent unused argument(s) compilation warning */
703  UNUSED(htim);
704 
705  /* NOTE : This function should not be modified, when the callback is needed,
706  the HAL_TIM_OC_MspDeInit could be implemented in the user file
707  */
708 }
709 
722 {
723  uint32_t tmpsmcr;
724 
725  /* Check the parameters */
726  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
727 
728  /* Enable the Output compare channel */
729  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
730 
731  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
732  {
733  /* Enable the main output */
734  __HAL_TIM_MOE_ENABLE(htim);
735  }
736 
737  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
738  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
739  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
740  {
741  __HAL_TIM_ENABLE(htim);
742  }
743 
744  /* Return function status */
745  return HAL_OK;
746 }
747 
759 HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
760 {
761  /* Check the parameters */
762  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
763 
764  /* Disable the Output compare channel */
765  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
766 
767  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
768  {
769  /* Disable the Main Output */
770  __HAL_TIM_MOE_DISABLE(htim);
771  }
772 
773  /* Disable the Peripheral */
774  __HAL_TIM_DISABLE(htim);
775 
776  /* Return function status */
777  return HAL_OK;
778 }
779 
792 {
793  uint32_t tmpsmcr;
794 
795  /* Check the parameters */
796  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
797 
798  switch (Channel)
799  {
800  case TIM_CHANNEL_1:
801  {
802  /* Enable the TIM Capture/Compare 1 interrupt */
804  break;
805  }
806 
807  case TIM_CHANNEL_2:
808  {
809  /* Enable the TIM Capture/Compare 2 interrupt */
811  break;
812  }
813 
814  case TIM_CHANNEL_3:
815  {
816  /* Enable the TIM Capture/Compare 3 interrupt */
818  break;
819  }
820 
821  case TIM_CHANNEL_4:
822  {
823  /* Enable the TIM Capture/Compare 4 interrupt */
825  break;
826  }
827 
828  default:
829  break;
830  }
831 
832  /* Enable the Output compare channel */
833  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
834 
835  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
836  {
837  /* Enable the main output */
838  __HAL_TIM_MOE_ENABLE(htim);
839  }
840 
841  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
842  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
843  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
844  {
845  __HAL_TIM_ENABLE(htim);
846  }
847 
848  /* Return function status */
849  return HAL_OK;
850 }
851 
864 {
865  /* Check the parameters */
866  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
867 
868  switch (Channel)
869  {
870  case TIM_CHANNEL_1:
871  {
872  /* Disable the TIM Capture/Compare 1 interrupt */
874  break;
875  }
876 
877  case TIM_CHANNEL_2:
878  {
879  /* Disable the TIM Capture/Compare 2 interrupt */
881  break;
882  }
883 
884  case TIM_CHANNEL_3:
885  {
886  /* Disable the TIM Capture/Compare 3 interrupt */
888  break;
889  }
890 
891  case TIM_CHANNEL_4:
892  {
893  /* Disable the TIM Capture/Compare 4 interrupt */
895  break;
896  }
897 
898  default:
899  break;
900  }
901 
902  /* Disable the Output compare channel */
903  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
904 
905  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
906  {
907  /* Disable the Main Output */
908  __HAL_TIM_MOE_DISABLE(htim);
909  }
910 
911  /* Disable the Peripheral */
912  __HAL_TIM_DISABLE(htim);
913 
914  /* Return function status */
915  return HAL_OK;
916 }
917 
931 HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
932 {
933  uint32_t tmpsmcr;
934 
935  /* Check the parameters */
936  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
937 
938  if (htim->State == HAL_TIM_STATE_BUSY)
939  {
940  return HAL_BUSY;
941  }
942  else if (htim->State == HAL_TIM_STATE_READY)
943  {
944  if ((pData == NULL) && (Length > 0U))
945  {
946  return HAL_ERROR;
947  }
948  else
949  {
950  htim->State = HAL_TIM_STATE_BUSY;
951  }
952  }
953  else
954  {
955  /* nothing to do */
956  }
957 
958  switch (Channel)
959  {
960  case TIM_CHANNEL_1:
961  {
962  /* Set the DMA compare callbacks */
965 
966  /* Set the DMA error callback */
968 
969  /* Enable the DMA stream */
970  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK)
971  {
972  return HAL_ERROR;
973  }
974 
975  /* Enable the TIM Capture/Compare 1 DMA request */
977  break;
978  }
979 
980  case TIM_CHANNEL_2:
981  {
982  /* Set the DMA compare callbacks */
985 
986  /* Set the DMA error callback */
988 
989  /* Enable the DMA stream */
990  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK)
991  {
992  return HAL_ERROR;
993  }
994 
995  /* Enable the TIM Capture/Compare 2 DMA request */
997  break;
998  }
999 
1000  case TIM_CHANNEL_3:
1001  {
1002  /* Set the DMA compare callbacks */
1005 
1006  /* Set the DMA error callback */
1008 
1009  /* Enable the DMA stream */
1010  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK)
1011  {
1012  return HAL_ERROR;
1013  }
1014  /* Enable the TIM Capture/Compare 3 DMA request */
1016  break;
1017  }
1018 
1019  case TIM_CHANNEL_4:
1020  {
1021  /* Set the DMA compare callbacks */
1024 
1025  /* Set the DMA error callback */
1027 
1028  /* Enable the DMA stream */
1029  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length) != HAL_OK)
1030  {
1031  return HAL_ERROR;
1032  }
1033  /* Enable the TIM Capture/Compare 4 DMA request */
1035  break;
1036  }
1037 
1038  default:
1039  break;
1040  }
1041 
1042  /* Enable the Output compare channel */
1043  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1044 
1045  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1046  {
1047  /* Enable the main output */
1048  __HAL_TIM_MOE_ENABLE(htim);
1049  }
1050 
1051  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1052  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1053  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1054  {
1055  __HAL_TIM_ENABLE(htim);
1056  }
1057 
1058  /* Return function status */
1059  return HAL_OK;
1060 }
1061 
1074 {
1075  /* Check the parameters */
1076  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1077 
1078  switch (Channel)
1079  {
1080  case TIM_CHANNEL_1:
1081  {
1082  /* Disable the TIM Capture/Compare 1 DMA request */
1084  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
1085  break;
1086  }
1087 
1088  case TIM_CHANNEL_2:
1089  {
1090  /* Disable the TIM Capture/Compare 2 DMA request */
1092  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
1093  break;
1094  }
1095 
1096  case TIM_CHANNEL_3:
1097  {
1098  /* Disable the TIM Capture/Compare 3 DMA request */
1100  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
1101  break;
1102  }
1103 
1104  case TIM_CHANNEL_4:
1105  {
1106  /* Disable the TIM Capture/Compare 4 interrupt */
1108  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
1109  break;
1110  }
1111 
1112  default:
1113  break;
1114  }
1115 
1116  /* Disable the Output compare channel */
1117  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1118 
1119  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1120  {
1121  /* Disable the Main Output */
1122  __HAL_TIM_MOE_DISABLE(htim);
1123  }
1124 
1125  /* Disable the Peripheral */
1126  __HAL_TIM_DISABLE(htim);
1127 
1128  /* Change the htim state */
1129  htim->State = HAL_TIM_STATE_READY;
1130 
1131  /* Return function status */
1132  return HAL_OK;
1133 }
1134 
1171 {
1172  /* Check the TIM handle allocation */
1173  if (htim == NULL)
1174  {
1175  return HAL_ERROR;
1176  }
1177 
1178  /* Check the parameters */
1183 
1184  if (htim->State == HAL_TIM_STATE_RESET)
1185  {
1186  /* Allocate lock resource and initialize it */
1187  htim->Lock = HAL_UNLOCKED;
1188 
1189 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1190  /* Reset interrupt callbacks to legacy weak callbacks */
1191  TIM_ResetCallback(htim);
1192 
1193  if (htim->PWM_MspInitCallback == NULL)
1194  {
1195  htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit;
1196  }
1197  /* Init the low level hardware : GPIO, CLOCK, NVIC */
1198  htim->PWM_MspInitCallback(htim);
1199 #else
1200  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
1201  HAL_TIM_PWM_MspInit(htim);
1202 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1203  }
1204 
1205  /* Set the TIM state */
1206  htim->State = HAL_TIM_STATE_BUSY;
1207 
1208  /* Init the base time for the PWM */
1209  TIM_Base_SetConfig(htim->Instance, &htim->Init);
1210 
1211  /* Initialize the TIM state*/
1212  htim->State = HAL_TIM_STATE_READY;
1213 
1214  return HAL_OK;
1215 }
1216 
1223 {
1224  /* Check the parameters */
1226 
1227  htim->State = HAL_TIM_STATE_BUSY;
1228 
1229  /* Disable the TIM Peripheral Clock */
1230  __HAL_TIM_DISABLE(htim);
1231 
1232 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1233  if (htim->PWM_MspDeInitCallback == NULL)
1234  {
1235  htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit;
1236  }
1237  /* DeInit the low level hardware */
1238  htim->PWM_MspDeInitCallback(htim);
1239 #else
1240  /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */
1241  HAL_TIM_PWM_MspDeInit(htim);
1242 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1243 
1244  /* Change TIM state */
1245  htim->State = HAL_TIM_STATE_RESET;
1246 
1247  /* Release Lock */
1248  __HAL_UNLOCK(htim);
1249 
1250  return HAL_OK;
1251 }
1252 
1258 __weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
1259 {
1260  /* Prevent unused argument(s) compilation warning */
1261  UNUSED(htim);
1262 
1263  /* NOTE : This function should not be modified, when the callback is needed,
1264  the HAL_TIM_PWM_MspInit could be implemented in the user file
1265  */
1266 }
1267 
1273 __weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
1274 {
1275  /* Prevent unused argument(s) compilation warning */
1276  UNUSED(htim);
1277 
1278  /* NOTE : This function should not be modified, when the callback is needed,
1279  the HAL_TIM_PWM_MspDeInit could be implemented in the user file
1280  */
1281 }
1282 
1294 HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
1295 {
1296  uint32_t tmpsmcr;
1297 
1298  /* Check the parameters */
1299  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1300 
1301  /* Enable the Capture compare channel */
1302  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1303 
1304  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1305  {
1306  /* Enable the main output */
1307  __HAL_TIM_MOE_ENABLE(htim);
1308  }
1309 
1310  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1311  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1312  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1313  {
1314  __HAL_TIM_ENABLE(htim);
1315  }
1316 
1317  /* Return function status */
1318  return HAL_OK;
1319 }
1320 
1332 HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
1333 {
1334  /* Check the parameters */
1335  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1336 
1337  /* Disable the Capture compare channel */
1338  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1339 
1340  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1341  {
1342  /* Disable the Main Output */
1343  __HAL_TIM_MOE_DISABLE(htim);
1344  }
1345 
1346  /* Disable the Peripheral */
1347  __HAL_TIM_DISABLE(htim);
1348 
1349  /* Change the htim state */
1350  htim->State = HAL_TIM_STATE_READY;
1351 
1352  /* Return function status */
1353  return HAL_OK;
1354 }
1355 
1368 {
1369  uint32_t tmpsmcr;
1370  /* Check the parameters */
1371  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1372 
1373  switch (Channel)
1374  {
1375  case TIM_CHANNEL_1:
1376  {
1377  /* Enable the TIM Capture/Compare 1 interrupt */
1379  break;
1380  }
1381 
1382  case TIM_CHANNEL_2:
1383  {
1384  /* Enable the TIM Capture/Compare 2 interrupt */
1386  break;
1387  }
1388 
1389  case TIM_CHANNEL_3:
1390  {
1391  /* Enable the TIM Capture/Compare 3 interrupt */
1393  break;
1394  }
1395 
1396  case TIM_CHANNEL_4:
1397  {
1398  /* Enable the TIM Capture/Compare 4 interrupt */
1400  break;
1401  }
1402 
1403  default:
1404  break;
1405  }
1406 
1407  /* Enable the Capture compare channel */
1408  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1409 
1410  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1411  {
1412  /* Enable the main output */
1413  __HAL_TIM_MOE_ENABLE(htim);
1414  }
1415 
1416  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1417  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1418  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1419  {
1420  __HAL_TIM_ENABLE(htim);
1421  }
1422 
1423  /* Return function status */
1424  return HAL_OK;
1425 }
1426 
1439 {
1440  /* Check the parameters */
1441  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1442 
1443  switch (Channel)
1444  {
1445  case TIM_CHANNEL_1:
1446  {
1447  /* Disable the TIM Capture/Compare 1 interrupt */
1449  break;
1450  }
1451 
1452  case TIM_CHANNEL_2:
1453  {
1454  /* Disable the TIM Capture/Compare 2 interrupt */
1456  break;
1457  }
1458 
1459  case TIM_CHANNEL_3:
1460  {
1461  /* Disable the TIM Capture/Compare 3 interrupt */
1463  break;
1464  }
1465 
1466  case TIM_CHANNEL_4:
1467  {
1468  /* Disable the TIM Capture/Compare 4 interrupt */
1470  break;
1471  }
1472 
1473  default:
1474  break;
1475  }
1476 
1477  /* Disable the Capture compare channel */
1478  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1479 
1480  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1481  {
1482  /* Disable the Main Output */
1483  __HAL_TIM_MOE_DISABLE(htim);
1484  }
1485 
1486  /* Disable the Peripheral */
1487  __HAL_TIM_DISABLE(htim);
1488 
1489  /* Return function status */
1490  return HAL_OK;
1491 }
1492 
1506 HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
1507 {
1508  uint32_t tmpsmcr;
1509 
1510  /* Check the parameters */
1511  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1512 
1513  if (htim->State == HAL_TIM_STATE_BUSY)
1514  {
1515  return HAL_BUSY;
1516  }
1517  else if (htim->State == HAL_TIM_STATE_READY)
1518  {
1519  if ((pData == NULL) && (Length > 0U))
1520  {
1521  return HAL_ERROR;
1522  }
1523  else
1524  {
1525  htim->State = HAL_TIM_STATE_BUSY;
1526  }
1527  }
1528  else
1529  {
1530  /* nothing to do */
1531  }
1532 
1533  switch (Channel)
1534  {
1535  case TIM_CHANNEL_1:
1536  {
1537  /* Set the DMA compare callbacks */
1540 
1541  /* Set the DMA error callback */
1543 
1544  /* Enable the DMA stream */
1545  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK)
1546  {
1547  return HAL_ERROR;
1548  }
1549 
1550  /* Enable the TIM Capture/Compare 1 DMA request */
1552  break;
1553  }
1554 
1555  case TIM_CHANNEL_2:
1556  {
1557  /* Set the DMA compare callbacks */
1560 
1561  /* Set the DMA error callback */
1563 
1564  /* Enable the DMA stream */
1565  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK)
1566  {
1567  return HAL_ERROR;
1568  }
1569  /* Enable the TIM Capture/Compare 2 DMA request */
1571  break;
1572  }
1573 
1574  case TIM_CHANNEL_3:
1575  {
1576  /* Set the DMA compare callbacks */
1579 
1580  /* Set the DMA error callback */
1582 
1583  /* Enable the DMA stream */
1584  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK)
1585  {
1586  return HAL_ERROR;
1587  }
1588  /* Enable the TIM Output Capture/Compare 3 request */
1590  break;
1591  }
1592 
1593  case TIM_CHANNEL_4:
1594  {
1595  /* Set the DMA compare callbacks */
1598 
1599  /* Set the DMA error callback */
1601 
1602  /* Enable the DMA stream */
1603  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length) != HAL_OK)
1604  {
1605  return HAL_ERROR;
1606  }
1607  /* Enable the TIM Capture/Compare 4 DMA request */
1609  break;
1610  }
1611 
1612  default:
1613  break;
1614  }
1615 
1616  /* Enable the Capture compare channel */
1617  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1618 
1619  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1620  {
1621  /* Enable the main output */
1622  __HAL_TIM_MOE_ENABLE(htim);
1623  }
1624 
1625  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1626  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1627  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1628  {
1629  __HAL_TIM_ENABLE(htim);
1630  }
1631 
1632  /* Return function status */
1633  return HAL_OK;
1634 }
1635 
1648 {
1649  /* Check the parameters */
1650  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1651 
1652  switch (Channel)
1653  {
1654  case TIM_CHANNEL_1:
1655  {
1656  /* Disable the TIM Capture/Compare 1 DMA request */
1658  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
1659  break;
1660  }
1661 
1662  case TIM_CHANNEL_2:
1663  {
1664  /* Disable the TIM Capture/Compare 2 DMA request */
1666  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
1667  break;
1668  }
1669 
1670  case TIM_CHANNEL_3:
1671  {
1672  /* Disable the TIM Capture/Compare 3 DMA request */
1674  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
1675  break;
1676  }
1677 
1678  case TIM_CHANNEL_4:
1679  {
1680  /* Disable the TIM Capture/Compare 4 interrupt */
1682  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
1683  break;
1684  }
1685 
1686  default:
1687  break;
1688  }
1689 
1690  /* Disable the Capture compare channel */
1691  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1692 
1693  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1694  {
1695  /* Disable the Main Output */
1696  __HAL_TIM_MOE_DISABLE(htim);
1697  }
1698 
1699  /* Disable the Peripheral */
1700  __HAL_TIM_DISABLE(htim);
1701 
1702  /* Change the htim state */
1703  htim->State = HAL_TIM_STATE_READY;
1704 
1705  /* Return function status */
1706  return HAL_OK;
1707 }
1708 
1745 {
1746  /* Check the TIM handle allocation */
1747  if (htim == NULL)
1748  {
1749  return HAL_ERROR;
1750  }
1751 
1752  /* Check the parameters */
1757 
1758  if (htim->State == HAL_TIM_STATE_RESET)
1759  {
1760  /* Allocate lock resource and initialize it */
1761  htim->Lock = HAL_UNLOCKED;
1762 
1763 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1764  /* Reset interrupt callbacks to legacy weak callbacks */
1765  TIM_ResetCallback(htim);
1766 
1767  if (htim->IC_MspInitCallback == NULL)
1768  {
1769  htim->IC_MspInitCallback = HAL_TIM_IC_MspInit;
1770  }
1771  /* Init the low level hardware : GPIO, CLOCK, NVIC */
1772  htim->IC_MspInitCallback(htim);
1773 #else
1774  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
1775  HAL_TIM_IC_MspInit(htim);
1776 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1777  }
1778 
1779  /* Set the TIM state */
1780  htim->State = HAL_TIM_STATE_BUSY;
1781 
1782  /* Init the base time for the input capture */
1783  TIM_Base_SetConfig(htim->Instance, &htim->Init);
1784 
1785  /* Initialize the TIM state*/
1786  htim->State = HAL_TIM_STATE_READY;
1787 
1788  return HAL_OK;
1789 }
1790 
1797 {
1798  /* Check the parameters */
1800 
1801  htim->State = HAL_TIM_STATE_BUSY;
1802 
1803  /* Disable the TIM Peripheral Clock */
1804  __HAL_TIM_DISABLE(htim);
1805 
1806 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1807  if (htim->IC_MspDeInitCallback == NULL)
1808  {
1809  htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit;
1810  }
1811  /* DeInit the low level hardware */
1812  htim->IC_MspDeInitCallback(htim);
1813 #else
1814  /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */
1815  HAL_TIM_IC_MspDeInit(htim);
1816 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1817 
1818  /* Change TIM state */
1819  htim->State = HAL_TIM_STATE_RESET;
1820 
1821  /* Release Lock */
1822  __HAL_UNLOCK(htim);
1823 
1824  return HAL_OK;
1825 }
1826 
1832 __weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim)
1833 {
1834  /* Prevent unused argument(s) compilation warning */
1835  UNUSED(htim);
1836 
1837  /* NOTE : This function should not be modified, when the callback is needed,
1838  the HAL_TIM_IC_MspInit could be implemented in the user file
1839  */
1840 }
1841 
1847 __weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim)
1848 {
1849  /* Prevent unused argument(s) compilation warning */
1850  UNUSED(htim);
1851 
1852  /* NOTE : This function should not be modified, when the callback is needed,
1853  the HAL_TIM_IC_MspDeInit could be implemented in the user file
1854  */
1855 }
1856 
1868 HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
1869 {
1870  uint32_t tmpsmcr;
1871 
1872  /* Check the parameters */
1873  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1874 
1875  /* Enable the Input Capture channel */
1876  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1877 
1878  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1879  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1880  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1881  {
1882  __HAL_TIM_ENABLE(htim);
1883  }
1884 
1885  /* Return function status */
1886  return HAL_OK;
1887 }
1888 
1900 HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
1901 {
1902  /* Check the parameters */
1903  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1904 
1905  /* Disable the Input Capture channel */
1906  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1907 
1908  /* Disable the Peripheral */
1909  __HAL_TIM_DISABLE(htim);
1910 
1911  /* Return function status */
1912  return HAL_OK;
1913 }
1914 
1927 {
1928  uint32_t tmpsmcr;
1929 
1930  /* Check the parameters */
1931  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1932 
1933  switch (Channel)
1934  {
1935  case TIM_CHANNEL_1:
1936  {
1937  /* Enable the TIM Capture/Compare 1 interrupt */
1939  break;
1940  }
1941 
1942  case TIM_CHANNEL_2:
1943  {
1944  /* Enable the TIM Capture/Compare 2 interrupt */
1946  break;
1947  }
1948 
1949  case TIM_CHANNEL_3:
1950  {
1951  /* Enable the TIM Capture/Compare 3 interrupt */
1953  break;
1954  }
1955 
1956  case TIM_CHANNEL_4:
1957  {
1958  /* Enable the TIM Capture/Compare 4 interrupt */
1960  break;
1961  }
1962 
1963  default:
1964  break;
1965  }
1966  /* Enable the Input Capture channel */
1967  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1968 
1969  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1970  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1971  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1972  {
1973  __HAL_TIM_ENABLE(htim);
1974  }
1975 
1976  /* Return function status */
1977  return HAL_OK;
1978 }
1979 
1992 {
1993  /* Check the parameters */
1994  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1995 
1996  switch (Channel)
1997  {
1998  case TIM_CHANNEL_1:
1999  {
2000  /* Disable the TIM Capture/Compare 1 interrupt */
2002  break;
2003  }
2004 
2005  case TIM_CHANNEL_2:
2006  {
2007  /* Disable the TIM Capture/Compare 2 interrupt */
2009  break;
2010  }
2011 
2012  case TIM_CHANNEL_3:
2013  {
2014  /* Disable the TIM Capture/Compare 3 interrupt */
2016  break;
2017  }
2018 
2019  case TIM_CHANNEL_4:
2020  {
2021  /* Disable the TIM Capture/Compare 4 interrupt */
2023  break;
2024  }
2025 
2026  default:
2027  break;
2028  }
2029 
2030  /* Disable the Input Capture channel */
2031  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
2032 
2033  /* Disable the Peripheral */
2034  __HAL_TIM_DISABLE(htim);
2035 
2036  /* Return function status */
2037  return HAL_OK;
2038 }
2039 
2053 HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
2054 {
2055  uint32_t tmpsmcr;
2056 
2057  /* Check the parameters */
2058  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2060 
2061  if (htim->State == HAL_TIM_STATE_BUSY)
2062  {
2063  return HAL_BUSY;
2064  }
2065  else if (htim->State == HAL_TIM_STATE_READY)
2066  {
2067  if ((pData == NULL) && (Length > 0U))
2068  {
2069  return HAL_ERROR;
2070  }
2071  else
2072  {
2073  htim->State = HAL_TIM_STATE_BUSY;
2074  }
2075  }
2076  else
2077  {
2078  /* nothing to do */
2079  }
2080 
2081  switch (Channel)
2082  {
2083  case TIM_CHANNEL_1:
2084  {
2085  /* Set the DMA capture callbacks */
2088 
2089  /* Set the DMA error callback */
2091 
2092  /* Enable the DMA stream */
2093  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length) != HAL_OK)
2094  {
2095  return HAL_ERROR;
2096  }
2097  /* Enable the TIM Capture/Compare 1 DMA request */
2099  break;
2100  }
2101 
2102  case TIM_CHANNEL_2:
2103  {
2104  /* Set the DMA capture callbacks */
2107 
2108  /* Set the DMA error callback */
2110 
2111  /* Enable the DMA stream */
2112  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData, Length) != HAL_OK)
2113  {
2114  return HAL_ERROR;
2115  }
2116  /* Enable the TIM Capture/Compare 2 DMA request */
2118  break;
2119  }
2120 
2121  case TIM_CHANNEL_3:
2122  {
2123  /* Set the DMA capture callbacks */
2126 
2127  /* Set the DMA error callback */
2129 
2130  /* Enable the DMA stream */
2131  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->CCR3, (uint32_t)pData, Length) != HAL_OK)
2132  {
2133  return HAL_ERROR;
2134  }
2135  /* Enable the TIM Capture/Compare 3 DMA request */
2137  break;
2138  }
2139 
2140  case TIM_CHANNEL_4:
2141  {
2142  /* Set the DMA capture callbacks */
2145 
2146  /* Set the DMA error callback */
2148 
2149  /* Enable the DMA stream */
2150  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->CCR4, (uint32_t)pData, Length) != HAL_OK)
2151  {
2152  return HAL_ERROR;
2153  }
2154  /* Enable the TIM Capture/Compare 4 DMA request */
2156  break;
2157  }
2158 
2159  default:
2160  break;
2161  }
2162 
2163  /* Enable the Input Capture channel */
2164  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
2165 
2166  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
2167  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
2168  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
2169  {
2170  __HAL_TIM_ENABLE(htim);
2171  }
2172 
2173  /* Return function status */
2174  return HAL_OK;
2175 }
2176 
2189 {
2190  /* Check the parameters */
2191  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2193 
2194  switch (Channel)
2195  {
2196  case TIM_CHANNEL_1:
2197  {
2198  /* Disable the TIM Capture/Compare 1 DMA request */
2200  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
2201  break;
2202  }
2203 
2204  case TIM_CHANNEL_2:
2205  {
2206  /* Disable the TIM Capture/Compare 2 DMA request */
2208  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
2209  break;
2210  }
2211 
2212  case TIM_CHANNEL_3:
2213  {
2214  /* Disable the TIM Capture/Compare 3 DMA request */
2216  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
2217  break;
2218  }
2219 
2220  case TIM_CHANNEL_4:
2221  {
2222  /* Disable the TIM Capture/Compare 4 DMA request */
2224  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
2225  break;
2226  }
2227 
2228  default:
2229  break;
2230  }
2231 
2232  /* Disable the Input Capture channel */
2233  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
2234 
2235  /* Disable the Peripheral */
2236  __HAL_TIM_DISABLE(htim);
2237 
2238  /* Change the htim state */
2239  htim->State = HAL_TIM_STATE_READY;
2240 
2241  /* Return function status */
2242  return HAL_OK;
2243 }
2283 HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode)
2284 {
2285  /* Check the TIM handle allocation */
2286  if (htim == NULL)
2287  {
2288  return HAL_ERROR;
2289  }
2290 
2291  /* Check the parameters */
2295  assert_param(IS_TIM_OPM_MODE(OnePulseMode));
2297 
2298  if (htim->State == HAL_TIM_STATE_RESET)
2299  {
2300  /* Allocate lock resource and initialize it */
2301  htim->Lock = HAL_UNLOCKED;
2302 
2303 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2304  /* Reset interrupt callbacks to legacy weak callbacks */
2305  TIM_ResetCallback(htim);
2306 
2307  if (htim->OnePulse_MspInitCallback == NULL)
2308  {
2309  htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit;
2310  }
2311  /* Init the low level hardware : GPIO, CLOCK, NVIC */
2312  htim->OnePulse_MspInitCallback(htim);
2313 #else
2314  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
2316 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2317  }
2318 
2319  /* Set the TIM state */
2320  htim->State = HAL_TIM_STATE_BUSY;
2321 
2322  /* Configure the Time base in the One Pulse Mode */
2323  TIM_Base_SetConfig(htim->Instance, &htim->Init);
2324 
2325  /* Reset the OPM Bit */
2326  htim->Instance->CR1 &= ~TIM_CR1_OPM;
2327 
2328  /* Configure the OPM Mode */
2329  htim->Instance->CR1 |= OnePulseMode;
2330 
2331  /* Initialize the TIM state*/
2332  htim->State = HAL_TIM_STATE_READY;
2333 
2334  return HAL_OK;
2335 }
2336 
2343 {
2344  /* Check the parameters */
2346 
2347  htim->State = HAL_TIM_STATE_BUSY;
2348 
2349  /* Disable the TIM Peripheral Clock */
2350  __HAL_TIM_DISABLE(htim);
2351 
2352 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2353  if (htim->OnePulse_MspDeInitCallback == NULL)
2354  {
2355  htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit;
2356  }
2357  /* DeInit the low level hardware */
2358  htim->OnePulse_MspDeInitCallback(htim);
2359 #else
2360  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
2362 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2363 
2364  /* Change TIM state */
2365  htim->State = HAL_TIM_STATE_RESET;
2366 
2367  /* Release Lock */
2368  __HAL_UNLOCK(htim);
2369 
2370  return HAL_OK;
2371 }
2372 
2379 {
2380  /* Prevent unused argument(s) compilation warning */
2381  UNUSED(htim);
2382 
2383  /* NOTE : This function should not be modified, when the callback is needed,
2384  the HAL_TIM_OnePulse_MspInit could be implemented in the user file
2385  */
2386 }
2387 
2394 {
2395  /* Prevent unused argument(s) compilation warning */
2396  UNUSED(htim);
2397 
2398  /* NOTE : This function should not be modified, when the callback is needed,
2399  the HAL_TIM_OnePulse_MspDeInit could be implemented in the user file
2400  */
2401 }
2402 
2412 HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2413 {
2414  /* Prevent unused argument(s) compilation warning */
2415  UNUSED(OutputChannel);
2416 
2417  /* Enable the Capture compare and the Input Capture channels
2418  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2419  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2420  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2421  in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
2422 
2423  No need to enable the counter, it's enabled automatically by hardware
2424  (the counter starts in response to a stimulus and generate a pulse */
2425 
2428 
2429  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2430  {
2431  /* Enable the main output */
2432  __HAL_TIM_MOE_ENABLE(htim);
2433  }
2434 
2435  /* Return function status */
2436  return HAL_OK;
2437 }
2438 
2448 HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2449 {
2450  /* Prevent unused argument(s) compilation warning */
2451  UNUSED(OutputChannel);
2452 
2453  /* Disable the Capture compare and the Input Capture channels
2454  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2455  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2456  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2457  in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */
2458 
2461 
2462  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2463  {
2464  /* Disable the Main Output */
2465  __HAL_TIM_MOE_DISABLE(htim);
2466  }
2467 
2468  /* Disable the Peripheral */
2469  __HAL_TIM_DISABLE(htim);
2470 
2471  /* Return function status */
2472  return HAL_OK;
2473 }
2474 
2484 HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2485 {
2486  /* Prevent unused argument(s) compilation warning */
2487  UNUSED(OutputChannel);
2488 
2489  /* Enable the Capture compare and the Input Capture channels
2490  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2491  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2492  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2493  in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
2494 
2495  No need to enable the counter, it's enabled automatically by hardware
2496  (the counter starts in response to a stimulus and generate a pulse */
2497 
2498  /* Enable the TIM Capture/Compare 1 interrupt */
2500 
2501  /* Enable the TIM Capture/Compare 2 interrupt */
2503 
2506 
2507  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2508  {
2509  /* Enable the main output */
2510  __HAL_TIM_MOE_ENABLE(htim);
2511  }
2512 
2513  /* Return function status */
2514  return HAL_OK;
2515 }
2516 
2526 HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2527 {
2528  /* Prevent unused argument(s) compilation warning */
2529  UNUSED(OutputChannel);
2530 
2531  /* Disable the TIM Capture/Compare 1 interrupt */
2533 
2534  /* Disable the TIM Capture/Compare 2 interrupt */
2536 
2537  /* Disable the Capture compare and the Input Capture channels
2538  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2539  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2540  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2541  in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */
2544 
2545  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2546  {
2547  /* Disable the Main Output */
2548  __HAL_TIM_MOE_DISABLE(htim);
2549  }
2550 
2551  /* Disable the Peripheral */
2552  __HAL_TIM_DISABLE(htim);
2553 
2554  /* Return function status */
2555  return HAL_OK;
2556 }
2557 
2597 {
2598  uint32_t tmpsmcr;
2599  uint32_t tmpccmr1;
2600  uint32_t tmpccer;
2601 
2602  /* Check the TIM handle allocation */
2603  if (htim == NULL)
2604  {
2605  return HAL_ERROR;
2606  }
2607 
2608  /* Check the parameters */
2622 
2623  if (htim->State == HAL_TIM_STATE_RESET)
2624  {
2625  /* Allocate lock resource and initialize it */
2626  htim->Lock = HAL_UNLOCKED;
2627 
2628 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2629  /* Reset interrupt callbacks to legacy weak callbacks */
2630  TIM_ResetCallback(htim);
2631 
2632  if (htim->Encoder_MspInitCallback == NULL)
2633  {
2634  htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit;
2635  }
2636  /* Init the low level hardware : GPIO, CLOCK, NVIC */
2637  htim->Encoder_MspInitCallback(htim);
2638 #else
2639  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
2641 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2642  }
2643 
2644  /* Set the TIM state */
2645  htim->State = HAL_TIM_STATE_BUSY;
2646 
2647  /* Reset the SMS and ECE bits */
2648  htim->Instance->SMCR &= ~(TIM_SMCR_SMS | TIM_SMCR_ECE);
2649 
2650  /* Configure the Time base in the Encoder Mode */
2651  TIM_Base_SetConfig(htim->Instance, &htim->Init);
2652 
2653  /* Get the TIMx SMCR register value */
2654  tmpsmcr = htim->Instance->SMCR;
2655 
2656  /* Get the TIMx CCMR1 register value */
2657  tmpccmr1 = htim->Instance->CCMR1;
2658 
2659  /* Get the TIMx CCER register value */
2660  tmpccer = htim->Instance->CCER;
2661 
2662  /* Set the encoder Mode */
2663  tmpsmcr |= sConfig->EncoderMode;
2664 
2665  /* Select the Capture Compare 1 and the Capture Compare 2 as input */
2666  tmpccmr1 &= ~(TIM_CCMR1_CC1S | TIM_CCMR1_CC2S);
2667  tmpccmr1 |= (sConfig->IC1Selection | (sConfig->IC2Selection << 8U));
2668 
2669  /* Set the Capture Compare 1 and the Capture Compare 2 prescalers and filters */
2670  tmpccmr1 &= ~(TIM_CCMR1_IC1PSC | TIM_CCMR1_IC2PSC);
2671  tmpccmr1 &= ~(TIM_CCMR1_IC1F | TIM_CCMR1_IC2F);
2672  tmpccmr1 |= sConfig->IC1Prescaler | (sConfig->IC2Prescaler << 8U);
2673  tmpccmr1 |= (sConfig->IC1Filter << 4U) | (sConfig->IC2Filter << 12U);
2674 
2675  /* Set the TI1 and the TI2 Polarities */
2676  tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC2P);
2677  tmpccer &= ~(TIM_CCER_CC1NP | TIM_CCER_CC2NP);
2678  tmpccer |= sConfig->IC1Polarity | (sConfig->IC2Polarity << 4U);
2679 
2680  /* Write to TIMx SMCR */
2681  htim->Instance->SMCR = tmpsmcr;
2682 
2683  /* Write to TIMx CCMR1 */
2684  htim->Instance->CCMR1 = tmpccmr1;
2685 
2686  /* Write to TIMx CCER */
2687  htim->Instance->CCER = tmpccer;
2688 
2689  /* Initialize the TIM state*/
2690  htim->State = HAL_TIM_STATE_READY;
2691 
2692  return HAL_OK;
2693 }
2694 
2695 
2702 {
2703  /* Check the parameters */
2705 
2706  htim->State = HAL_TIM_STATE_BUSY;
2707 
2708  /* Disable the TIM Peripheral Clock */
2709  __HAL_TIM_DISABLE(htim);
2710 
2711 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2712  if (htim->Encoder_MspDeInitCallback == NULL)
2713  {
2714  htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit;
2715  }
2716  /* DeInit the low level hardware */
2717  htim->Encoder_MspDeInitCallback(htim);
2718 #else
2719  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
2721 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2722 
2723  /* Change TIM state */
2724  htim->State = HAL_TIM_STATE_RESET;
2725 
2726  /* Release Lock */
2727  __HAL_UNLOCK(htim);
2728 
2729  return HAL_OK;
2730 }
2731 
2737 __weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
2738 {
2739  /* Prevent unused argument(s) compilation warning */
2740  UNUSED(htim);
2741 
2742  /* NOTE : This function should not be modified, when the callback is needed,
2743  the HAL_TIM_Encoder_MspInit could be implemented in the user file
2744  */
2745 }
2746 
2753 {
2754  /* Prevent unused argument(s) compilation warning */
2755  UNUSED(htim);
2756 
2757  /* NOTE : This function should not be modified, when the callback is needed,
2758  the HAL_TIM_Encoder_MspDeInit could be implemented in the user file
2759  */
2760 }
2761 
2773 {
2774  /* Check the parameters */
2776 
2777  /* Enable the encoder interface channels */
2778  switch (Channel)
2779  {
2780  case TIM_CHANNEL_1:
2781  {
2783  break;
2784  }
2785 
2786  case TIM_CHANNEL_2:
2787  {
2789  break;
2790  }
2791 
2792  default :
2793  {
2796  break;
2797  }
2798  }
2799  /* Enable the Peripheral */
2800  __HAL_TIM_ENABLE(htim);
2801 
2802  /* Return function status */
2803  return HAL_OK;
2804 }
2805 
2817 {
2818  /* Check the parameters */
2820 
2821  /* Disable the Input Capture channels 1 and 2
2822  (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
2823  switch (Channel)
2824  {
2825  case TIM_CHANNEL_1:
2826  {
2828  break;
2829  }
2830 
2831  case TIM_CHANNEL_2:
2832  {
2834  break;
2835  }
2836 
2837  default :
2838  {
2841  break;
2842  }
2843  }
2844 
2845  /* Disable the Peripheral */
2846  __HAL_TIM_DISABLE(htim);
2847 
2848  /* Return function status */
2849  return HAL_OK;
2850 }
2851 
2863 {
2864  /* Check the parameters */
2866 
2867  /* Enable the encoder interface channels */
2868  /* Enable the capture compare Interrupts 1 and/or 2 */
2869  switch (Channel)
2870  {
2871  case TIM_CHANNEL_1:
2872  {
2875  break;
2876  }
2877 
2878  case TIM_CHANNEL_2:
2879  {
2882  break;
2883  }
2884 
2885  default :
2886  {
2891  break;
2892  }
2893  }
2894 
2895  /* Enable the Peripheral */
2896  __HAL_TIM_ENABLE(htim);
2897 
2898  /* Return function status */
2899  return HAL_OK;
2900 }
2901 
2913 {
2914  /* Check the parameters */
2916 
2917  /* Disable the Input Capture channels 1 and 2
2918  (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
2919  if (Channel == TIM_CHANNEL_1)
2920  {
2922 
2923  /* Disable the capture compare Interrupts 1 */
2925  }
2926  else if (Channel == TIM_CHANNEL_2)
2927  {
2929 
2930  /* Disable the capture compare Interrupts 2 */
2932  }
2933  else
2934  {
2937 
2938  /* Disable the capture compare Interrupts 1 and 2 */
2941  }
2942 
2943  /* Disable the Peripheral */
2944  __HAL_TIM_DISABLE(htim);
2945 
2946  /* Change the htim state */
2947  htim->State = HAL_TIM_STATE_READY;
2948 
2949  /* Return function status */
2950  return HAL_OK;
2951 }
2952 
2966 HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1,
2967  uint32_t *pData2, uint16_t Length)
2968 {
2969  /* Check the parameters */
2971 
2972  if (htim->State == HAL_TIM_STATE_BUSY)
2973  {
2974  return HAL_BUSY;
2975  }
2976  else if (htim->State == HAL_TIM_STATE_READY)
2977  {
2978  if ((((pData1 == NULL) || (pData2 == NULL))) && (Length > 0U))
2979  {
2980  return HAL_ERROR;
2981  }
2982  else
2983  {
2984  htim->State = HAL_TIM_STATE_BUSY;
2985  }
2986  }
2987  else
2988  {
2989  /* nothing to do */
2990  }
2991 
2992  switch (Channel)
2993  {
2994  case TIM_CHANNEL_1:
2995  {
2996  /* Set the DMA capture callbacks */
2999 
3000  /* Set the DMA error callback */
3002 
3003  /* Enable the DMA stream */
3004  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length) != HAL_OK)
3005  {
3006  return HAL_ERROR;
3007  }
3008  /* Enable the TIM Input Capture DMA request */
3010 
3011  /* Enable the Peripheral */
3012  __HAL_TIM_ENABLE(htim);
3013 
3014  /* Enable the Capture compare channel */
3016  break;
3017  }
3018 
3019  case TIM_CHANNEL_2:
3020  {
3021  /* Set the DMA capture callbacks */
3024 
3025  /* Set the DMA error callback */
3027  /* Enable the DMA stream */
3028  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length) != HAL_OK)
3029  {
3030  return HAL_ERROR;
3031  }
3032  /* Enable the TIM Input Capture DMA request */
3034 
3035  /* Enable the Peripheral */
3036  __HAL_TIM_ENABLE(htim);
3037 
3038  /* Enable the Capture compare channel */
3040  break;
3041  }
3042 
3043  case TIM_CHANNEL_ALL:
3044  {
3045  /* Set the DMA capture callbacks */
3048 
3049  /* Set the DMA error callback */
3051 
3052  /* Enable the DMA stream */
3053  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length) != HAL_OK)
3054  {
3055  return HAL_ERROR;
3056  }
3057 
3058  /* Set the DMA capture callbacks */
3061 
3062  /* Set the DMA error callback */
3064 
3065  /* Enable the DMA stream */
3066  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length) != HAL_OK)
3067  {
3068  return HAL_ERROR;
3069  }
3070  /* Enable the Peripheral */
3071  __HAL_TIM_ENABLE(htim);
3072 
3073  /* Enable the Capture compare channel */
3076 
3077  /* Enable the TIM Input Capture DMA request */
3079  /* Enable the TIM Input Capture DMA request */
3081  break;
3082  }
3083 
3084  default:
3085  break;
3086  }
3087  /* Return function status */
3088  return HAL_OK;
3089 }
3090 
3102 {
3103  /* Check the parameters */
3105 
3106  /* Disable the Input Capture channels 1 and 2
3107  (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
3108  if (Channel == TIM_CHANNEL_1)
3109  {
3111 
3112  /* Disable the capture compare DMA Request 1 */
3114  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
3115  }
3116  else if (Channel == TIM_CHANNEL_2)
3117  {
3119 
3120  /* Disable the capture compare DMA Request 2 */
3122  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
3123  }
3124  else
3125  {
3128 
3129  /* Disable the capture compare DMA Request 1 and 2 */
3132  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
3133  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
3134  }
3135 
3136  /* Disable the Peripheral */
3137  __HAL_TIM_DISABLE(htim);
3138 
3139  /* Change the htim state */
3140  htim->State = HAL_TIM_STATE_READY;
3141 
3142  /* Return function status */
3143  return HAL_OK;
3144 }
3145 
3168 {
3169  /* Capture compare 1 event */
3170  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC1) != RESET)
3171  {
3173  {
3174  {
3177 
3178  /* Input capture event */
3179  if ((htim->Instance->CCMR1 & TIM_CCMR1_CC1S) != 0x00U)
3180  {
3181 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3182  htim->IC_CaptureCallback(htim);
3183 #else
3185 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3186  }
3187  /* Output compare event */
3188  else
3189  {
3190 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3191  htim->OC_DelayElapsedCallback(htim);
3192  htim->PWM_PulseFinishedCallback(htim);
3193 #else
3196 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3197  }
3199  }
3200  }
3201  }
3202  /* Capture compare 2 event */
3203  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC2) != RESET)
3204  {
3206  {
3209  /* Input capture event */
3210  if ((htim->Instance->CCMR1 & TIM_CCMR1_CC2S) != 0x00U)
3211  {
3212 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3213  htim->IC_CaptureCallback(htim);
3214 #else
3216 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3217  }
3218  /* Output compare event */
3219  else
3220  {
3221 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3222  htim->OC_DelayElapsedCallback(htim);
3223  htim->PWM_PulseFinishedCallback(htim);
3224 #else
3227 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3228  }
3230  }
3231  }
3232  /* Capture compare 3 event */
3233  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC3) != RESET)
3234  {
3236  {
3239  /* Input capture event */
3240  if ((htim->Instance->CCMR2 & TIM_CCMR2_CC3S) != 0x00U)
3241  {
3242 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3243  htim->IC_CaptureCallback(htim);
3244 #else
3246 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3247  }
3248  /* Output compare event */
3249  else
3250  {
3251 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3252  htim->OC_DelayElapsedCallback(htim);
3253  htim->PWM_PulseFinishedCallback(htim);
3254 #else
3257 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3258  }
3260  }
3261  }
3262  /* Capture compare 4 event */
3263  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC4) != RESET)
3264  {
3266  {
3269  /* Input capture event */
3270  if ((htim->Instance->CCMR2 & TIM_CCMR2_CC4S) != 0x00U)
3271  {
3272 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3273  htim->IC_CaptureCallback(htim);
3274 #else
3276 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3277  }
3278  /* Output compare event */
3279  else
3280  {
3281 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3282  htim->OC_DelayElapsedCallback(htim);
3283  htim->PWM_PulseFinishedCallback(htim);
3284 #else
3287 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3288  }
3290  }
3291  }
3292  /* TIM Update event */
3294  {
3296  {
3298 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3299  htim->PeriodElapsedCallback(htim);
3300 #else
3302 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3303  }
3304  }
3305  /* TIM Break input event */
3306  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET)
3307  {
3309  {
3311 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3312  htim->BreakCallback(htim);
3313 #else
3315 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3316  }
3317  }
3318  /* TIM Trigger detection event */
3320  {
3322  {
3324 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3325  htim->TriggerCallback(htim);
3326 #else
3328 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3329  }
3330  }
3331  /* TIM commutation event */
3332  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET)
3333  {
3335  {
3337 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3338  htim->CommutationCallback(htim);
3339 #else
3341 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3342  }
3343  }
3344 }
3345 
3383  TIM_OC_InitTypeDef *sConfig,
3384  uint32_t Channel)
3385 {
3386  /* Check the parameters */
3387  assert_param(IS_TIM_CHANNELS(Channel));
3388  assert_param(IS_TIM_OC_MODE(sConfig->OCMode));
3390 
3391  /* Process Locked */
3392  __HAL_LOCK(htim);
3393 
3394  htim->State = HAL_TIM_STATE_BUSY;
3395 
3396  switch (Channel)
3397  {
3398  case TIM_CHANNEL_1:
3399  {
3400  /* Check the parameters */
3402 
3403  /* Configure the TIM Channel 1 in Output Compare */
3404  TIM_OC1_SetConfig(htim->Instance, sConfig);
3405  break;
3406  }
3407 
3408  case TIM_CHANNEL_2:
3409  {
3410  /* Check the parameters */
3412 
3413  /* Configure the TIM Channel 2 in Output Compare */
3414  TIM_OC2_SetConfig(htim->Instance, sConfig);
3415  break;
3416  }
3417 
3418  case TIM_CHANNEL_3:
3419  {
3420  /* Check the parameters */
3422 
3423  /* Configure the TIM Channel 3 in Output Compare */
3424  TIM_OC3_SetConfig(htim->Instance, sConfig);
3425  break;
3426  }
3427 
3428  case TIM_CHANNEL_4:
3429  {
3430  /* Check the parameters */
3432 
3433  /* Configure the TIM Channel 4 in Output Compare */
3434  TIM_OC4_SetConfig(htim->Instance, sConfig);
3435  break;
3436  }
3437 
3438  default:
3439  break;
3440  }
3441 
3442  htim->State = HAL_TIM_STATE_READY;
3443 
3444  __HAL_UNLOCK(htim);
3445 
3446  return HAL_OK;
3447 }
3448 
3463 {
3464  /* Check the parameters */
3470 
3471  /* Process Locked */
3472  __HAL_LOCK(htim);
3473 
3474  htim->State = HAL_TIM_STATE_BUSY;
3475 
3476  if (Channel == TIM_CHANNEL_1)
3477  {
3478  /* TI1 Configuration */
3480  sConfig->ICPolarity,
3481  sConfig->ICSelection,
3482  sConfig->ICFilter);
3483 
3484  /* Reset the IC1PSC Bits */
3485  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
3486 
3487  /* Set the IC1PSC value */
3488  htim->Instance->CCMR1 |= sConfig->ICPrescaler;
3489  }
3490  else if (Channel == TIM_CHANNEL_2)
3491  {
3492  /* TI2 Configuration */
3494 
3495  TIM_TI2_SetConfig(htim->Instance,
3496  sConfig->ICPolarity,
3497  sConfig->ICSelection,
3498  sConfig->ICFilter);
3499 
3500  /* Reset the IC2PSC Bits */
3501  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC;
3502 
3503  /* Set the IC2PSC value */
3504  htim->Instance->CCMR1 |= (sConfig->ICPrescaler << 8U);
3505  }
3506  else if (Channel == TIM_CHANNEL_3)
3507  {
3508  /* TI3 Configuration */
3510 
3511  TIM_TI3_SetConfig(htim->Instance,
3512  sConfig->ICPolarity,
3513  sConfig->ICSelection,
3514  sConfig->ICFilter);
3515 
3516  /* Reset the IC3PSC Bits */
3517  htim->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC;
3518 
3519  /* Set the IC3PSC value */
3520  htim->Instance->CCMR2 |= sConfig->ICPrescaler;
3521  }
3522  else
3523  {
3524  /* TI4 Configuration */
3526 
3527  TIM_TI4_SetConfig(htim->Instance,
3528  sConfig->ICPolarity,
3529  sConfig->ICSelection,
3530  sConfig->ICFilter);
3531 
3532  /* Reset the IC4PSC Bits */
3533  htim->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC;
3534 
3535  /* Set the IC4PSC value */
3536  htim->Instance->CCMR2 |= (sConfig->ICPrescaler << 8U);
3537  }
3538 
3539  htim->State = HAL_TIM_STATE_READY;
3540 
3541  __HAL_UNLOCK(htim);
3542 
3543  return HAL_OK;
3544 }
3545 
3560  TIM_OC_InitTypeDef *sConfig,
3561  uint32_t Channel)
3562 {
3563  /* Check the parameters */
3564  assert_param(IS_TIM_CHANNELS(Channel));
3565  assert_param(IS_TIM_PWM_MODE(sConfig->OCMode));
3568 
3569  /* Process Locked */
3570  __HAL_LOCK(htim);
3571 
3572  htim->State = HAL_TIM_STATE_BUSY;
3573 
3574  switch (Channel)
3575  {
3576  case TIM_CHANNEL_1:
3577  {
3578  /* Check the parameters */
3580 
3581  /* Configure the Channel 1 in PWM mode */
3582  TIM_OC1_SetConfig(htim->Instance, sConfig);
3583 
3584  /* Set the Preload enable bit for channel1 */
3585  htim->Instance->CCMR1 |= TIM_CCMR1_OC1PE;
3586 
3587  /* Configure the Output Fast mode */
3588  htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE;
3589  htim->Instance->CCMR1 |= sConfig->OCFastMode;
3590  break;
3591  }
3592 
3593  case TIM_CHANNEL_2:
3594  {
3595  /* Check the parameters */
3597 
3598  /* Configure the Channel 2 in PWM mode */
3599  TIM_OC2_SetConfig(htim->Instance, sConfig);
3600 
3601  /* Set the Preload enable bit for channel2 */
3602  htim->Instance->CCMR1 |= TIM_CCMR1_OC2PE;
3603 
3604  /* Configure the Output Fast mode */
3605  htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE;
3606  htim->Instance->CCMR1 |= sConfig->OCFastMode << 8U;
3607  break;
3608  }
3609 
3610  case TIM_CHANNEL_3:
3611  {
3612  /* Check the parameters */
3614 
3615  /* Configure the Channel 3 in PWM mode */
3616  TIM_OC3_SetConfig(htim->Instance, sConfig);
3617 
3618  /* Set the Preload enable bit for channel3 */
3619  htim->Instance->CCMR2 |= TIM_CCMR2_OC3PE;
3620 
3621  /* Configure the Output Fast mode */
3622  htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE;
3623  htim->Instance->CCMR2 |= sConfig->OCFastMode;
3624  break;
3625  }
3626 
3627  case TIM_CHANNEL_4:
3628  {
3629  /* Check the parameters */
3631 
3632  /* Configure the Channel 4 in PWM mode */
3633  TIM_OC4_SetConfig(htim->Instance, sConfig);
3634 
3635  /* Set the Preload enable bit for channel4 */
3636  htim->Instance->CCMR2 |= TIM_CCMR2_OC4PE;
3637 
3638  /* Configure the Output Fast mode */
3639  htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE;
3640  htim->Instance->CCMR2 |= sConfig->OCFastMode << 8U;
3641  break;
3642  }
3643 
3644  default:
3645  break;
3646  }
3647 
3648  htim->State = HAL_TIM_STATE_READY;
3649 
3650  __HAL_UNLOCK(htim);
3651 
3652  return HAL_OK;
3653 }
3654 
3675  uint32_t OutputChannel, uint32_t InputChannel)
3676 {
3677  TIM_OC_InitTypeDef temp1;
3678 
3679  /* Check the parameters */
3680  assert_param(IS_TIM_OPM_CHANNELS(OutputChannel));
3681  assert_param(IS_TIM_OPM_CHANNELS(InputChannel));
3682 
3683  if (OutputChannel != InputChannel)
3684  {
3685  /* Process Locked */
3686  __HAL_LOCK(htim);
3687 
3688  htim->State = HAL_TIM_STATE_BUSY;
3689 
3690  /* Extract the Output compare configuration from sConfig structure */
3691  temp1.OCMode = sConfig->OCMode;
3692  temp1.Pulse = sConfig->Pulse;
3693  temp1.OCPolarity = sConfig->OCPolarity;
3694  temp1.OCNPolarity = sConfig->OCNPolarity;
3695  temp1.OCIdleState = sConfig->OCIdleState;
3696  temp1.OCNIdleState = sConfig->OCNIdleState;
3697 
3698  switch (OutputChannel)
3699  {
3700  case TIM_CHANNEL_1:
3701  {
3703 
3704  TIM_OC1_SetConfig(htim->Instance, &temp1);
3705  break;
3706  }
3707  case TIM_CHANNEL_2:
3708  {
3710 
3711  TIM_OC2_SetConfig(htim->Instance, &temp1);
3712  break;
3713  }
3714  default:
3715  break;
3716  }
3717 
3718  switch (InputChannel)
3719  {
3720  case TIM_CHANNEL_1:
3721  {
3723 
3724  TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity,
3725  sConfig->ICSelection, sConfig->ICFilter);
3726 
3727  /* Reset the IC1PSC Bits */
3728  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
3729 
3730  /* Select the Trigger source */
3731  htim->Instance->SMCR &= ~TIM_SMCR_TS;
3732  htim->Instance->SMCR |= TIM_TS_TI1FP1;
3733 
3734  /* Select the Slave Mode */
3735  htim->Instance->SMCR &= ~TIM_SMCR_SMS;
3737  break;
3738  }
3739  case TIM_CHANNEL_2:
3740  {
3742 
3743  TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity,
3744  sConfig->ICSelection, sConfig->ICFilter);
3745 
3746  /* Reset the IC2PSC Bits */
3747  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC;
3748 
3749  /* Select the Trigger source */
3750  htim->Instance->SMCR &= ~TIM_SMCR_TS;
3751  htim->Instance->SMCR |= TIM_TS_TI2FP2;
3752 
3753  /* Select the Slave Mode */
3754  htim->Instance->SMCR &= ~TIM_SMCR_SMS;
3756  break;
3757  }
3758 
3759  default:
3760  break;
3761  }
3762 
3763  htim->State = HAL_TIM_STATE_READY;
3764 
3765  __HAL_UNLOCK(htim);
3766 
3767  return HAL_OK;
3768  }
3769  else
3770  {
3771  return HAL_ERROR;
3772  }
3773 }
3774 
3813 HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc,
3814  uint32_t *BurstBuffer, uint32_t BurstLength)
3815 {
3816  /* Check the parameters */
3818  assert_param(IS_TIM_DMA_BASE(BurstBaseAddress));
3819  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
3820  assert_param(IS_TIM_DMA_LENGTH(BurstLength));
3821 
3822  if (htim->State == HAL_TIM_STATE_BUSY)
3823  {
3824  return HAL_BUSY;
3825  }
3826  else if (htim->State == HAL_TIM_STATE_READY)
3827  {
3828  if ((BurstBuffer == NULL) && (BurstLength > 0U))
3829  {
3830  return HAL_ERROR;
3831  }
3832  else
3833  {
3834  htim->State = HAL_TIM_STATE_BUSY;
3835  }
3836  }
3837  else
3838  {
3839  /* nothing to do */
3840  }
3841  switch (BurstRequestSrc)
3842  {
3843  case TIM_DMA_UPDATE:
3844  {
3845  /* Set the DMA Period elapsed callbacks */
3846  htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
3847  htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt;
3848 
3849  /* Set the DMA error callback */
3851 
3852  /* Enable the DMA stream */
3853  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)BurstBuffer, (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3854  {
3855  return HAL_ERROR;
3856  }
3857  break;
3858  }
3859  case TIM_DMA_CC1:
3860  {
3861  /* Set the DMA compare callbacks */
3864 
3865  /* Set the DMA error callback */
3867 
3868  /* Enable the DMA stream */
3869  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer,
3870  (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3871  {
3872  return HAL_ERROR;
3873  }
3874  break;
3875  }
3876  case TIM_DMA_CC2:
3877  {
3878  /* Set the DMA compare callbacks */
3881 
3882  /* Set the DMA error callback */
3884 
3885  /* Enable the DMA stream */
3886  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)BurstBuffer,
3887  (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3888  {
3889  return HAL_ERROR;
3890  }
3891  break;
3892  }
3893  case TIM_DMA_CC3:
3894  {
3895  /* Set the DMA compare callbacks */
3898 
3899  /* Set the DMA error callback */
3901 
3902  /* Enable the DMA stream */
3903  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)BurstBuffer,
3904  (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3905  {
3906  return HAL_ERROR;
3907  }
3908  break;
3909  }
3910  case TIM_DMA_CC4:
3911  {
3912  /* Set the DMA compare callbacks */
3915 
3916  /* Set the DMA error callback */
3918 
3919  /* Enable the DMA stream */
3920  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)BurstBuffer,
3921  (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3922  {
3923  return HAL_ERROR;
3924  }
3925  break;
3926  }
3927  case TIM_DMA_COM:
3928  {
3929  /* Set the DMA commutation callbacks */
3932 
3933  /* Set the DMA error callback */
3935 
3936  /* Enable the DMA stream */
3937  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)BurstBuffer,
3938  (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3939  {
3940  return HAL_ERROR;
3941  }
3942  break;
3943  }
3944  case TIM_DMA_TRIGGER:
3945  {
3946  /* Set the DMA trigger callbacks */
3947  htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt;
3948  htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt;
3949 
3950  /* Set the DMA error callback */
3952 
3953  /* Enable the DMA stream */
3954  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)BurstBuffer,
3955  (uint32_t)&htim->Instance->DMAR, ((BurstLength) >> 8U) + 1U) != HAL_OK)
3956  {
3957  return HAL_ERROR;
3958  }
3959  break;
3960  }
3961  default:
3962  break;
3963  }
3964  /* configure the DMA Burst Mode */
3965  htim->Instance->DCR = (BurstBaseAddress | BurstLength);
3966 
3967  /* Enable the TIM DMA Request */
3968  __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc);
3969 
3970  htim->State = HAL_TIM_STATE_READY;
3971 
3972  /* Return function status */
3973  return HAL_OK;
3974 }
3975 
3982 HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
3983 {
3984  HAL_StatusTypeDef status = HAL_OK;
3985  /* Check the parameters */
3986  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
3987 
3988  /* Abort the DMA transfer (at least disable the DMA stream) */
3989  switch (BurstRequestSrc)
3990  {
3991  case TIM_DMA_UPDATE:
3992  {
3993  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]);
3994  break;
3995  }
3996  case TIM_DMA_CC1:
3997  {
3998  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
3999  break;
4000  }
4001  case TIM_DMA_CC2:
4002  {
4003  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
4004  break;
4005  }
4006  case TIM_DMA_CC3:
4007  {
4008  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
4009  break;
4010  }
4011  case TIM_DMA_CC4:
4012  {
4013  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
4014  break;
4015  }
4016  case TIM_DMA_COM:
4017  {
4018  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_COMMUTATION]);
4019  break;
4020  }
4021  case TIM_DMA_TRIGGER:
4022  {
4023  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_TRIGGER]);
4024  break;
4025  }
4026  default:
4027  break;
4028  }
4029 
4030  if (HAL_OK == status)
4031  {
4032  /* Disable the TIM Update DMA request */
4033  __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc);
4034  }
4035 
4036  /* Return function status */
4037  return status;
4038 }
4039 
4078 HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
4079  uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
4080 {
4081  /* Check the parameters */
4083  assert_param(IS_TIM_DMA_BASE(BurstBaseAddress));
4084  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
4085  assert_param(IS_TIM_DMA_LENGTH(BurstLength));
4086 
4087  if (htim->State == HAL_TIM_STATE_BUSY)
4088  {
4089  return HAL_BUSY;
4090  }
4091  else if (htim->State == HAL_TIM_STATE_READY)
4092  {
4093  if ((BurstBuffer == NULL) && (BurstLength > 0U))
4094  {
4095  return HAL_ERROR;
4096  }
4097  else
4098  {
4099  htim->State = HAL_TIM_STATE_BUSY;
4100  }
4101  }
4102  else
4103  {
4104  /* nothing to do */
4105  }
4106  switch (BurstRequestSrc)
4107  {
4108  case TIM_DMA_UPDATE:
4109  {
4110  /* Set the DMA Period elapsed callbacks */
4111  htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
4112  htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt;
4113 
4114  /* Set the DMA error callback */
4116 
4117  /* Enable the DMA stream */
4118  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4119  {
4120  return HAL_ERROR;
4121  }
4122  break;
4123  }
4124  case TIM_DMA_CC1:
4125  {
4126  /* Set the DMA capture callbacks */
4129 
4130  /* Set the DMA error callback */
4132 
4133  /* Enable the DMA stream */
4134  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4135  {
4136  return HAL_ERROR;
4137  }
4138  break;
4139  }
4140  case TIM_DMA_CC2:
4141  {
4142  /* Set the DMA capture/compare callbacks */
4145 
4146  /* Set the DMA error callback */
4148 
4149  /* Enable the DMA stream */
4150  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4151  {
4152  return HAL_ERROR;
4153  }
4154  break;
4155  }
4156  case TIM_DMA_CC3:
4157  {
4158  /* Set the DMA capture callbacks */
4161 
4162  /* Set the DMA error callback */
4164 
4165  /* Enable the DMA stream */
4166  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4167  {
4168  return HAL_ERROR;
4169  }
4170  break;
4171  }
4172  case TIM_DMA_CC4:
4173  {
4174  /* Set the DMA capture callbacks */
4177 
4178  /* Set the DMA error callback */
4180 
4181  /* Enable the DMA stream */
4182  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4183  {
4184  return HAL_ERROR;
4185  }
4186  break;
4187  }
4188  case TIM_DMA_COM:
4189  {
4190  /* Set the DMA commutation callbacks */
4193 
4194  /* Set the DMA error callback */
4196 
4197  /* Enable the DMA stream */
4198  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4199  {
4200  return HAL_ERROR;
4201  }
4202  break;
4203  }
4204  case TIM_DMA_TRIGGER:
4205  {
4206  /* Set the DMA trigger callbacks */
4207  htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt;
4208  htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt;
4209 
4210  /* Set the DMA error callback */
4212 
4213  /* Enable the DMA stream */
4214  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer, ((BurstLength) >> 8U) + 1U) != HAL_OK)
4215  {
4216  return HAL_ERROR;
4217  }
4218  break;
4219  }
4220  default:
4221  break;
4222  }
4223 
4224  /* configure the DMA Burst Mode */
4225  htim->Instance->DCR = (BurstBaseAddress | BurstLength);
4226 
4227  /* Enable the TIM DMA Request */
4228  __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc);
4229 
4230  htim->State = HAL_TIM_STATE_READY;
4231 
4232  /* Return function status */
4233  return HAL_OK;
4234 }
4235 
4242 HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
4243 {
4244  HAL_StatusTypeDef status = HAL_OK;
4245  /* Check the parameters */
4246  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
4247 
4248  /* Abort the DMA transfer (at least disable the DMA stream) */
4249  switch (BurstRequestSrc)
4250  {
4251  case TIM_DMA_UPDATE:
4252  {
4253  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]);
4254  break;
4255  }
4256  case TIM_DMA_CC1:
4257  {
4258  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
4259  break;
4260  }
4261  case TIM_DMA_CC2:
4262  {
4263  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
4264  break;
4265  }
4266  case TIM_DMA_CC3:
4267  {
4268  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
4269  break;
4270  }
4271  case TIM_DMA_CC4:
4272  {
4273  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
4274  break;
4275  }
4276  case TIM_DMA_COM:
4277  {
4278  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_COMMUTATION]);
4279  break;
4280  }
4281  case TIM_DMA_TRIGGER:
4282  {
4283  status = HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_TRIGGER]);
4284  break;
4285  }
4286  default:
4287  break;
4288  }
4289 
4290  if (HAL_OK == status)
4291  {
4292  /* Disable the TIM Update DMA request */
4293  __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc);
4294  }
4295 
4296  /* Return function status */
4297  return status;
4298 }
4299 
4320 HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource)
4321 {
4322  /* Check the parameters */
4324  assert_param(IS_TIM_EVENT_SOURCE(EventSource));
4325 
4326  /* Process Locked */
4327  __HAL_LOCK(htim);
4328 
4329  /* Change the TIM state */
4330  htim->State = HAL_TIM_STATE_BUSY;
4331 
4332  /* Set the event sources */
4333  htim->Instance->EGR = EventSource;
4334 
4335  /* Change the TIM state */
4336  htim->State = HAL_TIM_STATE_READY;
4337 
4338  __HAL_UNLOCK(htim);
4339 
4340  /* Return function status */
4341  return HAL_OK;
4342 }
4343 
4358  TIM_ClearInputConfigTypeDef *sClearInputConfig,
4359  uint32_t Channel)
4360 {
4361  /* Check the parameters */
4364 
4365  /* Process Locked */
4366  __HAL_LOCK(htim);
4367 
4368  htim->State = HAL_TIM_STATE_BUSY;
4369 
4370  switch (sClearInputConfig->ClearInputSource)
4371  {
4373  {
4374  /* Clear the OCREF clear selection bit and the the ETR Bits */
4376  break;
4377  }
4378 
4380  {
4381  /* Check the parameters */
4385 
4386  /* When OCRef clear feature is used with ETR source, ETR prescaler must be off */
4387  if (sClearInputConfig->ClearInputPrescaler != TIM_CLEARINPUTPRESCALER_DIV1)
4388  {
4389  htim->State = HAL_TIM_STATE_READY;
4390  __HAL_UNLOCK(htim);
4391  return HAL_ERROR;
4392  }
4393 
4395  sClearInputConfig->ClearInputPrescaler,
4396  sClearInputConfig->ClearInputPolarity,
4397  sClearInputConfig->ClearInputFilter);
4398  break;
4399  }
4400 
4401  default:
4402  break;
4403  }
4404 
4405  switch (Channel)
4406  {
4407  case TIM_CHANNEL_1:
4408  {
4409  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
4410  {
4411  /* Enable the OCREF clear feature for Channel 1 */
4413  }
4414  else
4415  {
4416  /* Disable the OCREF clear feature for Channel 1 */
4418  }
4419  break;
4420  }
4421  case TIM_CHANNEL_2:
4422  {
4423  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
4424  {
4425  /* Enable the OCREF clear feature for Channel 2 */
4427  }
4428  else
4429  {
4430  /* Disable the OCREF clear feature for Channel 2 */
4432  }
4433  break;
4434  }
4435  case TIM_CHANNEL_3:
4436  {
4437  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
4438  {
4439  /* Enable the OCREF clear feature for Channel 3 */
4441  }
4442  else
4443  {
4444  /* Disable the OCREF clear feature for Channel 3 */
4446  }
4447  break;
4448  }
4449  case TIM_CHANNEL_4:
4450  {
4451  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
4452  {
4453  /* Enable the OCREF clear feature for Channel 4 */
4455  }
4456  else
4457  {
4458  /* Disable the OCREF clear feature for Channel 4 */
4460  }
4461  break;
4462  }
4463  default:
4464  break;
4465  }
4466 
4467  htim->State = HAL_TIM_STATE_READY;
4468 
4469  __HAL_UNLOCK(htim);
4470 
4471  return HAL_OK;
4472 }
4473 
4482 {
4483  uint32_t tmpsmcr;
4484 
4485  /* Process Locked */
4486  __HAL_LOCK(htim);
4487 
4488  htim->State = HAL_TIM_STATE_BUSY;
4489 
4490  /* Check the parameters */
4491  assert_param(IS_TIM_CLOCKSOURCE(sClockSourceConfig->ClockSource));
4492 
4493  /* Reset the SMS, TS, ECE, ETPS and ETRF bits */
4494  tmpsmcr = htim->Instance->SMCR;
4495  tmpsmcr &= ~(TIM_SMCR_SMS | TIM_SMCR_TS);
4497  htim->Instance->SMCR = tmpsmcr;
4498 
4499  switch (sClockSourceConfig->ClockSource)
4500  {
4502  {
4504  break;
4505  }
4506 
4508  {
4509  /* Check whether or not the timer instance supports external trigger input mode 1 (ETRF)*/
4511 
4512  /* Check ETR input conditioning related parameters */
4513  assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler));
4514  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
4515  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
4516 
4517  /* Configure the ETR Clock source */
4519  sClockSourceConfig->ClockPrescaler,
4520  sClockSourceConfig->ClockPolarity,
4521  sClockSourceConfig->ClockFilter);
4522 
4523  /* Select the External clock mode1 and the ETRF trigger */
4524  tmpsmcr = htim->Instance->SMCR;
4526  /* Write to TIMx SMCR */
4527  htim->Instance->SMCR = tmpsmcr;
4528  break;
4529  }
4530 
4532  {
4533  /* Check whether or not the timer instance supports external trigger input mode 2 (ETRF)*/
4535 
4536  /* Check ETR input conditioning related parameters */
4537  assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler));
4538  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
4539  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
4540 
4541  /* Configure the ETR Clock source */
4543  sClockSourceConfig->ClockPrescaler,
4544  sClockSourceConfig->ClockPolarity,
4545  sClockSourceConfig->ClockFilter);
4546  /* Enable the External clock mode2 */
4547  htim->Instance->SMCR |= TIM_SMCR_ECE;
4548  break;
4549  }
4550 
4551  case TIM_CLOCKSOURCE_TI1:
4552  {
4553  /* Check whether or not the timer instance supports external clock mode 1 */
4555 
4556  /* Check TI1 input conditioning related parameters */
4557  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
4558  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
4559 
4560  TIM_TI1_ConfigInputStage(htim->Instance,
4561  sClockSourceConfig->ClockPolarity,
4562  sClockSourceConfig->ClockFilter);
4563  TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1);
4564  break;
4565  }
4566 
4567  case TIM_CLOCKSOURCE_TI2:
4568  {
4569  /* Check whether or not the timer instance supports external clock mode 1 (ETRF)*/
4571 
4572  /* Check TI2 input conditioning related parameters */
4573  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
4574  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
4575 
4576  TIM_TI2_ConfigInputStage(htim->Instance,
4577  sClockSourceConfig->ClockPolarity,
4578  sClockSourceConfig->ClockFilter);
4579  TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI2);
4580  break;
4581  }
4582 
4583  case TIM_CLOCKSOURCE_TI1ED:
4584  {
4585  /* Check whether or not the timer instance supports external clock mode 1 */
4587 
4588  /* Check TI1 input conditioning related parameters */
4589  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
4590  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
4591 
4592  TIM_TI1_ConfigInputStage(htim->Instance,
4593  sClockSourceConfig->ClockPolarity,
4594  sClockSourceConfig->ClockFilter);
4595  TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1ED);
4596  break;
4597  }
4598 
4599  case TIM_CLOCKSOURCE_ITR0:
4600  case TIM_CLOCKSOURCE_ITR1:
4601  case TIM_CLOCKSOURCE_ITR2:
4602  case TIM_CLOCKSOURCE_ITR3:
4603  {
4604  /* Check whether or not the timer instance supports internal trigger input */
4606 
4607  TIM_ITRx_SetConfig(htim->Instance, sClockSourceConfig->ClockSource);
4608  break;
4609  }
4610 
4611  default:
4612  break;
4613  }
4614  htim->State = HAL_TIM_STATE_READY;
4615 
4616  __HAL_UNLOCK(htim);
4617 
4618  return HAL_OK;
4619 }
4620 
4633 HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection)
4634 {
4635  uint32_t tmpcr2;
4636 
4637  /* Check the parameters */
4639  assert_param(IS_TIM_TI1SELECTION(TI1_Selection));
4640 
4641  /* Get the TIMx CR2 register value */
4642  tmpcr2 = htim->Instance->CR2;
4643 
4644  /* Reset the TI1 selection */
4645  tmpcr2 &= ~TIM_CR2_TI1S;
4646 
4647  /* Set the TI1 selection */
4648  tmpcr2 |= TI1_Selection;
4649 
4650  /* Write to TIMxCR2 */
4651  htim->Instance->CR2 = tmpcr2;
4652 
4653  return HAL_OK;
4654 }
4655 
4666 {
4667  /* Check the parameters */
4669  assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode));
4671 
4672  __HAL_LOCK(htim);
4673 
4674  htim->State = HAL_TIM_STATE_BUSY;
4675 
4676  if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK)
4677  {
4678  htim->State = HAL_TIM_STATE_READY;
4679  __HAL_UNLOCK(htim);
4680  return HAL_ERROR;
4681  }
4682 
4683  /* Disable Trigger Interrupt */
4685 
4686  /* Disable Trigger DMA request */
4688 
4689  htim->State = HAL_TIM_STATE_READY;
4690 
4691  __HAL_UNLOCK(htim);
4692 
4693  return HAL_OK;
4694 }
4695 
4706  TIM_SlaveConfigTypeDef *sSlaveConfig)
4707 {
4708  /* Check the parameters */
4710  assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode));
4712 
4713  __HAL_LOCK(htim);
4714 
4715  htim->State = HAL_TIM_STATE_BUSY;
4716 
4717  if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK)
4718  {
4719  htim->State = HAL_TIM_STATE_READY;
4720  __HAL_UNLOCK(htim);
4721  return HAL_ERROR;
4722  }
4723 
4724  /* Enable Trigger Interrupt */
4726 
4727  /* Disable Trigger DMA request */
4729 
4730  htim->State = HAL_TIM_STATE_READY;
4731 
4732  __HAL_UNLOCK(htim);
4733 
4734  return HAL_OK;
4735 }
4736 
4748 uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
4749 {
4750  uint32_t tmpreg = 0U;
4751 
4752  switch (Channel)
4753  {
4754  case TIM_CHANNEL_1:
4755  {
4756  /* Check the parameters */
4758 
4759  /* Return the capture 1 value */
4760  tmpreg = htim->Instance->CCR1;
4761 
4762  break;
4763  }
4764  case TIM_CHANNEL_2:
4765  {
4766  /* Check the parameters */
4768 
4769  /* Return the capture 2 value */
4770  tmpreg = htim->Instance->CCR2;
4771 
4772  break;
4773  }
4774 
4775  case TIM_CHANNEL_3:
4776  {
4777  /* Check the parameters */
4779 
4780  /* Return the capture 3 value */
4781  tmpreg = htim->Instance->CCR3;
4782 
4783  break;
4784  }
4785 
4786  case TIM_CHANNEL_4:
4787  {
4788  /* Check the parameters */
4790 
4791  /* Return the capture 4 value */
4792  tmpreg = htim->Instance->CCR4;
4793 
4794  break;
4795  }
4796 
4797  default:
4798  break;
4799  }
4800 
4801  return tmpreg;
4802 }
4803 
4833 {
4834  /* Prevent unused argument(s) compilation warning */
4835  UNUSED(htim);
4836 
4837  /* NOTE : This function should not be modified, when the callback is needed,
4838  the HAL_TIM_PeriodElapsedCallback could be implemented in the user file
4839  */
4840 }
4841 
4848 {
4849  /* Prevent unused argument(s) compilation warning */
4850  UNUSED(htim);
4851 
4852  /* NOTE : This function should not be modified, when the callback is needed,
4853  the HAL_TIM_PeriodElapsedHalfCpltCallback could be implemented in the user file
4854  */
4855 }
4856 
4863 {
4864  /* Prevent unused argument(s) compilation warning */
4865  UNUSED(htim);
4866 
4867  /* NOTE : This function should not be modified, when the callback is needed,
4868  the HAL_TIM_OC_DelayElapsedCallback could be implemented in the user file
4869  */
4870 }
4871 
4878 {
4879  /* Prevent unused argument(s) compilation warning */
4880  UNUSED(htim);
4881 
4882  /* NOTE : This function should not be modified, when the callback is needed,
4883  the HAL_TIM_IC_CaptureCallback could be implemented in the user file
4884  */
4885 }
4886 
4893 {
4894  /* Prevent unused argument(s) compilation warning */
4895  UNUSED(htim);
4896 
4897  /* NOTE : This function should not be modified, when the callback is needed,
4898  the HAL_TIM_IC_CaptureHalfCpltCallback could be implemented in the user file
4899  */
4900 }
4901 
4908 {
4909  /* Prevent unused argument(s) compilation warning */
4910  UNUSED(htim);
4911 
4912  /* NOTE : This function should not be modified, when the callback is needed,
4913  the HAL_TIM_PWM_PulseFinishedCallback could be implemented in the user file
4914  */
4915 }
4916 
4923 {
4924  /* Prevent unused argument(s) compilation warning */
4925  UNUSED(htim);
4926 
4927  /* NOTE : This function should not be modified, when the callback is needed,
4928  the HAL_TIM_PWM_PulseFinishedHalfCpltCallback could be implemented in the user file
4929  */
4930 }
4931 
4937 __weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim)
4938 {
4939  /* Prevent unused argument(s) compilation warning */
4940  UNUSED(htim);
4941 
4942  /* NOTE : This function should not be modified, when the callback is needed,
4943  the HAL_TIM_TriggerCallback could be implemented in the user file
4944  */
4945 }
4946 
4953 {
4954  /* Prevent unused argument(s) compilation warning */
4955  UNUSED(htim);
4956 
4957  /* NOTE : This function should not be modified, when the callback is needed,
4958  the HAL_TIM_TriggerHalfCpltCallback could be implemented in the user file
4959  */
4960 }
4961 
4967 __weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
4968 {
4969  /* Prevent unused argument(s) compilation warning */
4970  UNUSED(htim);
4971 
4972  /* NOTE : This function should not be modified, when the callback is needed,
4973  the HAL_TIM_ErrorCallback could be implemented in the user file
4974  */
4975 }
4976 
4977 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
4978 
5013 HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID,
5014  pTIM_CallbackTypeDef pCallback)
5015 {
5016  HAL_StatusTypeDef status = HAL_OK;
5017 
5018  if (pCallback == NULL)
5019  {
5020  return HAL_ERROR;
5021  }
5022  /* Process locked */
5023  __HAL_LOCK(htim);
5024 
5025  if (htim->State == HAL_TIM_STATE_READY)
5026  {
5027  switch (CallbackID)
5028  {
5029  case HAL_TIM_BASE_MSPINIT_CB_ID :
5030  htim->Base_MspInitCallback = pCallback;
5031  break;
5032 
5033  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
5034  htim->Base_MspDeInitCallback = pCallback;
5035  break;
5036 
5037  case HAL_TIM_IC_MSPINIT_CB_ID :
5038  htim->IC_MspInitCallback = pCallback;
5039  break;
5040 
5041  case HAL_TIM_IC_MSPDEINIT_CB_ID :
5042  htim->IC_MspDeInitCallback = pCallback;
5043  break;
5044 
5045  case HAL_TIM_OC_MSPINIT_CB_ID :
5046  htim->OC_MspInitCallback = pCallback;
5047  break;
5048 
5049  case HAL_TIM_OC_MSPDEINIT_CB_ID :
5050  htim->OC_MspDeInitCallback = pCallback;
5051  break;
5052 
5053  case HAL_TIM_PWM_MSPINIT_CB_ID :
5054  htim->PWM_MspInitCallback = pCallback;
5055  break;
5056 
5057  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
5058  htim->PWM_MspDeInitCallback = pCallback;
5059  break;
5060 
5061  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
5062  htim->OnePulse_MspInitCallback = pCallback;
5063  break;
5064 
5065  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
5066  htim->OnePulse_MspDeInitCallback = pCallback;
5067  break;
5068 
5069  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
5070  htim->Encoder_MspInitCallback = pCallback;
5071  break;
5072 
5073  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
5074  htim->Encoder_MspDeInitCallback = pCallback;
5075  break;
5076 
5077  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
5078  htim->HallSensor_MspInitCallback = pCallback;
5079  break;
5080 
5081  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
5082  htim->HallSensor_MspDeInitCallback = pCallback;
5083  break;
5084 
5085  case HAL_TIM_PERIOD_ELAPSED_CB_ID :
5086  htim->PeriodElapsedCallback = pCallback;
5087  break;
5088 
5089  case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID :
5090  htim->PeriodElapsedHalfCpltCallback = pCallback;
5091  break;
5092 
5093  case HAL_TIM_TRIGGER_CB_ID :
5094  htim->TriggerCallback = pCallback;
5095  break;
5096 
5097  case HAL_TIM_TRIGGER_HALF_CB_ID :
5098  htim->TriggerHalfCpltCallback = pCallback;
5099  break;
5100 
5101  case HAL_TIM_IC_CAPTURE_CB_ID :
5102  htim->IC_CaptureCallback = pCallback;
5103  break;
5104 
5105  case HAL_TIM_IC_CAPTURE_HALF_CB_ID :
5106  htim->IC_CaptureHalfCpltCallback = pCallback;
5107  break;
5108 
5109  case HAL_TIM_OC_DELAY_ELAPSED_CB_ID :
5110  htim->OC_DelayElapsedCallback = pCallback;
5111  break;
5112 
5113  case HAL_TIM_PWM_PULSE_FINISHED_CB_ID :
5114  htim->PWM_PulseFinishedCallback = pCallback;
5115  break;
5116 
5117  case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID :
5118  htim->PWM_PulseFinishedHalfCpltCallback = pCallback;
5119  break;
5120 
5121  case HAL_TIM_ERROR_CB_ID :
5122  htim->ErrorCallback = pCallback;
5123  break;
5124 
5125  case HAL_TIM_COMMUTATION_CB_ID :
5126  htim->CommutationCallback = pCallback;
5127  break;
5128 
5129  case HAL_TIM_COMMUTATION_HALF_CB_ID :
5130  htim->CommutationHalfCpltCallback = pCallback;
5131  break;
5132 
5133  case HAL_TIM_BREAK_CB_ID :
5134  htim->BreakCallback = pCallback;
5135  break;
5136 
5137  default :
5138  /* Return error status */
5139  status = HAL_ERROR;
5140  break;
5141  }
5142  }
5143  else if (htim->State == HAL_TIM_STATE_RESET)
5144  {
5145  switch (CallbackID)
5146  {
5147  case HAL_TIM_BASE_MSPINIT_CB_ID :
5148  htim->Base_MspInitCallback = pCallback;
5149  break;
5150 
5151  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
5152  htim->Base_MspDeInitCallback = pCallback;
5153  break;
5154 
5155  case HAL_TIM_IC_MSPINIT_CB_ID :
5156  htim->IC_MspInitCallback = pCallback;
5157  break;
5158 
5159  case HAL_TIM_IC_MSPDEINIT_CB_ID :
5160  htim->IC_MspDeInitCallback = pCallback;
5161  break;
5162 
5163  case HAL_TIM_OC_MSPINIT_CB_ID :
5164  htim->OC_MspInitCallback = pCallback;
5165  break;
5166 
5167  case HAL_TIM_OC_MSPDEINIT_CB_ID :
5168  htim->OC_MspDeInitCallback = pCallback;
5169  break;
5170 
5171  case HAL_TIM_PWM_MSPINIT_CB_ID :
5172  htim->PWM_MspInitCallback = pCallback;
5173  break;
5174 
5175  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
5176  htim->PWM_MspDeInitCallback = pCallback;
5177  break;
5178 
5179  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
5180  htim->OnePulse_MspInitCallback = pCallback;
5181  break;
5182 
5183  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
5184  htim->OnePulse_MspDeInitCallback = pCallback;
5185  break;
5186 
5187  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
5188  htim->Encoder_MspInitCallback = pCallback;
5189  break;
5190 
5191  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
5192  htim->Encoder_MspDeInitCallback = pCallback;
5193  break;
5194 
5195  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
5196  htim->HallSensor_MspInitCallback = pCallback;
5197  break;
5198 
5199  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
5200  htim->HallSensor_MspDeInitCallback = pCallback;
5201  break;
5202 
5203  default :
5204  /* Return error status */
5205  status = HAL_ERROR;
5206  break;
5207  }
5208  }
5209  else
5210  {
5211  /* Return error status */
5212  status = HAL_ERROR;
5213  }
5214 
5215  /* Release Lock */
5216  __HAL_UNLOCK(htim);
5217 
5218  return status;
5219 }
5220 
5256 HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID)
5257 {
5258  HAL_StatusTypeDef status = HAL_OK;
5259 
5260  /* Process locked */
5261  __HAL_LOCK(htim);
5262 
5263  if (htim->State == HAL_TIM_STATE_READY)
5264  {
5265  switch (CallbackID)
5266  {
5267  case HAL_TIM_BASE_MSPINIT_CB_ID :
5268  htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; /* Legacy weak Base MspInit Callback */
5269  break;
5270 
5271  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
5272  htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; /* Legacy weak Base Msp DeInit Callback */
5273  break;
5274 
5275  case HAL_TIM_IC_MSPINIT_CB_ID :
5276  htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; /* Legacy weak IC Msp Init Callback */
5277  break;
5278 
5279  case HAL_TIM_IC_MSPDEINIT_CB_ID :
5280  htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; /* Legacy weak IC Msp DeInit Callback */
5281  break;
5282 
5283  case HAL_TIM_OC_MSPINIT_CB_ID :
5284  htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; /* Legacy weak OC Msp Init Callback */
5285  break;
5286 
5287  case HAL_TIM_OC_MSPDEINIT_CB_ID :
5288  htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; /* Legacy weak OC Msp DeInit Callback */
5289  break;
5290 
5291  case HAL_TIM_PWM_MSPINIT_CB_ID :
5292  htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; /* Legacy weak PWM Msp Init Callback */
5293  break;
5294 
5295  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
5296  htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; /* Legacy weak PWM Msp DeInit Callback */
5297  break;
5298 
5299  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
5300  htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; /* Legacy weak One Pulse Msp Init Callback */
5301  break;
5302 
5303  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
5304  htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; /* Legacy weak One Pulse Msp DeInit Callback */
5305  break;
5306 
5307  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
5308  htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; /* Legacy weak Encoder Msp Init Callback */
5309  break;
5310 
5311  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
5312  htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; /* Legacy weak Encoder Msp DeInit Callback */
5313  break;
5314 
5315  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
5316  htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; /* Legacy weak Hall Sensor Msp Init Callback */
5317  break;
5318 
5319  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
5320  htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; /* Legacy weak Hall Sensor Msp DeInit Callback */
5321  break;
5322 
5323  case HAL_TIM_PERIOD_ELAPSED_CB_ID :
5324  htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; /* Legacy weak Period Elapsed Callback */
5325  break;
5326 
5327  case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID :
5328  htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; /* Legacy weak Period Elapsed half complete Callback */
5329  break;
5330 
5331  case HAL_TIM_TRIGGER_CB_ID :
5332  htim->TriggerCallback = HAL_TIM_TriggerCallback; /* Legacy weak Trigger Callback */
5333  break;
5334 
5335  case HAL_TIM_TRIGGER_HALF_CB_ID :
5336  htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; /* Legacy weak Trigger half complete Callback */
5337  break;
5338 
5339  case HAL_TIM_IC_CAPTURE_CB_ID :
5340  htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; /* Legacy weak IC Capture Callback */
5341  break;
5342 
5343  case HAL_TIM_IC_CAPTURE_HALF_CB_ID :
5344  htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; /* Legacy weak IC Capture half complete Callback */
5345  break;
5346 
5347  case HAL_TIM_OC_DELAY_ELAPSED_CB_ID :
5348  htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; /* Legacy weak OC Delay Elapsed Callback */
5349  break;
5350 
5351  case HAL_TIM_PWM_PULSE_FINISHED_CB_ID :
5352  htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; /* Legacy weak PWM Pulse Finished Callback */
5353  break;
5354 
5355  case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID :
5356  htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; /* Legacy weak PWM Pulse Finished half complete Callback */
5357  break;
5358 
5359  case HAL_TIM_ERROR_CB_ID :
5360  htim->ErrorCallback = HAL_TIM_ErrorCallback; /* Legacy weak Error Callback */
5361  break;
5362 
5363  case HAL_TIM_COMMUTATION_CB_ID :
5364  htim->CommutationCallback = HAL_TIMEx_CommutCallback; /* Legacy weak Commutation Callback */
5365  break;
5366 
5367  case HAL_TIM_COMMUTATION_HALF_CB_ID :
5368  htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; /* Legacy weak Commutation half complete Callback */
5369  break;
5370 
5371  case HAL_TIM_BREAK_CB_ID :
5372  htim->BreakCallback = HAL_TIMEx_BreakCallback; /* Legacy weak Break Callback */
5373  break;
5374 
5375  default :
5376  /* Return error status */
5377  status = HAL_ERROR;
5378  break;
5379  }
5380  }
5381  else if (htim->State == HAL_TIM_STATE_RESET)
5382  {
5383  switch (CallbackID)
5384  {
5385  case HAL_TIM_BASE_MSPINIT_CB_ID :
5386  htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; /* Legacy weak Base MspInit Callback */
5387  break;
5388 
5389  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
5390  htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; /* Legacy weak Base Msp DeInit Callback */
5391  break;
5392 
5393  case HAL_TIM_IC_MSPINIT_CB_ID :
5394  htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; /* Legacy weak IC Msp Init Callback */
5395  break;
5396 
5397  case HAL_TIM_IC_MSPDEINIT_CB_ID :
5398  htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; /* Legacy weak IC Msp DeInit Callback */
5399  break;
5400 
5401  case HAL_TIM_OC_MSPINIT_CB_ID :
5402  htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; /* Legacy weak OC Msp Init Callback */
5403  break;
5404 
5405  case HAL_TIM_OC_MSPDEINIT_CB_ID :
5406  htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; /* Legacy weak OC Msp DeInit Callback */
5407  break;
5408 
5409  case HAL_TIM_PWM_MSPINIT_CB_ID :
5410  htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; /* Legacy weak PWM Msp Init Callback */
5411  break;
5412 
5413  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
5414  htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; /* Legacy weak PWM Msp DeInit Callback */
5415  break;
5416 
5417  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
5418  htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; /* Legacy weak One Pulse Msp Init Callback */
5419  break;
5420 
5421  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
5422  htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; /* Legacy weak One Pulse Msp DeInit Callback */
5423  break;
5424 
5425  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
5426  htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; /* Legacy weak Encoder Msp Init Callback */
5427  break;
5428 
5429  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
5430  htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; /* Legacy weak Encoder Msp DeInit Callback */
5431  break;
5432 
5433  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
5434  htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; /* Legacy weak Hall Sensor Msp Init Callback */
5435  break;
5436 
5437  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
5438  htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; /* Legacy weak Hall Sensor Msp DeInit Callback */
5439  break;
5440 
5441  default :
5442  /* Return error status */
5443  status = HAL_ERROR;
5444  break;
5445  }
5446  }
5447  else
5448  {
5449  /* Return error status */
5450  status = HAL_ERROR;
5451  }
5452 
5453  /* Release Lock */
5454  __HAL_UNLOCK(htim);
5455 
5456  return status;
5457 }
5458 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5459 
5485 {
5486  return htim->State;
5487 }
5488 
5495 {
5496  return htim->State;
5497 }
5498 
5505 {
5506  return htim->State;
5507 }
5508 
5515 {
5516  return htim->State;
5517 }
5518 
5525 {
5526  return htim->State;
5527 }
5528 
5535 {
5536  return htim->State;
5537 }
5538 
5556 void TIM_DMAError(DMA_HandleTypeDef *hdma)
5557 {
5558  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5559 
5560  htim->State = HAL_TIM_STATE_READY;
5561 
5562 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5563  htim->ErrorCallback(htim);
5564 #else
5565  HAL_TIM_ErrorCallback(htim);
5566 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5567 }
5568 
5575 {
5576  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5577 
5578  htim->State = HAL_TIM_STATE_READY;
5579 
5580  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
5581  {
5583  }
5584  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
5585  {
5587  }
5588  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
5589  {
5591  }
5592  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
5593  {
5595  }
5596  else
5597  {
5598  /* nothing to do */
5599  }
5600 
5601 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5602  htim->PWM_PulseFinishedCallback(htim);
5603 #else
5605 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5606 
5608 }
5609 
5616 {
5617  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5618 
5619  htim->State = HAL_TIM_STATE_READY;
5620 
5621  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
5622  {
5624  }
5625  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
5626  {
5628  }
5629  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
5630  {
5632  }
5633  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
5634  {
5636  }
5637  else
5638  {
5639  /* nothing to do */
5640  }
5641 
5642 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5643  htim->PWM_PulseFinishedHalfCpltCallback(htim);
5644 #else
5646 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5647 
5649 }
5650 
5657 {
5658  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5659 
5660  htim->State = HAL_TIM_STATE_READY;
5661 
5662  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
5663  {
5665  }
5666  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
5667  {
5669  }
5670  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
5671  {
5673  }
5674  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
5675  {
5677  }
5678  else
5679  {
5680  /* nothing to do */
5681  }
5682 
5683 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5684  htim->IC_CaptureCallback(htim);
5685 #else
5687 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5688 
5690 }
5691 
5698 {
5699  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5700 
5701  htim->State = HAL_TIM_STATE_READY;
5702 
5703  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
5704  {
5706  }
5707  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
5708  {
5710  }
5711  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
5712  {
5714  }
5715  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
5716  {
5718  }
5719  else
5720  {
5721  /* nothing to do */
5722  }
5723 
5724 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5725  htim->IC_CaptureHalfCpltCallback(htim);
5726 #else
5728 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5729 
5731 }
5732 
5738 static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma)
5739 {
5740  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5741 
5742  htim->State = HAL_TIM_STATE_READY;
5743 
5744 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5745  htim->PeriodElapsedCallback(htim);
5746 #else
5748 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5749 }
5750 
5756 static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma)
5757 {
5758  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5759 
5760  htim->State = HAL_TIM_STATE_READY;
5761 
5762 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5763  htim->PeriodElapsedHalfCpltCallback(htim);
5764 #else
5766 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5767 }
5768 
5774 static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma)
5775 {
5776  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5777 
5778  htim->State = HAL_TIM_STATE_READY;
5779 
5780 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5781  htim->TriggerCallback(htim);
5782 #else
5784 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5785 }
5786 
5792 static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma)
5793 {
5794  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
5795 
5796  htim->State = HAL_TIM_STATE_READY;
5797 
5798 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5799  htim->TriggerHalfCpltCallback(htim);
5800 #else
5802 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
5803 }
5804 
5811 void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
5812 {
5813  uint32_t tmpcr1;
5814  tmpcr1 = TIMx->CR1;
5815 
5816  /* Set TIM Time Base Unit parameters ---------------------------------------*/
5818  {
5819  /* Select the Counter Mode */
5820  tmpcr1 &= ~(TIM_CR1_DIR | TIM_CR1_CMS);
5821  tmpcr1 |= Structure->CounterMode;
5822  }
5823 
5825  {
5826  /* Set the clock division */
5827  tmpcr1 &= ~TIM_CR1_CKD;
5828  tmpcr1 |= (uint32_t)Structure->ClockDivision;
5829  }
5830 
5831  /* Set the auto-reload preload */
5832  MODIFY_REG(tmpcr1, TIM_CR1_ARPE, Structure->AutoReloadPreload);
5833 
5834  TIMx->CR1 = tmpcr1;
5835 
5836  /* Set the Autoreload value */
5837  TIMx->ARR = (uint32_t)Structure->Period ;
5838 
5839  /* Set the Prescaler value */
5840  TIMx->PSC = Structure->Prescaler;
5841 
5843  {
5844  /* Set the Repetition Counter value */
5845  TIMx->RCR = Structure->RepetitionCounter;
5846  }
5847 
5848  /* Generate an update event to reload the Prescaler
5849  and the repetition counter (only for advanced timer) value immediately */
5850  TIMx->EGR = TIM_EGR_UG;
5851 }
5852 
5859 static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
5860 {
5861  uint32_t tmpccmrx;
5862  uint32_t tmpccer;
5863  uint32_t tmpcr2;
5864 
5865  /* Disable the Channel 1: Reset the CC1E Bit */
5866  TIMx->CCER &= ~TIM_CCER_CC1E;
5867 
5868  /* Get the TIMx CCER register value */
5869  tmpccer = TIMx->CCER;
5870  /* Get the TIMx CR2 register value */
5871  tmpcr2 = TIMx->CR2;
5872 
5873  /* Get the TIMx CCMR1 register value */
5874  tmpccmrx = TIMx->CCMR1;
5875 
5876  /* Reset the Output Compare Mode Bits */
5877  tmpccmrx &= ~TIM_CCMR1_OC1M;
5878  tmpccmrx &= ~TIM_CCMR1_CC1S;
5879  /* Select the Output Compare Mode */
5880  tmpccmrx |= OC_Config->OCMode;
5881 
5882  /* Reset the Output Polarity level */
5883  tmpccer &= ~TIM_CCER_CC1P;
5884  /* Set the Output Compare Polarity */
5885  tmpccer |= OC_Config->OCPolarity;
5886 
5888  {
5889  /* Check parameters */
5891 
5892  /* Reset the Output N Polarity level */
5893  tmpccer &= ~TIM_CCER_CC1NP;
5894  /* Set the Output N Polarity */
5895  tmpccer |= OC_Config->OCNPolarity;
5896  /* Reset the Output N State */
5897  tmpccer &= ~TIM_CCER_CC1NE;
5898  }
5899 
5900  if (IS_TIM_BREAK_INSTANCE(TIMx))
5901  {
5902  /* Check parameters */
5905 
5906  /* Reset the Output Compare and Output Compare N IDLE State */
5907  tmpcr2 &= ~TIM_CR2_OIS1;
5908  tmpcr2 &= ~TIM_CR2_OIS1N;
5909  /* Set the Output Idle state */
5910  tmpcr2 |= OC_Config->OCIdleState;
5911  /* Set the Output N Idle state */
5912  tmpcr2 |= OC_Config->OCNIdleState;
5913  }
5914 
5915  /* Write to TIMx CR2 */
5916  TIMx->CR2 = tmpcr2;
5917 
5918  /* Write to TIMx CCMR1 */
5919  TIMx->CCMR1 = tmpccmrx;
5920 
5921  /* Set the Capture Compare Register value */
5922  TIMx->CCR1 = OC_Config->Pulse;
5923 
5924  /* Write to TIMx CCER */
5925  TIMx->CCER = tmpccer;
5926 }
5927 
5934 void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
5935 {
5936  uint32_t tmpccmrx;
5937  uint32_t tmpccer;
5938  uint32_t tmpcr2;
5939 
5940  /* Disable the Channel 2: Reset the CC2E Bit */
5941  TIMx->CCER &= ~TIM_CCER_CC2E;
5942 
5943  /* Get the TIMx CCER register value */
5944  tmpccer = TIMx->CCER;
5945  /* Get the TIMx CR2 register value */
5946  tmpcr2 = TIMx->CR2;
5947 
5948  /* Get the TIMx CCMR1 register value */
5949  tmpccmrx = TIMx->CCMR1;
5950 
5951  /* Reset the Output Compare mode and Capture/Compare selection Bits */
5952  tmpccmrx &= ~TIM_CCMR1_OC2M;
5953  tmpccmrx &= ~TIM_CCMR1_CC2S;
5954 
5955  /* Select the Output Compare Mode */
5956  tmpccmrx |= (OC_Config->OCMode << 8U);
5957 
5958  /* Reset the Output Polarity level */
5959  tmpccer &= ~TIM_CCER_CC2P;
5960  /* Set the Output Compare Polarity */
5961  tmpccer |= (OC_Config->OCPolarity << 4U);
5962 
5964  {
5966 
5967  /* Reset the Output N Polarity level */
5968  tmpccer &= ~TIM_CCER_CC2NP;
5969  /* Set the Output N Polarity */
5970  tmpccer |= (OC_Config->OCNPolarity << 4U);
5971  /* Reset the Output N State */
5972  tmpccer &= ~TIM_CCER_CC2NE;
5973 
5974  }
5975 
5976  if (IS_TIM_BREAK_INSTANCE(TIMx))
5977  {
5978  /* Check parameters */
5981 
5982  /* Reset the Output Compare and Output Compare N IDLE State */
5983  tmpcr2 &= ~TIM_CR2_OIS2;
5984  tmpcr2 &= ~TIM_CR2_OIS2N;
5985  /* Set the Output Idle state */
5986  tmpcr2 |= (OC_Config->OCIdleState << 2U);
5987  /* Set the Output N Idle state */
5988  tmpcr2 |= (OC_Config->OCNIdleState << 2U);
5989  }
5990 
5991  /* Write to TIMx CR2 */
5992  TIMx->CR2 = tmpcr2;
5993 
5994  /* Write to TIMx CCMR1 */
5995  TIMx->CCMR1 = tmpccmrx;
5996 
5997  /* Set the Capture Compare Register value */
5998  TIMx->CCR2 = OC_Config->Pulse;
5999 
6000  /* Write to TIMx CCER */
6001  TIMx->CCER = tmpccer;
6002 }
6003 
6010 static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
6011 {
6012  uint32_t tmpccmrx;
6013  uint32_t tmpccer;
6014  uint32_t tmpcr2;
6015 
6016  /* Disable the Channel 3: Reset the CC2E Bit */
6017  TIMx->CCER &= ~TIM_CCER_CC3E;
6018 
6019  /* Get the TIMx CCER register value */
6020  tmpccer = TIMx->CCER;
6021  /* Get the TIMx CR2 register value */
6022  tmpcr2 = TIMx->CR2;
6023 
6024  /* Get the TIMx CCMR2 register value */
6025  tmpccmrx = TIMx->CCMR2;
6026 
6027  /* Reset the Output Compare mode and Capture/Compare selection Bits */
6028  tmpccmrx &= ~TIM_CCMR2_OC3M;
6029  tmpccmrx &= ~TIM_CCMR2_CC3S;
6030  /* Select the Output Compare Mode */
6031  tmpccmrx |= OC_Config->OCMode;
6032 
6033  /* Reset the Output Polarity level */
6034  tmpccer &= ~TIM_CCER_CC3P;
6035  /* Set the Output Compare Polarity */
6036  tmpccer |= (OC_Config->OCPolarity << 8U);
6037 
6039  {
6041 
6042  /* Reset the Output N Polarity level */
6043  tmpccer &= ~TIM_CCER_CC3NP;
6044  /* Set the Output N Polarity */
6045  tmpccer |= (OC_Config->OCNPolarity << 8U);
6046  /* Reset the Output N State */
6047  tmpccer &= ~TIM_CCER_CC3NE;
6048  }
6049 
6050  if (IS_TIM_BREAK_INSTANCE(TIMx))
6051  {
6052  /* Check parameters */
6055 
6056  /* Reset the Output Compare and Output Compare N IDLE State */
6057  tmpcr2 &= ~TIM_CR2_OIS3;
6058  tmpcr2 &= ~TIM_CR2_OIS3N;
6059  /* Set the Output Idle state */
6060  tmpcr2 |= (OC_Config->OCIdleState << 4U);
6061  /* Set the Output N Idle state */
6062  tmpcr2 |= (OC_Config->OCNIdleState << 4U);
6063  }
6064 
6065  /* Write to TIMx CR2 */
6066  TIMx->CR2 = tmpcr2;
6067 
6068  /* Write to TIMx CCMR2 */
6069  TIMx->CCMR2 = tmpccmrx;
6070 
6071  /* Set the Capture Compare Register value */
6072  TIMx->CCR3 = OC_Config->Pulse;
6073 
6074  /* Write to TIMx CCER */
6075  TIMx->CCER = tmpccer;
6076 }
6077 
6084 static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
6085 {
6086  uint32_t tmpccmrx;
6087  uint32_t tmpccer;
6088  uint32_t tmpcr2;
6089 
6090  /* Disable the Channel 4: Reset the CC4E Bit */
6091  TIMx->CCER &= ~TIM_CCER_CC4E;
6092 
6093  /* Get the TIMx CCER register value */
6094  tmpccer = TIMx->CCER;
6095  /* Get the TIMx CR2 register value */
6096  tmpcr2 = TIMx->CR2;
6097 
6098  /* Get the TIMx CCMR2 register value */
6099  tmpccmrx = TIMx->CCMR2;
6100 
6101  /* Reset the Output Compare mode and Capture/Compare selection Bits */
6102  tmpccmrx &= ~TIM_CCMR2_OC4M;
6103  tmpccmrx &= ~TIM_CCMR2_CC4S;
6104 
6105  /* Select the Output Compare Mode */
6106  tmpccmrx |= (OC_Config->OCMode << 8U);
6107 
6108  /* Reset the Output Polarity level */
6109  tmpccer &= ~TIM_CCER_CC4P;
6110  /* Set the Output Compare Polarity */
6111  tmpccer |= (OC_Config->OCPolarity << 12U);
6112 
6113  if (IS_TIM_BREAK_INSTANCE(TIMx))
6114  {
6115  /* Check parameters */
6117 
6118  /* Reset the Output Compare IDLE State */
6119  tmpcr2 &= ~TIM_CR2_OIS4;
6120 
6121  /* Set the Output Idle state */
6122  tmpcr2 |= (OC_Config->OCIdleState << 6U);
6123  }
6124 
6125  /* Write to TIMx CR2 */
6126  TIMx->CR2 = tmpcr2;
6127 
6128  /* Write to TIMx CCMR2 */
6129  TIMx->CCMR2 = tmpccmrx;
6130 
6131  /* Set the Capture Compare Register value */
6132  TIMx->CCR4 = OC_Config->Pulse;
6133 
6134  /* Write to TIMx CCER */
6135  TIMx->CCER = tmpccer;
6136 }
6137 
6144 static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
6145  TIM_SlaveConfigTypeDef *sSlaveConfig)
6146 {
6147  uint32_t tmpsmcr;
6148  uint32_t tmpccmr1;
6149  uint32_t tmpccer;
6150 
6151  /* Get the TIMx SMCR register value */
6152  tmpsmcr = htim->Instance->SMCR;
6153 
6154  /* Reset the Trigger Selection Bits */
6155  tmpsmcr &= ~TIM_SMCR_TS;
6156  /* Set the Input Trigger source */
6157  tmpsmcr |= sSlaveConfig->InputTrigger;
6158 
6159  /* Reset the slave mode Bits */
6160  tmpsmcr &= ~TIM_SMCR_SMS;
6161  /* Set the slave mode */
6162  tmpsmcr |= sSlaveConfig->SlaveMode;
6163 
6164  /* Write to TIMx SMCR */
6165  htim->Instance->SMCR = tmpsmcr;
6166 
6167  /* Configure the trigger prescaler, filter, and polarity */
6168  switch (sSlaveConfig->InputTrigger)
6169  {
6170  case TIM_TS_ETRF:
6171  {
6172  /* Check the parameters */
6177  /* Configure the ETR Trigger source */
6179  sSlaveConfig->TriggerPrescaler,
6180  sSlaveConfig->TriggerPolarity,
6181  sSlaveConfig->TriggerFilter);
6182  break;
6183  }
6184 
6185  case TIM_TS_TI1F_ED:
6186  {
6187  /* Check the parameters */
6190 
6191  if(sSlaveConfig->SlaveMode == TIM_SLAVEMODE_GATED)
6192  {
6193  return HAL_ERROR;
6194  }
6195 
6196  /* Disable the Channel 1: Reset the CC1E Bit */
6197  tmpccer = htim->Instance->CCER;
6198  htim->Instance->CCER &= ~TIM_CCER_CC1E;
6199  tmpccmr1 = htim->Instance->CCMR1;
6200 
6201  /* Set the filter */
6202  tmpccmr1 &= ~TIM_CCMR1_IC1F;
6203  tmpccmr1 |= ((sSlaveConfig->TriggerFilter) << 4U);
6204 
6205  /* Write to TIMx CCMR1 and CCER registers */
6206  htim->Instance->CCMR1 = tmpccmr1;
6207  htim->Instance->CCER = tmpccer;
6208  break;
6209  }
6210 
6211  case TIM_TS_TI1FP1:
6212  {
6213  /* Check the parameters */
6217 
6218  /* Configure TI1 Filter and Polarity */
6219  TIM_TI1_ConfigInputStage(htim->Instance,
6220  sSlaveConfig->TriggerPolarity,
6221  sSlaveConfig->TriggerFilter);
6222  break;
6223  }
6224 
6225  case TIM_TS_TI2FP2:
6226  {
6227  /* Check the parameters */
6231 
6232  /* Configure TI2 Filter and Polarity */
6233  TIM_TI2_ConfigInputStage(htim->Instance,
6234  sSlaveConfig->TriggerPolarity,
6235  sSlaveConfig->TriggerFilter);
6236  break;
6237  }
6238 
6239  case TIM_TS_ITR0:
6240  case TIM_TS_ITR1:
6241  case TIM_TS_ITR2:
6242  case TIM_TS_ITR3:
6243  {
6244  /* Check the parameter */
6246  break;
6247  }
6248 
6249  default:
6250  break;
6251  }
6252  return HAL_OK;
6253 }
6254 
6275 void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
6276  uint32_t TIM_ICFilter)
6277 {
6278  uint32_t tmpccmr1;
6279  uint32_t tmpccer;
6280 
6281  /* Disable the Channel 1: Reset the CC1E Bit */
6282  TIMx->CCER &= ~TIM_CCER_CC1E;
6283  tmpccmr1 = TIMx->CCMR1;
6284  tmpccer = TIMx->CCER;
6285 
6286  /* Select the Input */
6287  if (IS_TIM_CC2_INSTANCE(TIMx) != RESET)
6288  {
6289  tmpccmr1 &= ~TIM_CCMR1_CC1S;
6290  tmpccmr1 |= TIM_ICSelection;
6291  }
6292  else
6293  {
6294  tmpccmr1 |= TIM_CCMR1_CC1S_0;
6295  }
6296 
6297  /* Set the filter */
6298  tmpccmr1 &= ~TIM_CCMR1_IC1F;
6299  tmpccmr1 |= ((TIM_ICFilter << 4U) & TIM_CCMR1_IC1F);
6300 
6301  /* Select the Polarity and set the CC1E Bit */
6302  tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP);
6303  tmpccer |= (TIM_ICPolarity & (TIM_CCER_CC1P | TIM_CCER_CC1NP));
6304 
6305  /* Write to TIMx CCMR1 and CCER registers */
6306  TIMx->CCMR1 = tmpccmr1;
6307  TIMx->CCER = tmpccer;
6308 }
6309 
6322 static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
6323 {
6324  uint32_t tmpccmr1;
6325  uint32_t tmpccer;
6326 
6327  /* Disable the Channel 1: Reset the CC1E Bit */
6328  tmpccer = TIMx->CCER;
6329  TIMx->CCER &= ~TIM_CCER_CC1E;
6330  tmpccmr1 = TIMx->CCMR1;
6331 
6332  /* Set the filter */
6333  tmpccmr1 &= ~TIM_CCMR1_IC1F;
6334  tmpccmr1 |= (TIM_ICFilter << 4U);
6335 
6336  /* Select the Polarity and set the CC1E Bit */
6337  tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP);
6338  tmpccer |= TIM_ICPolarity;
6339 
6340  /* Write to TIMx CCMR1 and CCER registers */
6341  TIMx->CCMR1 = tmpccmr1;
6342  TIMx->CCER = tmpccer;
6343 }
6344 
6365 static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
6366  uint32_t TIM_ICFilter)
6367 {
6368  uint32_t tmpccmr1;
6369  uint32_t tmpccer;
6370 
6371  /* Disable the Channel 2: Reset the CC2E Bit */
6372  TIMx->CCER &= ~TIM_CCER_CC2E;
6373  tmpccmr1 = TIMx->CCMR1;
6374  tmpccer = TIMx->CCER;
6375 
6376  /* Select the Input */
6377  tmpccmr1 &= ~TIM_CCMR1_CC2S;
6378  tmpccmr1 |= (TIM_ICSelection << 8U);
6379 
6380  /* Set the filter */
6381  tmpccmr1 &= ~TIM_CCMR1_IC2F;
6382  tmpccmr1 |= ((TIM_ICFilter << 12U) & TIM_CCMR1_IC2F);
6383 
6384  /* Select the Polarity and set the CC2E Bit */
6385  tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP);
6386  tmpccer |= ((TIM_ICPolarity << 4U) & (TIM_CCER_CC2P | TIM_CCER_CC2NP));
6387 
6388  /* Write to TIMx CCMR1 and CCER registers */
6389  TIMx->CCMR1 = tmpccmr1 ;
6390  TIMx->CCER = tmpccer;
6391 }
6392 
6405 static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
6406 {
6407  uint32_t tmpccmr1;
6408  uint32_t tmpccer;
6409 
6410  /* Disable the Channel 2: Reset the CC2E Bit */
6411  TIMx->CCER &= ~TIM_CCER_CC2E;
6412  tmpccmr1 = TIMx->CCMR1;
6413  tmpccer = TIMx->CCER;
6414 
6415  /* Set the filter */
6416  tmpccmr1 &= ~TIM_CCMR1_IC2F;
6417  tmpccmr1 |= (TIM_ICFilter << 12U);
6418 
6419  /* Select the Polarity and set the CC2E Bit */
6420  tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP);
6421  tmpccer |= (TIM_ICPolarity << 4U);
6422 
6423  /* Write to TIMx CCMR1 and CCER registers */
6424  TIMx->CCMR1 = tmpccmr1 ;
6425  TIMx->CCER = tmpccer;
6426 }
6427 
6448 static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
6449  uint32_t TIM_ICFilter)
6450 {
6451  uint32_t tmpccmr2;
6452  uint32_t tmpccer;
6453 
6454  /* Disable the Channel 3: Reset the CC3E Bit */
6455  TIMx->CCER &= ~TIM_CCER_CC3E;
6456  tmpccmr2 = TIMx->CCMR2;
6457  tmpccer = TIMx->CCER;
6458 
6459  /* Select the Input */
6460  tmpccmr2 &= ~TIM_CCMR2_CC3S;
6461  tmpccmr2 |= TIM_ICSelection;
6462 
6463  /* Set the filter */
6464  tmpccmr2 &= ~TIM_CCMR2_IC3F;
6465  tmpccmr2 |= ((TIM_ICFilter << 4U) & TIM_CCMR2_IC3F);
6466 
6467  /* Select the Polarity and set the CC3E Bit */
6468  tmpccer &= ~(TIM_CCER_CC3P | TIM_CCER_CC3NP);
6469  tmpccer |= ((TIM_ICPolarity << 8U) & (TIM_CCER_CC3P | TIM_CCER_CC3NP));
6470 
6471  /* Write to TIMx CCMR2 and CCER registers */
6472  TIMx->CCMR2 = tmpccmr2;
6473  TIMx->CCER = tmpccer;
6474 }
6475 
6496 static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
6497  uint32_t TIM_ICFilter)
6498 {
6499  uint32_t tmpccmr2;
6500  uint32_t tmpccer;
6501 
6502  /* Disable the Channel 4: Reset the CC4E Bit */
6503  TIMx->CCER &= ~TIM_CCER_CC4E;
6504  tmpccmr2 = TIMx->CCMR2;
6505  tmpccer = TIMx->CCER;
6506 
6507  /* Select the Input */
6508  tmpccmr2 &= ~TIM_CCMR2_CC4S;
6509  tmpccmr2 |= (TIM_ICSelection << 8U);
6510 
6511  /* Set the filter */
6512  tmpccmr2 &= ~TIM_CCMR2_IC4F;
6513  tmpccmr2 |= ((TIM_ICFilter << 12U) & TIM_CCMR2_IC4F);
6514 
6515  /* Select the Polarity and set the CC4E Bit */
6516  tmpccer &= ~(TIM_CCER_CC4P | TIM_CCER_CC4NP);
6517  tmpccer |= ((TIM_ICPolarity << 12U) & (TIM_CCER_CC4P | TIM_CCER_CC4NP));
6518 
6519  /* Write to TIMx CCMR2 and CCER registers */
6520  TIMx->CCMR2 = tmpccmr2;
6521  TIMx->CCER = tmpccer ;
6522 }
6523 
6539 static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource)
6540 {
6541  uint32_t tmpsmcr;
6542 
6543  /* Get the TIMx SMCR register value */
6544  tmpsmcr = TIMx->SMCR;
6545  /* Reset the TS Bits */
6546  tmpsmcr &= ~TIM_SMCR_TS;
6547  /* Set the Input Trigger source and the slave mode*/
6548  tmpsmcr |= (InputTriggerSource | TIM_SLAVEMODE_EXTERNAL1);
6549  /* Write to TIMx SMCR */
6550  TIMx->SMCR = tmpsmcr;
6551 }
6569 void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler,
6570  uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter)
6571 {
6572  uint32_t tmpsmcr;
6573 
6574  tmpsmcr = TIMx->SMCR;
6575 
6576  /* Reset the ETR Bits */
6578 
6579  /* Set the Prescaler, the Filter value and the Polarity */
6580  tmpsmcr |= (uint32_t)(TIM_ExtTRGPrescaler | (TIM_ExtTRGPolarity | (ExtTRGFilter << 8U)));
6581 
6582  /* Write to TIMx SMCR */
6583  TIMx->SMCR = tmpsmcr;
6584 }
6585 
6599 void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
6600 {
6601  uint32_t tmp;
6602 
6603  /* Check the parameters */
6605  assert_param(IS_TIM_CHANNELS(Channel));
6606 
6607  tmp = TIM_CCER_CC1E << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */
6608 
6609  /* Reset the CCxE Bit */
6610  TIMx->CCER &= ~tmp;
6611 
6612  /* Set or reset the CCxE Bit */
6613  TIMx->CCER |= (uint32_t)(ChannelState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */
6614 }
6615 
6616 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6617 
6623 void TIM_ResetCallback(TIM_HandleTypeDef *htim)
6624 {
6625  /* Reset the TIM callback to the legacy weak callbacks */
6626  htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; /* Legacy weak PeriodElapsedCallback */
6627  htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; /* Legacy weak PeriodElapsedHalfCpltCallback */
6628  htim->TriggerCallback = HAL_TIM_TriggerCallback; /* Legacy weak TriggerCallback */
6629  htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; /* Legacy weak TriggerHalfCpltCallback */
6630  htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; /* Legacy weak IC_CaptureCallback */
6631  htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; /* Legacy weak IC_CaptureHalfCpltCallback */
6632  htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; /* Legacy weak OC_DelayElapsedCallback */
6633  htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; /* Legacy weak PWM_PulseFinishedCallback */
6634  htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; /* Legacy weak PWM_PulseFinishedHalfCpltCallback */
6635  htim->ErrorCallback = HAL_TIM_ErrorCallback; /* Legacy weak ErrorCallback */
6636  htim->CommutationCallback = HAL_TIMEx_CommutCallback; /* Legacy weak CommutationCallback */
6637  htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; /* Legacy weak CommutationHalfCpltCallback */
6638  htim->BreakCallback = HAL_TIMEx_BreakCallback; /* Legacy weak BreakCallback */
6639 }
6640 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6641 
6646 #endif /* HAL_TIM_MODULE_ENABLED */
6647 
6654 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
TIM_CR2_OIS1N
#define TIM_CR2_OIS1N
Definition: stm32f407xx.h:11958
TIM_CCER_CC1P
#define TIM_CCER_CC1P
Definition: stm32f407xx.h:12290
IS_TIM_DMA_INSTANCE
#define IS_TIM_DMA_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15229
HAL_TIM_TriggerHalfCpltCallback
void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim)
IS_TIM_IC_FILTER
#define IS_TIM_IC_FILTER(__ICFILTER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1732
TIM_CCMR1_OC2M
#define TIM_CCMR1_OC2M
Definition: stm32f407xx.h:12166
assert_param
#define assert_param(expr)
Include module's header file.
Definition: stm32f407/stm32f407g-disc1/Inc/stm32f4xx_hal_conf.h:353
IS_TIM_INSTANCE
#define IS_TIM_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15161
TIM_SlaveConfigTypeDef::SlaveMode
uint32_t SlaveMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:247
TIM_IC_InitTypeDef::ICPrescaler
uint32_t ICPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:154
TIM_OC_InitTypeDef::Pulse
uint32_t Pulse
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:83
TIM_OC_InitTypeDef::OCFastMode
uint32_t OCFastMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:93
TIM_IT_CC3
#define TIM_IT_CC3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:653
TIM_SMCR_SMS
#define TIM_SMCR_SMS
Definition: stm32f407xx.h:11978
HAL_TIM_IC_Start_DMA
HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
TIM_IT_CC4
#define TIM_IT_CC4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:654
TIM_OC_InitTypeDef::OCMode
uint32_t OCMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:80
TIM_CLEARINPUTSOURCE_NONE
#define TIM_CLEARINPUTSOURCE_NONE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:413
TIM_DMACaptureHalfCplt
void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma)
TIM_CR2_OIS2N
#define TIM_CR2_OIS2N
Definition: stm32f407xx.h:11964
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
IS_TIM_IC_SELECTION
#define IS_TIM_IC_SELECTION(__SELECTION__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1566
HAL_TIMEx_HallSensor_MspDeInit
void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim)
TIM_CCMR1_OC2FE
#define TIM_CCMR1_OC2FE
Definition: stm32f407xx.h:12159
TIM_CLOCKSOURCE_INTERNAL
#define TIM_CLOCKSOURCE_INTERNAL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:720
IS_TIM_OCN_POLARITY
#define IS_TIM_OCN_POLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1550
IS_TIM_CLOCK_DIVISION_INSTANCE
#define IS_TIM_CLOCK_DIVISION_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15377
HAL_TIMEx_CommutHalfCpltCallback
void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim)
HAL_TIM_Encoder_Init
HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig)
TIM_SlaveConfigTypeDef::TriggerPrescaler
uint32_t TriggerPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:253
TIM_CLOCKSOURCE_TI1ED
#define TIM_CLOCKSOURCE_TI1ED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:725
DISABLE
@ DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:193
TIM_TypeDef::CR1
__IO uint32_t CR1
Definition: stm32f407xx.h:731
TIM_DMA_CC4
#define TIM_DMA_CC4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:678
IS_TIM_SLAVE_MODE
#define IS_TIM_SLAVE_MODE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1666
HAL_TIM_Base_Stop_IT
HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim)
IS_TIM_CLOCKSOURCE_ITRX_INSTANCE
#define IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15432
__DMA_HandleTypeDef::XferHalfCpltCallback
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:153
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
TIM_CCxChannelCmd
void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
HAL_TIM_OC_GetState
HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(TIM_HandleTypeDef *htim)
HAL_TIMEx_BreakCallback
void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim)
TIM_CHANNEL_1
#define TIM_CHANNEL_1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:707
HAL_TIM_PWM_PulseFinishedHalfCpltCallback
void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim)
__HAL_TIM_DISABLE
#define __HAL_TIM_DISABLE(__HANDLE__)
Disable the TIM peripheral.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1036
HAL_TIMEx_HallSensor_MspInit
void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim)
IS_TIM_IC_POLARITY
#define IS_TIM_IC_POLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1562
__HAL_TIM_ENABLE_DMA
#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__)
Enable the specified DMA request.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1117
TIM_ClearInputConfigTypeDef::ClearInputPrescaler
uint32_t ClearInputPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:220
HAL_TIM_IRQHandler
void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim)
HAL_TIM_ConfigTI1Input
HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection)
HAL_TIM_PWM_ConfigChannel
HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
TIM_IC_InitTypeDef::ICPolarity
uint32_t ICPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:148
__HAL_TIM_CLEAR_IT
#define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__)
Clear the TIM interrupt pending bits.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1206
TIM_TypeDef::EGR
__IO uint32_t EGR
Definition: stm32f407xx.h:736
IS_TIM_TRIGGERPRESCALER
#define IS_TIM_TRIGGERPRESCALER(__PRESCALER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1703
IS_TIM_DMA_BASE
#define IS_TIM_DMA_BASE(__BASE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1510
TIM_TS_ITR1
#define TIM_TS_ITR1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:887
HAL_UNLOCKED
@ HAL_UNLOCKED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:53
TIM_CR1_CMS
#define TIM_CR1_CMS
Definition: stm32f407xx.h:11918
TIM_CCER_CC3NE
#define TIM_CCER_CC3NE
Definition: stm32f407xx.h:12317
TIM_FLAG_CC1
#define TIM_FLAG_CC1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:689
HAL_TIM_OnePulse_Stop
HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
TIM_CHANNEL_2
#define TIM_CHANNEL_2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:708
HAL_TIM_OnePulse_Stop_IT
HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
TIM_DMA_ID_CC3
#define TIM_DMA_ID_CC3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:962
TIM_Encoder_InitTypeDef::IC2Polarity
uint32_t IC2Polarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:181
HAL_DMA_Abort_IT
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
TIM_CR1_CKD
#define TIM_CR1_CKD
Definition: stm32f407xx.h:11928
IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE
#define IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15414
HAL_TIM_IC_GetState
HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(TIM_HandleTypeDef *htim)
IS_TIM_TI1SELECTION
#define IS_TIM_TI1SELECTION(__TI1SELECTION__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1710
TIM_SMCR_ETP
#define TIM_SMCR_ETP
Definition: stm32f407xx.h:12013
TIM_Base_InitTypeDef::CounterMode
uint32_t CounterMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:52
TIM_CCER_CC1E
#define TIM_CCER_CC1E
Definition: stm32f407xx.h:12287
TIM_IC_InitTypeDef::ICFilter
uint32_t ICFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:157
__HAL_TIM_MOE_ENABLE
#define __HAL_TIM_MOE_ENABLE(__HANDLE__)
Enable the TIM main Output.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1029
HAL_TIM_OC_Stop_DMA
HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_ETR_SetConfig
void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler, uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter)
IS_TIM_PWM_MODE
#define IS_TIM_PWM_MODE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1672
TIM_CCMR1_OC1M
#define TIM_CCMR1_OC1M
Definition: stm32f407xx.h:12142
HAL_TIM_ReadCapturedValue
uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_Encoder_InitTypeDef::IC2Selection
uint32_t IC2Selection
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:184
IS_TIM_CC3_INSTANCE
#define IS_TIM_CC3_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15201
TIM_CLOCKSOURCE_ETRMODE2
#define TIM_CLOCKSOURCE_ETRMODE2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:719
TIMEx_DMACommutationCplt
void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma)
TIM_OC_InitTypeDef::OCNPolarity
uint32_t OCNPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:89
TIM_FLAG_CC4
#define TIM_FLAG_CC4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:692
__HAL_TIM_DISABLE_DMA
#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__)
Disable the specified DMA request.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1132
IS_TIM_CLEARINPUT_POLARITY
#define IS_TIM_CLEARINPUT_POLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1621
HAL_TIM_OnePulse_Start
HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
TIM_OnePulse_InitTypeDef::OCPolarity
uint32_t OCPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:118
TIM_Encoder_InitTypeDef::IC2Prescaler
uint32_t IC2Prescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:187
IS_TIM_COUNTER_MODE
#define IS_TIM_COUNTER_MODE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1531
HAL_TIM_ACTIVE_CHANNEL_3
@ HAL_TIM_ACTIVE_CHANNEL_3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:304
TIM_DMA_CC3
#define TIM_DMA_CC3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:677
HAL_ERROR
@ HAL_ERROR
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:43
TIM_CCMR2_OC3FE
#define TIM_CCMR2_OC3FE
Definition: stm32f407xx.h:12214
CLEAR_BIT
#define CLEAR_BIT(REG, BIT)
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:214
TIM_OC_InitTypeDef::OCIdleState
uint32_t OCIdleState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:98
HAL_TIM_IC_MspDeInit
void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim)
TIM_CCMR1_CC1S_0
#define TIM_CCMR1_CC1S_0
Definition: stm32f407xx.h:12130
TIM_CHANNEL_3
#define TIM_CHANNEL_3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:709
HAL_TIM_OC_ConfigChannel
HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
TIM_DMAError
void TIM_DMAError(DMA_HandleTypeDef *hdma)
TIM_CCMR2_IC3F
#define TIM_CCMR2_IC3F
Definition: stm32f407xx.h:12264
TIM_Encoder_InitTypeDef
TIM Encoder Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:164
TIM_FLAG_CC3
#define TIM_FLAG_CC3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:691
TIM_CCER_CC3NP
#define TIM_CCER_CC3NP
Definition: stm32f407xx.h:12320
HAL_TIM_TriggerCallback
void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim)
IS_TIM_CLEARINPUT_SOURCE
#define IS_TIM_CLEARINPUT_SOURCE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1507
TIM_DMA_CC2
#define TIM_DMA_CC2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:676
HAL_TIM_IC_Start_IT
HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_Base_InitTypeDef::ClockDivision
uint32_t ClockDivision
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:59
TIM_TypeDef::CCER
__IO uint32_t CCER
Definition: stm32f407xx.h:739
HAL_TIM_OnePulse_MspInit
void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim)
IS_TIM_DMA_SOURCE
#define IS_TIM_DMA_SOURCE(__SOURCE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1582
HAL_TIM_PeriodElapsedHalfCpltCallback
void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim)
TIM_ClockConfigTypeDef::ClockPolarity
uint32_t ClockPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:201
TIM_TypeDef::CR2
__IO uint32_t CR2
Definition: stm32f407xx.h:732
IS_TIM_ENCODER_MODE
#define IS_TIM_ENCODER_MODE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1578
TIM_OnePulse_InitTypeDef::Pulse
uint32_t Pulse
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:115
HAL_TIM_Base_Start
HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim)
TIM_Encoder_InitTypeDef::IC1Prescaler
uint32_t IC1Prescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:175
TIM_FLAG_BREAK
#define TIM_FLAG_BREAK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:695
TIM_TypeDef::DMAR
__IO uint32_t DMAR
Definition: stm32f407xx.h:750
HAL_TIM_DMABurst_ReadStart
HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
TIM_CLOCKSOURCE_ITR1
#define TIM_CLOCKSOURCE_ITR1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:722
TIM_Base_InitTypeDef::Period
uint32_t Period
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:55
TIM_IT_CC1
#define TIM_IT_CC1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:651
IS_TIM_FAST_STATE
#define IS_TIM_FAST_STATE(__STATE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1544
HAL_TIM_ErrorCallback
void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
HAL_OK
@ HAL_OK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:42
IS_TIM_COUNTER_MODE_SELECT_INSTANCE
#define IS_TIM_COUNTER_MODE_SELECT_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15369
TIM_DMA_CC1
#define TIM_DMA_CC1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:675
HAL_TIM_Base_Init
HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim)
TIM_ClockConfigTypeDef::ClockPrescaler
uint32_t ClockPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:203
TIM_CCER_CC3E
#define TIM_CCER_CC3E
Definition: stm32f407xx.h:12311
IS_TIM_SLAVEMODE_TRIGGER_ENABLED
#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1736
IS_TIM_SLAVE_INSTANCE
#define IS_TIM_SLAVE_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15273
TIM_Encoder_InitTypeDef::EncoderMode
uint32_t EncoderMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:166
IS_TIM_EVENT_SOURCE
#define IS_TIM_EVENT_SOURCE(__SOURCE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1529
TIM_CR2_OIS3
#define TIM_CR2_OIS3
Definition: stm32f407xx.h:11967
TIM_DMA_ID_COMMUTATION
#define TIM_DMA_ID_COMMUTATION
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:964
TIM_CR1_ARPE
#define TIM_CR1_ARPE
Definition: stm32f407xx.h:11924
TIM_FLAG_CC2
#define TIM_FLAG_CC2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:690
TIM_IC_InitTypeDef::ICSelection
uint32_t ICSelection
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:151
IS_TIM_OCIDLE_STATE
#define IS_TIM_OCIDLE_STATE(__STATE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1553
UNUSED
#define UNUSED(x)
Definition: porcupine/demo/c/dr_libs/old/dr.h:92
TIM_IC_InitTypeDef
TIM Input Capture Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:146
TIM_FLAG_UPDATE
#define TIM_FLAG_UPDATE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:688
TIM_CR2_OIS3N
#define TIM_CR2_OIS3N
Definition: stm32f407xx.h:11970
TIM_CCER_CC4P
#define TIM_CCER_CC4P
Definition: stm32f407xx.h:12326
TIM_DMA_ID_CC2
#define TIM_DMA_ID_CC2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:961
IS_TIM_REPETITION_COUNTER_INSTANCE
#define IS_TIM_REPETITION_COUNTER_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15442
TIM_TypeDef::SMCR
__IO uint32_t SMCR
Definition: stm32f407xx.h:733
HAL_TIM_SlaveConfigSynchro_IT
HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig)
TIM_TypeDef::PSC
__IO uint32_t PSC
Definition: stm32f407xx.h:741
TIM_CLOCKSOURCE_TI1
#define TIM_CLOCKSOURCE_TI1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:726
TIM_TypeDef::CCR3
__IO uint32_t CCR3
Definition: stm32f407xx.h:746
IS_TIM_CLOCKFILTER
#define IS_TIM_CLOCKFILTER(__ICFILTER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1619
HAL_TIM_PeriodElapsedCallback
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
TIM_ClearInputConfigTypeDef::ClearInputPolarity
uint32_t ClearInputPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:218
TIM_Encoder_InitTypeDef::IC1Filter
uint32_t IC1Filter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:178
TIM_CCMR2_OC4PE
#define TIM_CCMR2_OC4PE
Definition: stm32f407xx.h:12241
TIM_TypeDef
TIM.
Definition: stm32f407xx.h:729
HAL_TIM_OC_DelayElapsedCallback
void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)
TIM_TS_TI2FP2
#define TIM_TS_TI2FP2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:892
IS_TIM_ENCODERINPUT_POLARITY
#define IS_TIM_ENCODERINPUT_POLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1559
IS_TIM_OC_POLARITY
#define IS_TIM_OC_POLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1547
TIM_IT_COM
#define TIM_IT_COM
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:655
IS_TIM_CC1_INSTANCE
#define IS_TIM_CC1_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15177
HAL_TIM_OC_Stop_IT
HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_CCMR1_OC2CE
#define TIM_CCMR1_OC2CE
Definition: stm32f407xx.h:12173
TIM_Base_InitTypeDef
TIM Time base Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:47
__HAL_TIM_ENABLE
#define __HAL_TIM_ENABLE(__HANDLE__)
Enable the TIM peripheral.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1022
__HAL_TIM_DISABLE_IT
#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the specified TIM interrupt.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1102
TIM_HandleTypeDef::Instance
TIM_TypeDef * Instance
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:318
HAL_TIM_IC_Init
HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim)
TIM_CCMR2_IC3PSC
#define TIM_CCMR2_IC3PSC
Definition: stm32f407xx.h:12258
TIM_CLEARINPUTSOURCE_ETR
#define TIM_CLEARINPUTSOURCE_ETR
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:414
TIM_CCMR1_OC1CE
#define TIM_CCMR1_OC1CE
Definition: stm32f407xx.h:12149
TIM_CCER_CC2NE
#define TIM_CCER_CC2NE
Definition: stm32f407xx.h:12305
IS_TIM_DMA_LENGTH
#define IS_TIM_DMA_LENGTH(__LENGTH__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1713
TIM_CLOCKSOURCE_ITR2
#define TIM_CLOCKSOURCE_ITR2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:723
TIM_SlaveConfigTypeDef::TriggerFilter
uint32_t TriggerFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:255
TIM_DMA_ID_CC1
#define TIM_DMA_ID_CC1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:960
HAL_TIM_Encoder_Stop
HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_TIM_PWM_Start
HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_ClockConfigTypeDef::ClockSource
uint32_t ClockSource
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:199
TIM_CHANNEL_ALL
#define TIM_CHANNEL_ALL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:711
HAL_TIM_ACTIVE_CHANNEL_2
@ HAL_TIM_ACTIVE_CHANNEL_2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:303
HAL_TIM_OnePulse_DeInit
HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim)
TIM_SLAVEMODE_TRIGGER
#define TIM_SLAVEMODE_TRIGGER
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:862
HAL_TIM_Encoder_Start_IT
HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
__HAL_LOCK
#define __HAL_LOCK(__HANDLE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:93
HAL_TIM_STATE_RESET
@ HAL_TIM_STATE_RESET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:290
TIM_DMADelayPulseCplt
void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma)
TIM_DMA_ID_TRIGGER
#define TIM_DMA_ID_TRIGGER
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:965
HAL_TIM_Base_MspInit
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
IS_TIM_CLOCKSOURCE
#define IS_TIM_CLOCKSOURCE(__CLOCK__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1597
TIM_OnePulse_InitTypeDef::OCNPolarity
uint32_t OCNPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:121
HAL_TIM_Base_GetState
HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(TIM_HandleTypeDef *htim)
IS_TIM_OPM_MODE
#define IS_TIM_OPM_MODE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1575
TIM_CLOCKSOURCE_ETRMODE1
#define TIM_CLOCKSOURCE_ETRMODE1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:728
HAL_TIM_Encoder_DeInit
HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim)
TIM_CCMR2_OC4CE
#define TIM_CCMR2_OC4CE
Definition: stm32f407xx.h:12252
TIM_CCMR1_CC1S
#define TIM_CCMR1_CC1S
Definition: stm32f407xx.h:12129
TIM_DMA_UPDATE
#define TIM_DMA_UPDATE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:674
HAL_TIM_IC_Stop_DMA
HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_OC_InitTypeDef
TIM Output Compare Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:78
MODIFY_REG
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:224
TIM_CCMR2_CC3S
#define TIM_CCMR2_CC3S
Definition: stm32f407xx.h:12208
TIM_SMCR_ETF
#define TIM_SMCR_ETF
Definition: stm32f407xx.h:11996
TIM_Encoder_InitTypeDef::IC1Polarity
uint32_t IC1Polarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:169
HAL_TIM_OC_Start_DMA
HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
TIM_CCx_ENABLE
#define TIM_CCx_ENABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:973
TIM_IT_CC2
#define TIM_IT_CC2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:652
TIM_CCER_CC2NP
#define TIM_CCER_CC2NP
Definition: stm32f407xx.h:12308
TIM_HandleTypeDef
TIM Time Base Handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:315
HAL_TIM_GenerateEvent
HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource)
IS_TIM_CLOCKPOLARITY
#define IS_TIM_CLOCKPOLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1608
HAL_TIM_Base_Stop
HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim)
RESET
@ RESET
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:187
TIM_HandleTypeDef::Channel
HAL_TIM_ActiveChannel Channel
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:320
TIM_OnePulse_InitTypeDef::OCNIdleState
uint32_t OCNIdleState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:129
TIM_OnePulse_InitTypeDef::ICSelection
uint32_t ICSelection
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:136
HAL_TIM_PWM_PulseFinishedCallback
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
HAL_TIM_PWM_MspDeInit
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
IS_TIM_CC2_INSTANCE
#define IS_TIM_CC2_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15191
TIM_CLOCKSOURCE_TI2
#define TIM_CLOCKSOURCE_TI2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:727
HAL_BUSY
@ HAL_BUSY
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:44
HAL_DMA_Start_IT
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
TIM_ClockConfigTypeDef
Clock Configuration Handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:197
TIM_CR1_OPM
#define TIM_CR1_OPM
Definition: stm32f407xx.h:11911
IS_TIM_CC4_INSTANCE
#define IS_TIM_CC4_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15209
TIM_TypeDef::DCR
__IO uint32_t DCR
Definition: stm32f407xx.h:749
HAL_TIM_OC_Stop
HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_SMCR_ETPS
#define TIM_SMCR_ETPS
Definition: stm32f407xx.h:12004
IS_TIM_OC_MODE
#define IS_TIM_OC_MODE(__MODE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1675
TIM_CCMR2_OC4FE
#define TIM_CCMR2_OC4FE
Definition: stm32f407xx.h:12238
TIM_CCMR2_OC4M
#define TIM_CCMR2_OC4M
Definition: stm32f407xx.h:12245
TIM_ClearInputConfigTypeDef::ClearInputSource
uint32_t ClearInputSource
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:216
TIM_CCMR2_IC4PSC
#define TIM_CCMR2_IC4PSC
Definition: stm32f407xx.h:12272
TIM_CCMR1_OC2PE
#define TIM_CCMR1_OC2PE
Definition: stm32f407xx.h:12162
__HAL_UNLOCK
#define __HAL_UNLOCK(__HANDLE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:105
HAL_TIM_IC_Stop_IT
HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_ClearInputConfigTypeDef::ClearInputState
uint32_t ClearInputState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:214
HAL_TIM_OnePulse_ConfigChannel
HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, uint32_t OutputChannel, uint32_t InputChannel)
HAL_TIM_Encoder_MspDeInit
void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim)
TIM_Base_InitTypeDef::AutoReloadPreload
uint32_t AutoReloadPreload
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:71
HAL_TIM_StateTypeDef
HAL_TIM_StateTypeDef
HAL State structures definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:288
IS_TIM_DMABURST_INSTANCE
#define IS_TIM_DMABURST_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15255
TIM_DMA_ID_CC4
#define TIM_DMA_ID_CC4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:963
HAL_TIM_Encoder_Stop_IT
HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_TIM_ConfigClockSource
HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig)
TIM_CCMR2_OC3CE
#define TIM_CCMR2_OC3CE
Definition: stm32f407xx.h:12228
TIM_SlaveConfigTypeDef::InputTrigger
uint32_t InputTrigger
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:249
TIM_OnePulse_InitTypeDef::ICFilter
uint32_t ICFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:139
IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE
#define IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15404
HAL_TIM_PWM_Init
HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim)
TIM_Base_InitTypeDef::Prescaler
uint32_t Prescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:49
TIM_Base_SetConfig
void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
HAL_TIMEx_CommutCallback
void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim)
HAL_TIM_ACTIVE_CHANNEL_CLEARED
@ HAL_TIM_ACTIVE_CHANNEL_CLEARED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:306
TIM_CCER_CC2E
#define TIM_CCER_CC2E
Definition: stm32f407xx.h:12299
IS_TIM_TRIGGERFILTER
#define IS_TIM_TRIGGERFILTER(__ICFILTER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1708
HAL_TIM_IC_Stop
HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_TIM_IC_DeInit
HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim)
TIM_TS_ETRF
#define TIM_TS_ETRF
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:893
TIM_IT_TRIGGER
#define TIM_IT_TRIGGER
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:656
HAL_TIM_IC_ConfigChannel
HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel)
TIM_CCMR1_CC2S
#define TIM_CCMR1_CC2S
Definition: stm32f407xx.h:12153
TIM_CCx_DISABLE
#define TIM_CCx_DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:974
TIM_CCMR1_IC1F
#define TIM_CCMR1_IC1F
Definition: stm32f407xx.h:12185
TIM_CR2_TI1S
#define TIM_CR2_TI1S
Definition: stm32f407xx.h:11952
HAL_TIM_Encoder_MspInit
void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
IS_TIM_CLOCKSOURCE_TIX_INSTANCE
#define IS_TIM_CLOCKSOURCE_TIX_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15422
TIM_DMA_TRIGGER
#define TIM_DMA_TRIGGER
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:680
TIM_CCMR2_OC3PE
#define TIM_CCMR2_OC3PE
Definition: stm32f407xx.h:12217
HAL_TIM_OC_Init
HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim)
TIM_ClearInputConfigTypeDef::ClearInputFilter
uint32_t ClearInputFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:222
HAL_TIM_IC_CaptureCallback
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
IS_TIM_CLEARINPUT_PRESCALER
#define IS_TIM_CLEARINPUT_PRESCALER(__PRESCALER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1624
IS_TIM_CLOCKPRESCALER
#define IS_TIM_CLOCKPRESCALER(__PRESCALER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1614
TIM_TypeDef::CCMR2
__IO uint32_t CCMR2
Definition: stm32f407xx.h:738
TIM_CHANNEL_4
#define TIM_CHANNEL_4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:710
TIM_CR2_OIS2
#define TIM_CR2_OIS2
Definition: stm32f407xx.h:11961
TIM_OC2_SetConfig
void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
TIM_Encoder_InitTypeDef::IC2Filter
uint32_t IC2Filter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:190
TIM_SlaveConfigTypeDef::TriggerPolarity
uint32_t TriggerPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:251
TIM_DMADelayPulseHalfCplt
void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma)
TIM_SLAVEMODE_EXTERNAL1
#define TIM_SLAVEMODE_EXTERNAL1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:863
HAL_TIM_OC_MspDeInit
void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim)
HAL_TIM_PWM_Stop
HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_TIM_OC_Start
HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_TIM_Encoder_Stop_DMA
HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_CCER_CC4NP
#define TIM_CCER_CC4NP
Definition: stm32f407xx.h:12329
TIM_CCER_CC4E
#define TIM_CCER_CC4E
Definition: stm32f407xx.h:12323
__DMA_HandleTypeDef::XferCpltCallback
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:151
HAL_TIM_SlaveConfigSynchro
HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, TIM_SlaveConfigTypeDef *sSlaveConfig)
TIM_TypeDef::CCMR1
__IO uint32_t CCMR1
Definition: stm32f407xx.h:737
IS_TIM_AUTORELOAD_PRELOAD
#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1541
TIM_CLOCKSOURCE_ITR3
#define TIM_CLOCKSOURCE_ITR3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:724
TIM_CR2_OIS1
#define TIM_CR2_OIS1
Definition: stm32f407xx.h:11955
TIM_TS_ITR3
#define TIM_TS_ITR3
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:889
HAL_TIM_PWM_Start_IT
HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_EGR_UG
#define TIM_EGR_UG
Definition: stm32f407xx.h:12103
TIM_CCER_CC1NE
#define TIM_CCER_CC1NE
Definition: stm32f407xx.h:12293
HAL_TIM_OnePulse_Start_IT
HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
HAL_TIM_PWM_Stop_DMA
HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_TS_ITR2
#define TIM_TS_ITR2
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:888
TIM_SMCR_ECE
#define TIM_SMCR_ECE
Definition: stm32f407xx.h:12010
HAL_TIM_Encoder_Start
HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_OnePulse_InitTypeDef::OCIdleState
uint32_t OCIdleState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:125
TIM_CCMR1_IC2F
#define TIM_CCMR1_IC2F
Definition: stm32f407xx.h:12199
HAL_TIM_Base_MspDeInit
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim)
IS_TIM_DMA_CC_INSTANCE
#define IS_TIM_DMA_CC_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15239
IS_TIM_OPM_CHANNELS
#define IS_TIM_OPM_CHANNELS(__CHANNEL__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1590
TIM_TypeDef::RCR
__IO uint32_t RCR
Definition: stm32f407xx.h:743
TIM_ClockConfigTypeDef::ClockFilter
uint32_t ClockFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:205
HAL_TIM_STATE_BUSY
@ HAL_TIM_STATE_BUSY
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:292
TIM_OnePulse_InitTypeDef::ICPolarity
uint32_t ICPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:133
HAL_TIM_IC_Start
HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_TIM_Encoder_Start_DMA
HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, uint32_t *pData2, uint16_t Length)
TIM_TypeDef::ARR
__IO uint32_t ARR
Definition: stm32f407xx.h:742
IS_TIM_OCXREF_CLEAR_INSTANCE
#define IS_TIM_OCXREF_CLEAR_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15396
IS_TIM_CCXN_INSTANCE
#define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL)
Definition: stm32f407xx.h:15357
TIM_Base_InitTypeDef::RepetitionCounter
uint32_t RepetitionCounter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:62
TIM_DMA_ID_UPDATE
#define TIM_DMA_ID_UPDATE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:959
TIM_OnePulse_InitTypeDef::OCMode
uint32_t OCMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:112
__HAL_TIM_ENABLE_IT
#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the specified TIM interrupt.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1086
TIM_HandleTypeDef::Init
TIM_Base_InitTypeDef Init
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:319
TIM_CCMR2_CC4S
#define TIM_CCMR2_CC4S
Definition: stm32f407xx.h:12232
TIM_TypeDef::CCR1
__IO uint32_t CCR1
Definition: stm32f407xx.h:744
IS_TIM_CCX_INSTANCE
#define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL)
Definition: stm32f407xx.h:15299
TIM_CR1_DIR
#define TIM_CR1_DIR
Definition: stm32f407xx.h:11914
TIM_DMACaptureCplt
void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma)
TIM_HandleTypeDef::Lock
HAL_LockTypeDef Lock
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:323
TIM_CR2_OIS4
#define TIM_CR2_OIS4
Definition: stm32f407xx.h:11973
TIM_CLOCKSOURCE_ITR0
#define TIM_CLOCKSOURCE_ITR0
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:721
HAL_TIM_PWM_MspInit
void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
HAL_TIM_OC_Start_IT
HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_CCMR1_OC1PE
#define TIM_CCMR1_OC1PE
Definition: stm32f407xx.h:12138
HAL_TIM_DMABurst_WriteStart
HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
TIM_TS_TI1FP1
#define TIM_TS_TI1FP1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:891
HAL_TIM_OnePulse_MspDeInit
void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim)
TIM_FLAG_COM
#define TIM_FLAG_COM
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:693
TIM_IT_BREAK
#define TIM_IT_BREAK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:657
TIM_IT_UPDATE
#define TIM_IT_UPDATE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:650
HAL_TIM_DMABurst_WriteStop
HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
TIM_CCMR1_IC1PSC
#define TIM_CCMR1_IC1PSC
Definition: stm32f407xx.h:12179
TIM_CCER_CC2P
#define TIM_CCER_CC2P
Definition: stm32f407xx.h:12302
TIM_CCMR2_OC3M
#define TIM_CCMR2_OC3M
Definition: stm32f407xx.h:12221
HAL_TIM_OC_MspInit
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
HAL_TIM_ConfigOCrefClear
HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim, TIM_ClearInputConfigTypeDef *sClearInputConfig, uint32_t Channel)
HAL_TIM_Encoder_GetState
HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(TIM_HandleTypeDef *htim)
HAL_TIM_PWM_Stop_IT
HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_ClearInputConfigTypeDef
TIM Clear Input Configuration Handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:212
TIM_CLEARINPUTPRESCALER_DIV1
#define TIM_CLEARINPUTPRESCALER_DIV1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:768
__HAL_TIM_MOE_DISABLE
#define __HAL_TIM_MOE_DISABLE(__HANDLE__)
Disable the TIM main Output.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1053
IS_TIM_BREAK_INSTANCE
#define IS_TIM_BREAK_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15462
IS_TIM_CLOCKDIVISION_DIV
#define IS_TIM_CLOCKDIVISION_DIV(__DIV__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1537
IS_TIM_OCNIDLE_STATE
#define IS_TIM_OCNIDLE_STATE(__STATE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1556
SET_BIT
#define SET_BIT(REG, BIT)
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:212
TIM_CCER_CC1NP
#define TIM_CCER_CC1NP
Definition: stm32f407xx.h:12296
TIM_CCMR2_IC4F
#define TIM_CCMR2_IC4F
Definition: stm32f407xx.h:12278
TIM_OC_InitTypeDef::OCNIdleState
uint32_t OCNIdleState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:102
HAL_TIM_OnePulse_Init
HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode)
TIM_OnePulse_InitTypeDef
TIM One Pulse Mode Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:110
HAL_TIM_OnePulse_GetState
HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(TIM_HandleTypeDef *htim)
TIMEx_DMACommutationHalfCplt
void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma)
IS_TIM_TRIGGERPOLARITY
#define IS_TIM_TRIGGERPOLARITY(__POLARITY__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1697
HAL_TIM_PWM_Start_DMA
HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
TIM_CCER_CC3P
#define TIM_CCER_CC3P
Definition: stm32f407xx.h:12314
TIM_TS_TI1F_ED
#define TIM_TS_TI1F_ED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:890
__HAL_TIM_GET_IT_SOURCE
#define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check whether the specified TIM interrupt source is enabled or not.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1189
HAL_TIM_OC_DeInit
HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim)
HAL_TIM_DMABurst_ReadStop
HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
HAL_TIM_IC_CaptureHalfCpltCallback
void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim)
TIM_HandleTypeDef::hdma
DMA_HandleTypeDef * hdma[7]
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:321
HAL_TIM_IC_MspInit
void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim)
TIM_CCMR1_IC2PSC
#define TIM_CCMR1_IC2PSC
Definition: stm32f407xx.h:12193
HAL_TIM_Base_Start_DMA
HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
HAL_TIM_PWM_DeInit
HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim)
TIM_Encoder_InitTypeDef::IC1Selection
uint32_t IC1Selection
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:172
TIM_HandleTypeDef::State
__IO HAL_TIM_StateTypeDef State
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:324
TIM_OC_InitTypeDef::OCPolarity
uint32_t OCPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:86
TIM_TypeDef::CCR4
__IO uint32_t CCR4
Definition: stm32f407xx.h:747
IS_TIM_IC_PRESCALER
#define IS_TIM_IC_PRESCALER(__PRESCALER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1570
IS_TIM_TRIGGER_SELECTION
#define IS_TIM_TRIGGER_SELECTION(__SELECTION__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1682
IS_TIM_CLEARINPUT_FILTER
#define IS_TIM_CLEARINPUT_FILTER(__ICFILTER__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1629
IS_TIM_XOR_INSTANCE
#define IS_TIM_XOR_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15221
HAL_TIM_Base_Stop_DMA
HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim)
TIM_SMCR_TS
#define TIM_SMCR_TS
Definition: stm32f407xx.h:11985
TIM_CCMR1_OC1FE
#define TIM_CCMR1_OC1FE
Definition: stm32f407xx.h:12135
TIM_TypeDef::CCR2
__IO uint32_t CCR2
Definition: stm32f407xx.h:745
HAL_TIM_Base_Start_IT
HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim)
TIM_DMA_COM
#define TIM_DMA_COM
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:679
HAL_TIM_STATE_READY
@ HAL_TIM_STATE_READY
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:291
TIM_SLAVEMODE_GATED
#define TIM_SLAVEMODE_GATED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:861
TIM_TS_ITR0
#define TIM_TS_ITR0
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:886
IS_TIM_CHANNELS
#define IS_TIM_CHANNELS(__CHANNEL__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1584
__DMA_HandleTypeDef::XferErrorCallback
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:159
HAL_TIM_PWM_GetState
HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(TIM_HandleTypeDef *htim)
__HAL_TIM_GET_FLAG
#define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__)
Check whether the specified TIM interrupt flag is set or not.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1152
HAL_TIM_ACTIVE_CHANNEL_4
@ HAL_TIM_ACTIVE_CHANNEL_4
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:305
TIM_TI1_SetConfig
void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
HAL_TIM_ACTIVE_CHANNEL_1
@ HAL_TIM_ACTIVE_CHANNEL_1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:302
TIM_FLAG_TRIGGER
#define TIM_FLAG_TRIGGER
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:694
TIM_SlaveConfigTypeDef
TIM Slave configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:245
HAL_TIM_Base_DeInit
HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim)


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:52