stm32h7xx_hal_tim.c
Go to the documentation of this file.
1 
186 /* Includes ------------------------------------------------------------------*/
187 #include "stm32h7xx_hal.h"
188 
198 #ifdef HAL_TIM_MODULE_ENABLED
199 
200 /* Private typedef -----------------------------------------------------------*/
201 /* Private define ------------------------------------------------------------*/
202 /* Private macros ------------------------------------------------------------*/
203 /* Private variables ---------------------------------------------------------*/
204 /* Private function prototypes -----------------------------------------------*/
208 static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
209 static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
210 static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
211 static void TIM_OC5_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
212 static void TIM_OC6_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config);
213 static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter);
214 static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
215  uint32_t TIM_ICFilter);
216 static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter);
217 static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
218  uint32_t TIM_ICFilter);
219 static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
220  uint32_t TIM_ICFilter);
221 static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource);
222 static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma);
223 static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma);
224 static void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma);
225 static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma);
226 static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma);
227 static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
228  TIM_SlaveConfigTypeDef *sSlaveConfig);
232 /* Exported functions --------------------------------------------------------*/
233 
270 {
271  /* Check the TIM handle allocation */
272  if (htim == NULL)
273  {
274  return HAL_ERROR;
275  }
276 
277  /* Check the parameters */
282 
283  if (htim->State == HAL_TIM_STATE_RESET)
284  {
285  /* Allocate lock resource and initialize it */
286  htim->Lock = HAL_UNLOCKED;
287 
288 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
289  /* Reset interrupt callbacks to legacy weak callbacks */
290  TIM_ResetCallback(htim);
291 
292  if (htim->Base_MspInitCallback == NULL)
293  {
294  htim->Base_MspInitCallback = HAL_TIM_Base_MspInit;
295  }
296  /* Init the low level hardware : GPIO, CLOCK, NVIC */
297  htim->Base_MspInitCallback(htim);
298 #else
299  /* Init the low level hardware : GPIO, CLOCK, NVIC */
300  HAL_TIM_Base_MspInit(htim);
301 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
302  }
303 
304  /* Set the TIM state */
305  htim->State = HAL_TIM_STATE_BUSY;
306 
307  /* Set the Time Base configuration */
308  TIM_Base_SetConfig(htim->Instance, &htim->Init);
309 
310  /* Initialize the DMA burst operation state */
312 
313  /* Initialize the TIM channels state */
316 
317  /* Initialize the TIM state*/
318  htim->State = HAL_TIM_STATE_READY;
319 
320  return HAL_OK;
321 }
322 
329 {
330  /* Check the parameters */
332 
333  htim->State = HAL_TIM_STATE_BUSY;
334 
335  /* Disable the TIM Peripheral Clock */
336  __HAL_TIM_DISABLE(htim);
337 
338 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
339  if (htim->Base_MspDeInitCallback == NULL)
340  {
341  htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit;
342  }
343  /* DeInit the low level hardware */
344  htim->Base_MspDeInitCallback(htim);
345 #else
346  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
348 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
349 
350  /* Change the DMA burst operation state */
352 
353  /* Change the TIM channels state */
356 
357  /* Change TIM state */
358  htim->State = HAL_TIM_STATE_RESET;
359 
360  /* Release Lock */
361  __HAL_UNLOCK(htim);
362 
363  return HAL_OK;
364 }
365 
371 __weak void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
372 {
373  /* Prevent unused argument(s) compilation warning */
374  UNUSED(htim);
375 
376  /* NOTE : This function should not be modified, when the callback is needed,
377  the HAL_TIM_Base_MspInit could be implemented in the user file
378  */
379 }
380 
386 __weak void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim)
387 {
388  /* Prevent unused argument(s) compilation warning */
389  UNUSED(htim);
390 
391  /* NOTE : This function should not be modified, when the callback is needed,
392  the HAL_TIM_Base_MspDeInit could be implemented in the user file
393  */
394 }
395 
396 
403 {
404  uint32_t tmpsmcr;
405 
406  /* Check the parameters */
408 
409  /* Check the TIM state */
410  if (htim->State != HAL_TIM_STATE_READY)
411  {
412  return HAL_ERROR;
413  }
414 
415  /* Set the TIM state */
416  htim->State = HAL_TIM_STATE_BUSY;
417 
418  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
419  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
420  {
421  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
422  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
423  {
424  __HAL_TIM_ENABLE(htim);
425  }
426  }
427  else
428  {
429  __HAL_TIM_ENABLE(htim);
430  }
431 
432  /* Return function status */
433  return HAL_OK;
434 }
435 
442 {
443  /* Check the parameters */
445 
446  /* Disable the Peripheral */
447  __HAL_TIM_DISABLE(htim);
448 
449  /* Set the TIM state */
450  htim->State = HAL_TIM_STATE_READY;
451 
452  /* Return function status */
453  return HAL_OK;
454 }
455 
462 {
463  uint32_t tmpsmcr;
464 
465  /* Check the parameters */
467 
468  /* Check the TIM state */
469  if (htim->State != HAL_TIM_STATE_READY)
470  {
471  return HAL_ERROR;
472  }
473 
474  /* Set the TIM state */
475  htim->State = HAL_TIM_STATE_BUSY;
476 
477  /* Enable the TIM Update interrupt */
479 
480  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
481  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
482  {
483  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
484  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
485  {
486  __HAL_TIM_ENABLE(htim);
487  }
488  }
489  else
490  {
491  __HAL_TIM_ENABLE(htim);
492  }
493 
494  /* Return function status */
495  return HAL_OK;
496 }
497 
504 {
505  /* Check the parameters */
507 
508  /* Disable the TIM Update interrupt */
510 
511  /* Disable the Peripheral */
512  __HAL_TIM_DISABLE(htim);
513 
514  /* Set the TIM state */
515  htim->State = HAL_TIM_STATE_READY;
516 
517  /* Return function status */
518  return HAL_OK;
519 }
520 
528 HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
529 {
530  uint32_t tmpsmcr;
531 
532  /* Check the parameters */
534 
535  /* Set the TIM state */
536  if (htim->State == HAL_TIM_STATE_BUSY)
537  {
538  return HAL_BUSY;
539  }
540  else if (htim->State == HAL_TIM_STATE_READY)
541  {
542  if ((pData == NULL) && (Length > 0U))
543  {
544  return HAL_ERROR;
545  }
546  else
547  {
548  htim->State = HAL_TIM_STATE_BUSY;
549  }
550  }
551  else
552  {
553  return HAL_ERROR;
554  }
555 
556  /* Set the DMA Period elapsed callbacks */
557  htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
558  htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt;
559 
560  /* Set the DMA error callback */
562 
563  /* Enable the DMA stream */
564  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)pData, (uint32_t)&htim->Instance->ARR, Length) != HAL_OK)
565  {
566  /* Return error status */
567  return HAL_ERROR;
568  }
569 
570  /* Enable the TIM Update DMA request */
572 
573  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
574  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
575  {
576  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
577  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
578  {
579  __HAL_TIM_ENABLE(htim);
580  }
581  }
582  else
583  {
584  __HAL_TIM_ENABLE(htim);
585  }
586 
587  /* Return function status */
588  return HAL_OK;
589 }
590 
597 {
598  /* Check the parameters */
600 
601  /* Disable the TIM Update DMA request */
603 
605 
606  /* Disable the Peripheral */
607  __HAL_TIM_DISABLE(htim);
608 
609  /* Set the TIM state */
610  htim->State = HAL_TIM_STATE_READY;
611 
612  /* Return function status */
613  return HAL_OK;
614 }
615 
652 {
653  /* Check the TIM handle allocation */
654  if (htim == NULL)
655  {
656  return HAL_ERROR;
657  }
658 
659  /* Check the parameters */
664 
665  if (htim->State == HAL_TIM_STATE_RESET)
666  {
667  /* Allocate lock resource and initialize it */
668  htim->Lock = HAL_UNLOCKED;
669 
670 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
671  /* Reset interrupt callbacks to legacy weak callbacks */
672  TIM_ResetCallback(htim);
673 
674  if (htim->OC_MspInitCallback == NULL)
675  {
676  htim->OC_MspInitCallback = HAL_TIM_OC_MspInit;
677  }
678  /* Init the low level hardware : GPIO, CLOCK, NVIC */
679  htim->OC_MspInitCallback(htim);
680 #else
681  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
682  HAL_TIM_OC_MspInit(htim);
683 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
684  }
685 
686  /* Set the TIM state */
687  htim->State = HAL_TIM_STATE_BUSY;
688 
689  /* Init the base time for the Output Compare */
690  TIM_Base_SetConfig(htim->Instance, &htim->Init);
691 
692  /* Initialize the DMA burst operation state */
694 
695  /* Initialize the TIM channels state */
698 
699  /* Initialize the TIM state*/
700  htim->State = HAL_TIM_STATE_READY;
701 
702  return HAL_OK;
703 }
704 
711 {
712  /* Check the parameters */
714 
715  htim->State = HAL_TIM_STATE_BUSY;
716 
717  /* Disable the TIM Peripheral Clock */
718  __HAL_TIM_DISABLE(htim);
719 
720 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
721  if (htim->OC_MspDeInitCallback == NULL)
722  {
723  htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit;
724  }
725  /* DeInit the low level hardware */
726  htim->OC_MspDeInitCallback(htim);
727 #else
728  /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */
729  HAL_TIM_OC_MspDeInit(htim);
730 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
731 
732  /* Change the DMA burst operation state */
734 
735  /* Change the TIM channels state */
738 
739  /* Change TIM state */
740  htim->State = HAL_TIM_STATE_RESET;
741 
742  /* Release Lock */
743  __HAL_UNLOCK(htim);
744 
745  return HAL_OK;
746 }
747 
753 __weak void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
754 {
755  /* Prevent unused argument(s) compilation warning */
756  UNUSED(htim);
757 
758  /* NOTE : This function should not be modified, when the callback is needed,
759  the HAL_TIM_OC_MspInit could be implemented in the user file
760  */
761 }
762 
768 __weak void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim)
769 {
770  /* Prevent unused argument(s) compilation warning */
771  UNUSED(htim);
772 
773  /* NOTE : This function should not be modified, when the callback is needed,
774  the HAL_TIM_OC_MspDeInit could be implemented in the user file
775  */
776 }
777 
792 {
793  uint32_t tmpsmcr;
794 
795  /* Check the parameters */
796  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
797 
798  /* Check the TIM channel state */
800  {
801  return HAL_ERROR;
802  }
803 
804  /* Set the TIM channel state */
806 
807  /* Enable the Output compare channel */
808  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
809 
810  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
811  {
812  /* Enable the main output */
813  __HAL_TIM_MOE_ENABLE(htim);
814  }
815 
816  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
817  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
818  {
819  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
820  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
821  {
822  __HAL_TIM_ENABLE(htim);
823  }
824  }
825  else
826  {
827  __HAL_TIM_ENABLE(htim);
828  }
829 
830  /* Return function status */
831  return HAL_OK;
832 }
833 
847 HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
848 {
849  /* Check the parameters */
850  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
851 
852  /* Disable the Output compare channel */
853  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
854 
855  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
856  {
857  /* Disable the Main Output */
858  __HAL_TIM_MOE_DISABLE(htim);
859  }
860 
861  /* Disable the Peripheral */
862  __HAL_TIM_DISABLE(htim);
863 
864  /* Set the TIM channel state */
866 
867  /* Return function status */
868  return HAL_OK;
869 }
870 
883 {
884  uint32_t tmpsmcr;
885 
886  /* Check the parameters */
887  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
888 
889  /* Check the TIM channel state */
891  {
892  return HAL_ERROR;
893  }
894 
895  /* Set the TIM channel state */
897 
898  switch (Channel)
899  {
900  case TIM_CHANNEL_1:
901  {
902  /* Enable the TIM Capture/Compare 1 interrupt */
904  break;
905  }
906 
907  case TIM_CHANNEL_2:
908  {
909  /* Enable the TIM Capture/Compare 2 interrupt */
911  break;
912  }
913 
914  case TIM_CHANNEL_3:
915  {
916  /* Enable the TIM Capture/Compare 3 interrupt */
918  break;
919  }
920 
921  case TIM_CHANNEL_4:
922  {
923  /* Enable the TIM Capture/Compare 4 interrupt */
925  break;
926  }
927 
928  default:
929  break;
930  }
931 
932  /* Enable the Output compare channel */
933  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
934 
935  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
936  {
937  /* Enable the main output */
938  __HAL_TIM_MOE_ENABLE(htim);
939  }
940 
941  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
942  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
943  {
944  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
945  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
946  {
947  __HAL_TIM_ENABLE(htim);
948  }
949  }
950  else
951  {
952  __HAL_TIM_ENABLE(htim);
953  }
954 
955  /* Return function status */
956  return HAL_OK;
957 }
958 
971 {
972  /* Check the parameters */
973  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
974 
975  switch (Channel)
976  {
977  case TIM_CHANNEL_1:
978  {
979  /* Disable the TIM Capture/Compare 1 interrupt */
981  break;
982  }
983 
984  case TIM_CHANNEL_2:
985  {
986  /* Disable the TIM Capture/Compare 2 interrupt */
988  break;
989  }
990 
991  case TIM_CHANNEL_3:
992  {
993  /* Disable the TIM Capture/Compare 3 interrupt */
995  break;
996  }
997 
998  case TIM_CHANNEL_4:
999  {
1000  /* Disable the TIM Capture/Compare 4 interrupt */
1002  break;
1003  }
1004 
1005  default:
1006  break;
1007  }
1008 
1009  /* Disable the Output compare channel */
1010  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1011 
1012  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1013  {
1014  /* Disable the Main Output */
1015  __HAL_TIM_MOE_DISABLE(htim);
1016  }
1017 
1018  /* Disable the Peripheral */
1019  __HAL_TIM_DISABLE(htim);
1020 
1021  /* Set the TIM channel state */
1023 
1024  /* Return function status */
1025  return HAL_OK;
1026 }
1027 
1041 HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
1042 {
1043  uint32_t tmpsmcr;
1044 
1045  /* Check the parameters */
1046  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1047 
1048  /* Set the TIM channel state */
1049  if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_BUSY)
1050  {
1051  return HAL_BUSY;
1052  }
1053  else if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_READY)
1054  {
1055  if ((pData == NULL) && (Length > 0U))
1056  {
1057  return HAL_ERROR;
1058  }
1059  else
1060  {
1062  }
1063  }
1064  else
1065  {
1066  return HAL_ERROR;
1067  }
1068 
1069  switch (Channel)
1070  {
1071  case TIM_CHANNEL_1:
1072  {
1073  /* Set the DMA compare callbacks */
1076 
1077  /* Set the DMA error callback */
1079 
1080  /* Enable the DMA stream */
1081  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK)
1082  {
1083  /* Return error status */
1084  return HAL_ERROR;
1085  }
1086 
1087  /* Enable the TIM Capture/Compare 1 DMA request */
1089  break;
1090  }
1091 
1092  case TIM_CHANNEL_2:
1093  {
1094  /* Set the DMA compare callbacks */
1097 
1098  /* Set the DMA error callback */
1100 
1101  /* Enable the DMA stream */
1102  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK)
1103  {
1104  /* Return error status */
1105  return HAL_ERROR;
1106  }
1107 
1108  /* Enable the TIM Capture/Compare 2 DMA request */
1110  break;
1111  }
1112 
1113  case TIM_CHANNEL_3:
1114  {
1115  /* Set the DMA compare callbacks */
1118 
1119  /* Set the DMA error callback */
1121 
1122  /* Enable the DMA stream */
1123  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK)
1124  {
1125  /* Return error status */
1126  return HAL_ERROR;
1127  }
1128  /* Enable the TIM Capture/Compare 3 DMA request */
1130  break;
1131  }
1132 
1133  case TIM_CHANNEL_4:
1134  {
1135  /* Set the DMA compare callbacks */
1138 
1139  /* Set the DMA error callback */
1141 
1142  /* Enable the DMA stream */
1143  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length) != HAL_OK)
1144  {
1145  /* Return error status */
1146  return HAL_ERROR;
1147  }
1148  /* Enable the TIM Capture/Compare 4 DMA request */
1150  break;
1151  }
1152 
1153  default:
1154  break;
1155  }
1156 
1157  /* Enable the Output compare channel */
1158  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1159 
1160  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1161  {
1162  /* Enable the main output */
1163  __HAL_TIM_MOE_ENABLE(htim);
1164  }
1165 
1166  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1167  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
1168  {
1169  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1170  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1171  {
1172  __HAL_TIM_ENABLE(htim);
1173  }
1174  }
1175  else
1176  {
1177  __HAL_TIM_ENABLE(htim);
1178  }
1179 
1180  /* Return function status */
1181  return HAL_OK;
1182 }
1183 
1196 {
1197  /* Check the parameters */
1198  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1199 
1200  switch (Channel)
1201  {
1202  case TIM_CHANNEL_1:
1203  {
1204  /* Disable the TIM Capture/Compare 1 DMA request */
1206  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
1207  break;
1208  }
1209 
1210  case TIM_CHANNEL_2:
1211  {
1212  /* Disable the TIM Capture/Compare 2 DMA request */
1214  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
1215  break;
1216  }
1217 
1218  case TIM_CHANNEL_3:
1219  {
1220  /* Disable the TIM Capture/Compare 3 DMA request */
1222  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
1223  break;
1224  }
1225 
1226  case TIM_CHANNEL_4:
1227  {
1228  /* Disable the TIM Capture/Compare 4 interrupt */
1230  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
1231  break;
1232  }
1233 
1234  default:
1235  break;
1236  }
1237 
1238  /* Disable the Output compare channel */
1239  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1240 
1241  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1242  {
1243  /* Disable the Main Output */
1244  __HAL_TIM_MOE_DISABLE(htim);
1245  }
1246 
1247  /* Disable the Peripheral */
1248  __HAL_TIM_DISABLE(htim);
1249 
1250  /* Set the TIM channel state */
1252 
1253  /* Return function status */
1254  return HAL_OK;
1255 }
1256 
1293 {
1294  /* Check the TIM handle allocation */
1295  if (htim == NULL)
1296  {
1297  return HAL_ERROR;
1298  }
1299 
1300  /* Check the parameters */
1305 
1306  if (htim->State == HAL_TIM_STATE_RESET)
1307  {
1308  /* Allocate lock resource and initialize it */
1309  htim->Lock = HAL_UNLOCKED;
1310 
1311 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1312  /* Reset interrupt callbacks to legacy weak callbacks */
1313  TIM_ResetCallback(htim);
1314 
1315  if (htim->PWM_MspInitCallback == NULL)
1316  {
1317  htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit;
1318  }
1319  /* Init the low level hardware : GPIO, CLOCK, NVIC */
1320  htim->PWM_MspInitCallback(htim);
1321 #else
1322  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
1323  HAL_TIM_PWM_MspInit(htim);
1324 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1325  }
1326 
1327  /* Set the TIM state */
1328  htim->State = HAL_TIM_STATE_BUSY;
1329 
1330  /* Init the base time for the PWM */
1331  TIM_Base_SetConfig(htim->Instance, &htim->Init);
1332 
1333  /* Initialize the DMA burst operation state */
1335 
1336  /* Initialize the TIM channels state */
1339 
1340  /* Initialize the TIM state*/
1341  htim->State = HAL_TIM_STATE_READY;
1342 
1343  return HAL_OK;
1344 }
1345 
1352 {
1353  /* Check the parameters */
1355 
1356  htim->State = HAL_TIM_STATE_BUSY;
1357 
1358  /* Disable the TIM Peripheral Clock */
1359  __HAL_TIM_DISABLE(htim);
1360 
1361 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1362  if (htim->PWM_MspDeInitCallback == NULL)
1363  {
1364  htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit;
1365  }
1366  /* DeInit the low level hardware */
1367  htim->PWM_MspDeInitCallback(htim);
1368 #else
1369  /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */
1370  HAL_TIM_PWM_MspDeInit(htim);
1371 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1372 
1373  /* Change the DMA burst operation state */
1375 
1376  /* Change the TIM channels state */
1379 
1380  /* Change TIM state */
1381  htim->State = HAL_TIM_STATE_RESET;
1382 
1383  /* Release Lock */
1384  __HAL_UNLOCK(htim);
1385 
1386  return HAL_OK;
1387 }
1388 
1394 __weak void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim)
1395 {
1396  /* Prevent unused argument(s) compilation warning */
1397  UNUSED(htim);
1398 
1399  /* NOTE : This function should not be modified, when the callback is needed,
1400  the HAL_TIM_PWM_MspInit could be implemented in the user file
1401  */
1402 }
1403 
1409 __weak void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim)
1410 {
1411  /* Prevent unused argument(s) compilation warning */
1412  UNUSED(htim);
1413 
1414  /* NOTE : This function should not be modified, when the callback is needed,
1415  the HAL_TIM_PWM_MspDeInit could be implemented in the user file
1416  */
1417 }
1418 
1432 HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
1433 {
1434  uint32_t tmpsmcr;
1435 
1436  /* Check the parameters */
1437  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1438 
1439  /* Check the TIM channel state */
1440  if (TIM_CHANNEL_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY)
1441  {
1442  return HAL_ERROR;
1443  }
1444 
1445  /* Set the TIM channel state */
1447 
1448  /* Enable the Capture compare channel */
1449  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1450 
1451  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1452  {
1453  /* Enable the main output */
1454  __HAL_TIM_MOE_ENABLE(htim);
1455  }
1456 
1457  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1458  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
1459  {
1460  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1461  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1462  {
1463  __HAL_TIM_ENABLE(htim);
1464  }
1465  }
1466  else
1467  {
1468  __HAL_TIM_ENABLE(htim);
1469  }
1470 
1471  /* Return function status */
1472  return HAL_OK;
1473 }
1474 
1488 HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
1489 {
1490  /* Check the parameters */
1491  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1492 
1493  /* Disable the Capture compare channel */
1494  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1495 
1496  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1497  {
1498  /* Disable the Main Output */
1499  __HAL_TIM_MOE_DISABLE(htim);
1500  }
1501 
1502  /* Disable the Peripheral */
1503  __HAL_TIM_DISABLE(htim);
1504 
1505  /* Set the TIM channel state */
1507 
1508  /* Return function status */
1509  return HAL_OK;
1510 }
1511 
1524 {
1525  uint32_t tmpsmcr;
1526  /* Check the parameters */
1527  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1528 
1529  /* Check the TIM channel state */
1530  if (TIM_CHANNEL_STATE_GET(htim, Channel) != HAL_TIM_CHANNEL_STATE_READY)
1531  {
1532  return HAL_ERROR;
1533  }
1534 
1535  /* Set the TIM channel state */
1537 
1538  switch (Channel)
1539  {
1540  case TIM_CHANNEL_1:
1541  {
1542  /* Enable the TIM Capture/Compare 1 interrupt */
1544  break;
1545  }
1546 
1547  case TIM_CHANNEL_2:
1548  {
1549  /* Enable the TIM Capture/Compare 2 interrupt */
1551  break;
1552  }
1553 
1554  case TIM_CHANNEL_3:
1555  {
1556  /* Enable the TIM Capture/Compare 3 interrupt */
1558  break;
1559  }
1560 
1561  case TIM_CHANNEL_4:
1562  {
1563  /* Enable the TIM Capture/Compare 4 interrupt */
1565  break;
1566  }
1567 
1568  default:
1569  break;
1570  }
1571 
1572  /* Enable the Capture compare channel */
1573  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1574 
1575  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1576  {
1577  /* Enable the main output */
1578  __HAL_TIM_MOE_ENABLE(htim);
1579  }
1580 
1581  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1582  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
1583  {
1584  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1585  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1586  {
1587  __HAL_TIM_ENABLE(htim);
1588  }
1589  }
1590  else
1591  {
1592  __HAL_TIM_ENABLE(htim);
1593  }
1594 
1595  /* Return function status */
1596  return HAL_OK;
1597 }
1598 
1611 {
1612  /* Check the parameters */
1613  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1614 
1615  switch (Channel)
1616  {
1617  case TIM_CHANNEL_1:
1618  {
1619  /* Disable the TIM Capture/Compare 1 interrupt */
1621  break;
1622  }
1623 
1624  case TIM_CHANNEL_2:
1625  {
1626  /* Disable the TIM Capture/Compare 2 interrupt */
1628  break;
1629  }
1630 
1631  case TIM_CHANNEL_3:
1632  {
1633  /* Disable the TIM Capture/Compare 3 interrupt */
1635  break;
1636  }
1637 
1638  case TIM_CHANNEL_4:
1639  {
1640  /* Disable the TIM Capture/Compare 4 interrupt */
1642  break;
1643  }
1644 
1645  default:
1646  break;
1647  }
1648 
1649  /* Disable the Capture compare channel */
1650  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1651 
1652  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1653  {
1654  /* Disable the Main Output */
1655  __HAL_TIM_MOE_DISABLE(htim);
1656  }
1657 
1658  /* Disable the Peripheral */
1659  __HAL_TIM_DISABLE(htim);
1660 
1661  /* Set the TIM channel state */
1663 
1664  /* Return function status */
1665  return HAL_OK;
1666 }
1667 
1681 HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
1682 {
1683  uint32_t tmpsmcr;
1684 
1685  /* Check the parameters */
1686  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1687 
1688  /* Set the TIM channel state */
1689  if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_BUSY)
1690  {
1691  return HAL_BUSY;
1692  }
1693  else if (TIM_CHANNEL_STATE_GET(htim, Channel) == HAL_TIM_CHANNEL_STATE_READY)
1694  {
1695  if ((pData == NULL) && (Length > 0U))
1696  {
1697  return HAL_ERROR;
1698  }
1699  else
1700  {
1702  }
1703  }
1704  else
1705  {
1706  return HAL_ERROR;
1707  }
1708 
1709  switch (Channel)
1710  {
1711  case TIM_CHANNEL_1:
1712  {
1713  /* Set the DMA compare callbacks */
1716 
1717  /* Set the DMA error callback */
1719 
1720  /* Enable the DMA stream */
1721  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK)
1722  {
1723  /* Return error status */
1724  return HAL_ERROR;
1725  }
1726 
1727  /* Enable the TIM Capture/Compare 1 DMA request */
1729  break;
1730  }
1731 
1732  case TIM_CHANNEL_2:
1733  {
1734  /* Set the DMA compare callbacks */
1737 
1738  /* Set the DMA error callback */
1740 
1741  /* Enable the DMA stream */
1742  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK)
1743  {
1744  /* Return error status */
1745  return HAL_ERROR;
1746  }
1747  /* Enable the TIM Capture/Compare 2 DMA request */
1749  break;
1750  }
1751 
1752  case TIM_CHANNEL_3:
1753  {
1754  /* Set the DMA compare callbacks */
1757 
1758  /* Set the DMA error callback */
1760 
1761  /* Enable the DMA stream */
1762  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK)
1763  {
1764  /* Return error status */
1765  return HAL_ERROR;
1766  }
1767  /* Enable the TIM Output Capture/Compare 3 request */
1769  break;
1770  }
1771 
1772  case TIM_CHANNEL_4:
1773  {
1774  /* Set the DMA compare callbacks */
1777 
1778  /* Set the DMA error callback */
1780 
1781  /* Enable the DMA stream */
1782  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)pData, (uint32_t)&htim->Instance->CCR4, Length) != HAL_OK)
1783  {
1784  /* Return error status */
1785  return HAL_ERROR;
1786  }
1787  /* Enable the TIM Capture/Compare 4 DMA request */
1789  break;
1790  }
1791 
1792  default:
1793  break;
1794  }
1795 
1796  /* Enable the Capture compare channel */
1797  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
1798 
1799  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1800  {
1801  /* Enable the main output */
1802  __HAL_TIM_MOE_ENABLE(htim);
1803  }
1804 
1805  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1806  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
1807  {
1808  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1809  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1810  {
1811  __HAL_TIM_ENABLE(htim);
1812  }
1813  }
1814  else
1815  {
1816  __HAL_TIM_ENABLE(htim);
1817  }
1818 
1819  /* Return function status */
1820  return HAL_OK;
1821 }
1822 
1835 {
1836  /* Check the parameters */
1837  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
1838 
1839  switch (Channel)
1840  {
1841  case TIM_CHANNEL_1:
1842  {
1843  /* Disable the TIM Capture/Compare 1 DMA request */
1845  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
1846  break;
1847  }
1848 
1849  case TIM_CHANNEL_2:
1850  {
1851  /* Disable the TIM Capture/Compare 2 DMA request */
1853  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
1854  break;
1855  }
1856 
1857  case TIM_CHANNEL_3:
1858  {
1859  /* Disable the TIM Capture/Compare 3 DMA request */
1861  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
1862  break;
1863  }
1864 
1865  case TIM_CHANNEL_4:
1866  {
1867  /* Disable the TIM Capture/Compare 4 interrupt */
1869  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
1870  break;
1871  }
1872 
1873  default:
1874  break;
1875  }
1876 
1877  /* Disable the Capture compare channel */
1878  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
1879 
1880  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
1881  {
1882  /* Disable the Main Output */
1883  __HAL_TIM_MOE_DISABLE(htim);
1884  }
1885 
1886  /* Disable the Peripheral */
1887  __HAL_TIM_DISABLE(htim);
1888 
1889  /* Set the TIM channel state */
1891 
1892  /* Return function status */
1893  return HAL_OK;
1894 }
1895 
1932 {
1933  /* Check the TIM handle allocation */
1934  if (htim == NULL)
1935  {
1936  return HAL_ERROR;
1937  }
1938 
1939  /* Check the parameters */
1944 
1945  if (htim->State == HAL_TIM_STATE_RESET)
1946  {
1947  /* Allocate lock resource and initialize it */
1948  htim->Lock = HAL_UNLOCKED;
1949 
1950 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1951  /* Reset interrupt callbacks to legacy weak callbacks */
1952  TIM_ResetCallback(htim);
1953 
1954  if (htim->IC_MspInitCallback == NULL)
1955  {
1956  htim->IC_MspInitCallback = HAL_TIM_IC_MspInit;
1957  }
1958  /* Init the low level hardware : GPIO, CLOCK, NVIC */
1959  htim->IC_MspInitCallback(htim);
1960 #else
1961  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
1962  HAL_TIM_IC_MspInit(htim);
1963 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1964  }
1965 
1966  /* Set the TIM state */
1967  htim->State = HAL_TIM_STATE_BUSY;
1968 
1969  /* Init the base time for the input capture */
1970  TIM_Base_SetConfig(htim->Instance, &htim->Init);
1971 
1972  /* Initialize the DMA burst operation state */
1974 
1975  /* Initialize the TIM channels state */
1978 
1979  /* Initialize the TIM state*/
1980  htim->State = HAL_TIM_STATE_READY;
1981 
1982  return HAL_OK;
1983 }
1984 
1991 {
1992  /* Check the parameters */
1994 
1995  htim->State = HAL_TIM_STATE_BUSY;
1996 
1997  /* Disable the TIM Peripheral Clock */
1998  __HAL_TIM_DISABLE(htim);
1999 
2000 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2001  if (htim->IC_MspDeInitCallback == NULL)
2002  {
2003  htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit;
2004  }
2005  /* DeInit the low level hardware */
2006  htim->IC_MspDeInitCallback(htim);
2007 #else
2008  /* DeInit the low level hardware: GPIO, CLOCK, NVIC and DMA */
2009  HAL_TIM_IC_MspDeInit(htim);
2010 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2011 
2012  /* Change the DMA burst operation state */
2014 
2015  /* Change the TIM channels state */
2018 
2019  /* Change TIM state */
2020  htim->State = HAL_TIM_STATE_RESET;
2021 
2022  /* Release Lock */
2023  __HAL_UNLOCK(htim);
2024 
2025  return HAL_OK;
2026 }
2027 
2033 __weak void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim)
2034 {
2035  /* Prevent unused argument(s) compilation warning */
2036  UNUSED(htim);
2037 
2038  /* NOTE : This function should not be modified, when the callback is needed,
2039  the HAL_TIM_IC_MspInit could be implemented in the user file
2040  */
2041 }
2042 
2048 __weak void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim)
2049 {
2050  /* Prevent unused argument(s) compilation warning */
2051  UNUSED(htim);
2052 
2053  /* NOTE : This function should not be modified, when the callback is needed,
2054  the HAL_TIM_IC_MspDeInit could be implemented in the user file
2055  */
2056 }
2057 
2069 HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
2070 {
2071  uint32_t tmpsmcr;
2072  HAL_TIM_ChannelStateTypeDef channel_state = TIM_CHANNEL_STATE_GET(htim, Channel);
2073  HAL_TIM_ChannelStateTypeDef complementary_channel_state = TIM_CHANNEL_N_STATE_GET(htim, Channel);
2074 
2075  /* Check the parameters */
2076  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2077 
2078  /* Check the TIM channel state */
2079  if ((channel_state != HAL_TIM_CHANNEL_STATE_READY)
2080  || (complementary_channel_state != HAL_TIM_CHANNEL_STATE_READY))
2081  {
2082  return HAL_ERROR;
2083  }
2084 
2085  /* Set the TIM channel state */
2088 
2089  /* Enable the Input Capture channel */
2090  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
2091 
2092  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
2093  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
2094  {
2095  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
2096  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
2097  {
2098  __HAL_TIM_ENABLE(htim);
2099  }
2100  }
2101  else
2102  {
2103  __HAL_TIM_ENABLE(htim);
2104  }
2105 
2106  /* Return function status */
2107  return HAL_OK;
2108 }
2109 
2121 HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
2122 {
2123  /* Check the parameters */
2124  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2125 
2126  /* Disable the Input Capture channel */
2127  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
2128 
2129  /* Disable the Peripheral */
2130  __HAL_TIM_DISABLE(htim);
2131 
2132  /* Set the TIM channel state */
2135 
2136  /* Return function status */
2137  return HAL_OK;
2138 }
2139 
2152 {
2153  uint32_t tmpsmcr;
2154  HAL_TIM_ChannelStateTypeDef channel_state = TIM_CHANNEL_STATE_GET(htim, Channel);
2155  HAL_TIM_ChannelStateTypeDef complementary_channel_state = TIM_CHANNEL_N_STATE_GET(htim, Channel);
2156 
2157  /* Check the parameters */
2158  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2159 
2160  /* Check the TIM channel state */
2161  if ((channel_state != HAL_TIM_CHANNEL_STATE_READY)
2162  || (complementary_channel_state != HAL_TIM_CHANNEL_STATE_READY))
2163  {
2164  return HAL_ERROR;
2165  }
2166 
2167  /* Set the TIM channel state */
2170 
2171  switch (Channel)
2172  {
2173  case TIM_CHANNEL_1:
2174  {
2175  /* Enable the TIM Capture/Compare 1 interrupt */
2177  break;
2178  }
2179 
2180  case TIM_CHANNEL_2:
2181  {
2182  /* Enable the TIM Capture/Compare 2 interrupt */
2184  break;
2185  }
2186 
2187  case TIM_CHANNEL_3:
2188  {
2189  /* Enable the TIM Capture/Compare 3 interrupt */
2191  break;
2192  }
2193 
2194  case TIM_CHANNEL_4:
2195  {
2196  /* Enable the TIM Capture/Compare 4 interrupt */
2198  break;
2199  }
2200 
2201  default:
2202  break;
2203  }
2204  /* Enable the Input Capture channel */
2205  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
2206 
2207  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
2208  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
2209  {
2210  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
2211  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
2212  {
2213  __HAL_TIM_ENABLE(htim);
2214  }
2215  }
2216  else
2217  {
2218  __HAL_TIM_ENABLE(htim);
2219  }
2220 
2221  /* Return function status */
2222  return HAL_OK;
2223 }
2224 
2237 {
2238  /* Check the parameters */
2239  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2240 
2241  switch (Channel)
2242  {
2243  case TIM_CHANNEL_1:
2244  {
2245  /* Disable the TIM Capture/Compare 1 interrupt */
2247  break;
2248  }
2249 
2250  case TIM_CHANNEL_2:
2251  {
2252  /* Disable the TIM Capture/Compare 2 interrupt */
2254  break;
2255  }
2256 
2257  case TIM_CHANNEL_3:
2258  {
2259  /* Disable the TIM Capture/Compare 3 interrupt */
2261  break;
2262  }
2263 
2264  case TIM_CHANNEL_4:
2265  {
2266  /* Disable the TIM Capture/Compare 4 interrupt */
2268  break;
2269  }
2270 
2271  default:
2272  break;
2273  }
2274 
2275  /* Disable the Input Capture channel */
2276  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
2277 
2278  /* Disable the Peripheral */
2279  __HAL_TIM_DISABLE(htim);
2280 
2281  /* Set the TIM channel state */
2284 
2285  /* Return function status */
2286  return HAL_OK;
2287 }
2288 
2302 HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
2303 {
2304  uint32_t tmpsmcr;
2305  HAL_TIM_ChannelStateTypeDef channel_state = TIM_CHANNEL_STATE_GET(htim, Channel);
2306  HAL_TIM_ChannelStateTypeDef complementary_channel_state = TIM_CHANNEL_N_STATE_GET(htim, Channel);
2307 
2308  /* Check the parameters */
2309  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2311 
2312  /* Set the TIM channel state */
2313  if ((channel_state == HAL_TIM_CHANNEL_STATE_BUSY)
2314  || (complementary_channel_state == HAL_TIM_CHANNEL_STATE_BUSY))
2315  {
2316  return HAL_BUSY;
2317  }
2318  else if ((channel_state == HAL_TIM_CHANNEL_STATE_READY)
2319  && (complementary_channel_state == HAL_TIM_CHANNEL_STATE_READY))
2320  {
2321  if ((pData == NULL) && (Length > 0U))
2322  {
2323  return HAL_ERROR;
2324  }
2325  else
2326  {
2329  }
2330  }
2331  else
2332  {
2333  return HAL_ERROR;
2334  }
2335 
2336  switch (Channel)
2337  {
2338  case TIM_CHANNEL_1:
2339  {
2340  /* Set the DMA capture callbacks */
2343 
2344  /* Set the DMA error callback */
2346 
2347  /* Enable the DMA stream */
2348  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length) != HAL_OK)
2349  {
2350  /* Return error status */
2351  return HAL_ERROR;
2352  }
2353  /* Enable the TIM Capture/Compare 1 DMA request */
2355  break;
2356  }
2357 
2358  case TIM_CHANNEL_2:
2359  {
2360  /* Set the DMA capture callbacks */
2363 
2364  /* Set the DMA error callback */
2366 
2367  /* Enable the DMA stream */
2368  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData, Length) != HAL_OK)
2369  {
2370  /* Return error status */
2371  return HAL_ERROR;
2372  }
2373  /* Enable the TIM Capture/Compare 2 DMA request */
2375  break;
2376  }
2377 
2378  case TIM_CHANNEL_3:
2379  {
2380  /* Set the DMA capture callbacks */
2383 
2384  /* Set the DMA error callback */
2386 
2387  /* Enable the DMA stream */
2388  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->CCR3, (uint32_t)pData, Length) != HAL_OK)
2389  {
2390  /* Return error status */
2391  return HAL_ERROR;
2392  }
2393  /* Enable the TIM Capture/Compare 3 DMA request */
2395  break;
2396  }
2397 
2398  case TIM_CHANNEL_4:
2399  {
2400  /* Set the DMA capture callbacks */
2403 
2404  /* Set the DMA error callback */
2406 
2407  /* Enable the DMA stream */
2408  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->CCR4, (uint32_t)pData, Length) != HAL_OK)
2409  {
2410  /* Return error status */
2411  return HAL_ERROR;
2412  }
2413  /* Enable the TIM Capture/Compare 4 DMA request */
2415  break;
2416  }
2417 
2418  default:
2419  break;
2420  }
2421 
2422  /* Enable the Input Capture channel */
2423  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
2424 
2425  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
2426  if (IS_TIM_SLAVE_INSTANCE(htim->Instance))
2427  {
2428  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
2429  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
2430  {
2431  __HAL_TIM_ENABLE(htim);
2432  }
2433  }
2434  else
2435  {
2436  __HAL_TIM_ENABLE(htim);
2437  }
2438 
2439  /* Return function status */
2440  return HAL_OK;
2441 }
2442 
2455 {
2456  /* Check the parameters */
2457  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
2459 
2460  /* Disable the Input Capture channel */
2461  TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_DISABLE);
2462 
2463  switch (Channel)
2464  {
2465  case TIM_CHANNEL_1:
2466  {
2467  /* Disable the TIM Capture/Compare 1 DMA request */
2469  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
2470  break;
2471  }
2472 
2473  case TIM_CHANNEL_2:
2474  {
2475  /* Disable the TIM Capture/Compare 2 DMA request */
2477  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
2478  break;
2479  }
2480 
2481  case TIM_CHANNEL_3:
2482  {
2483  /* Disable the TIM Capture/Compare 3 DMA request */
2485  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
2486  break;
2487  }
2488 
2489  case TIM_CHANNEL_4:
2490  {
2491  /* Disable the TIM Capture/Compare 4 DMA request */
2493  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
2494  break;
2495  }
2496 
2497  default:
2498  break;
2499  }
2500 
2501  /* Disable the Peripheral */
2502  __HAL_TIM_DISABLE(htim);
2503 
2504  /* Set the TIM channel state */
2507 
2508  /* Return function status */
2509  return HAL_OK;
2510 }
2553 HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode)
2554 {
2555  /* Check the TIM handle allocation */
2556  if (htim == NULL)
2557  {
2558  return HAL_ERROR;
2559  }
2560 
2561  /* Check the parameters */
2565  assert_param(IS_TIM_OPM_MODE(OnePulseMode));
2567 
2568  if (htim->State == HAL_TIM_STATE_RESET)
2569  {
2570  /* Allocate lock resource and initialize it */
2571  htim->Lock = HAL_UNLOCKED;
2572 
2573 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2574  /* Reset interrupt callbacks to legacy weak callbacks */
2575  TIM_ResetCallback(htim);
2576 
2577  if (htim->OnePulse_MspInitCallback == NULL)
2578  {
2579  htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit;
2580  }
2581  /* Init the low level hardware : GPIO, CLOCK, NVIC */
2582  htim->OnePulse_MspInitCallback(htim);
2583 #else
2584  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
2586 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2587  }
2588 
2589  /* Set the TIM state */
2590  htim->State = HAL_TIM_STATE_BUSY;
2591 
2592  /* Configure the Time base in the One Pulse Mode */
2593  TIM_Base_SetConfig(htim->Instance, &htim->Init);
2594 
2595  /* Reset the OPM Bit */
2596  htim->Instance->CR1 &= ~TIM_CR1_OPM;
2597 
2598  /* Configure the OPM Mode */
2599  htim->Instance->CR1 |= OnePulseMode;
2600 
2601  /* Initialize the DMA burst operation state */
2603 
2604  /* Initialize the TIM channels state */
2609 
2610  /* Initialize the TIM state*/
2611  htim->State = HAL_TIM_STATE_READY;
2612 
2613  return HAL_OK;
2614 }
2615 
2622 {
2623  /* Check the parameters */
2625 
2626  htim->State = HAL_TIM_STATE_BUSY;
2627 
2628  /* Disable the TIM Peripheral Clock */
2629  __HAL_TIM_DISABLE(htim);
2630 
2631 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2632  if (htim->OnePulse_MspDeInitCallback == NULL)
2633  {
2634  htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit;
2635  }
2636  /* DeInit the low level hardware */
2637  htim->OnePulse_MspDeInitCallback(htim);
2638 #else
2639  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
2641 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2642 
2643  /* Change the DMA burst operation state */
2645 
2646  /* Set the TIM channel state */
2651 
2652  /* Change TIM state */
2653  htim->State = HAL_TIM_STATE_RESET;
2654 
2655  /* Release Lock */
2656  __HAL_UNLOCK(htim);
2657 
2658  return HAL_OK;
2659 }
2660 
2667 {
2668  /* Prevent unused argument(s) compilation warning */
2669  UNUSED(htim);
2670 
2671  /* NOTE : This function should not be modified, when the callback is needed,
2672  the HAL_TIM_OnePulse_MspInit could be implemented in the user file
2673  */
2674 }
2675 
2682 {
2683  /* Prevent unused argument(s) compilation warning */
2684  UNUSED(htim);
2685 
2686  /* NOTE : This function should not be modified, when the callback is needed,
2687  the HAL_TIM_OnePulse_MspDeInit could be implemented in the user file
2688  */
2689 }
2690 
2701 HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2702 {
2705  HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1);
2706  HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2);
2707 
2708  /* Prevent unused argument(s) compilation warning */
2709  UNUSED(OutputChannel);
2710 
2711  /* Check the TIM channels state */
2712  if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
2713  || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY)
2714  || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
2715  || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY))
2716  {
2717  return HAL_ERROR;
2718  }
2719 
2720  /* Set the TIM channels state */
2725 
2726  /* Enable the Capture compare and the Input Capture channels
2727  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2728  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2729  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2730  whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
2731 
2732  No need to enable the counter, it's enabled automatically by hardware
2733  (the counter starts in response to a stimulus and generate a pulse */
2734 
2737 
2738  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2739  {
2740  /* Enable the main output */
2741  __HAL_TIM_MOE_ENABLE(htim);
2742  }
2743 
2744  /* Return function status */
2745  return HAL_OK;
2746 }
2747 
2758 HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2759 {
2760  /* Prevent unused argument(s) compilation warning */
2761  UNUSED(OutputChannel);
2762 
2763  /* Disable the Capture compare and the Input Capture channels
2764  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2765  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2766  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2767  whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */
2768 
2771 
2772  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2773  {
2774  /* Disable the Main Output */
2775  __HAL_TIM_MOE_DISABLE(htim);
2776  }
2777 
2778  /* Disable the Peripheral */
2779  __HAL_TIM_DISABLE(htim);
2780 
2781  /* Set the TIM channels state */
2786 
2787  /* Return function status */
2788  return HAL_OK;
2789 }
2790 
2801 HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2802 {
2805  HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1);
2806  HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2);
2807 
2808  /* Prevent unused argument(s) compilation warning */
2809  UNUSED(OutputChannel);
2810 
2811  /* Check the TIM channels state */
2812  if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
2813  || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY)
2814  || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
2815  || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY))
2816  {
2817  return HAL_ERROR;
2818  }
2819 
2820  /* Set the TIM channels state */
2825 
2826  /* Enable the Capture compare and the Input Capture channels
2827  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2828  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2829  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2830  whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together
2831 
2832  No need to enable the counter, it's enabled automatically by hardware
2833  (the counter starts in response to a stimulus and generate a pulse */
2834 
2835  /* Enable the TIM Capture/Compare 1 interrupt */
2837 
2838  /* Enable the TIM Capture/Compare 2 interrupt */
2840 
2843 
2844  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2845  {
2846  /* Enable the main output */
2847  __HAL_TIM_MOE_ENABLE(htim);
2848  }
2849 
2850  /* Return function status */
2851  return HAL_OK;
2852 }
2853 
2864 HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
2865 {
2866  /* Prevent unused argument(s) compilation warning */
2867  UNUSED(OutputChannel);
2868 
2869  /* Disable the TIM Capture/Compare 1 interrupt */
2871 
2872  /* Disable the TIM Capture/Compare 2 interrupt */
2874 
2875  /* Disable the Capture compare and the Input Capture channels
2876  (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
2877  if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
2878  if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output
2879  whatever the combination, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be disabled together */
2882 
2883  if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET)
2884  {
2885  /* Disable the Main Output */
2886  __HAL_TIM_MOE_DISABLE(htim);
2887  }
2888 
2889  /* Disable the Peripheral */
2890  __HAL_TIM_DISABLE(htim);
2891 
2892  /* Set the TIM channels state */
2897 
2898  /* Return function status */
2899  return HAL_OK;
2900 }
2901 
2944 {
2945  uint32_t tmpsmcr;
2946  uint32_t tmpccmr1;
2947  uint32_t tmpccer;
2948 
2949  /* Check the TIM handle allocation */
2950  if (htim == NULL)
2951  {
2952  return HAL_ERROR;
2953  }
2954 
2955  /* Check the parameters */
2969 
2970  if (htim->State == HAL_TIM_STATE_RESET)
2971  {
2972  /* Allocate lock resource and initialize it */
2973  htim->Lock = HAL_UNLOCKED;
2974 
2975 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2976  /* Reset interrupt callbacks to legacy weak callbacks */
2977  TIM_ResetCallback(htim);
2978 
2979  if (htim->Encoder_MspInitCallback == NULL)
2980  {
2981  htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit;
2982  }
2983  /* Init the low level hardware : GPIO, CLOCK, NVIC */
2984  htim->Encoder_MspInitCallback(htim);
2985 #else
2986  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
2988 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2989  }
2990 
2991  /* Set the TIM state */
2992  htim->State = HAL_TIM_STATE_BUSY;
2993 
2994  /* Reset the SMS and ECE bits */
2995  htim->Instance->SMCR &= ~(TIM_SMCR_SMS | TIM_SMCR_ECE);
2996 
2997  /* Configure the Time base in the Encoder Mode */
2998  TIM_Base_SetConfig(htim->Instance, &htim->Init);
2999 
3000  /* Get the TIMx SMCR register value */
3001  tmpsmcr = htim->Instance->SMCR;
3002 
3003  /* Get the TIMx CCMR1 register value */
3004  tmpccmr1 = htim->Instance->CCMR1;
3005 
3006  /* Get the TIMx CCER register value */
3007  tmpccer = htim->Instance->CCER;
3008 
3009  /* Set the encoder Mode */
3010  tmpsmcr |= sConfig->EncoderMode;
3011 
3012  /* Select the Capture Compare 1 and the Capture Compare 2 as input */
3013  tmpccmr1 &= ~(TIM_CCMR1_CC1S | TIM_CCMR1_CC2S);
3014  tmpccmr1 |= (sConfig->IC1Selection | (sConfig->IC2Selection << 8U));
3015 
3016  /* Set the Capture Compare 1 and the Capture Compare 2 prescalers and filters */
3017  tmpccmr1 &= ~(TIM_CCMR1_IC1PSC | TIM_CCMR1_IC2PSC);
3018  tmpccmr1 &= ~(TIM_CCMR1_IC1F | TIM_CCMR1_IC2F);
3019  tmpccmr1 |= sConfig->IC1Prescaler | (sConfig->IC2Prescaler << 8U);
3020  tmpccmr1 |= (sConfig->IC1Filter << 4U) | (sConfig->IC2Filter << 12U);
3021 
3022  /* Set the TI1 and the TI2 Polarities */
3023  tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC2P);
3024  tmpccer &= ~(TIM_CCER_CC1NP | TIM_CCER_CC2NP);
3025  tmpccer |= sConfig->IC1Polarity | (sConfig->IC2Polarity << 4U);
3026 
3027  /* Write to TIMx SMCR */
3028  htim->Instance->SMCR = tmpsmcr;
3029 
3030  /* Write to TIMx CCMR1 */
3031  htim->Instance->CCMR1 = tmpccmr1;
3032 
3033  /* Write to TIMx CCER */
3034  htim->Instance->CCER = tmpccer;
3035 
3036  /* Initialize the DMA burst operation state */
3038 
3039  /* Set the TIM channels state */
3044 
3045  /* Initialize the TIM state*/
3046  htim->State = HAL_TIM_STATE_READY;
3047 
3048  return HAL_OK;
3049 }
3050 
3051 
3058 {
3059  /* Check the parameters */
3061 
3062  htim->State = HAL_TIM_STATE_BUSY;
3063 
3064  /* Disable the TIM Peripheral Clock */
3065  __HAL_TIM_DISABLE(htim);
3066 
3067 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3068  if (htim->Encoder_MspDeInitCallback == NULL)
3069  {
3070  htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit;
3071  }
3072  /* DeInit the low level hardware */
3073  htim->Encoder_MspDeInitCallback(htim);
3074 #else
3075  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
3077 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3078 
3079  /* Change the DMA burst operation state */
3081 
3082  /* Set the TIM channels state */
3087 
3088  /* Change TIM state */
3089  htim->State = HAL_TIM_STATE_RESET;
3090 
3091  /* Release Lock */
3092  __HAL_UNLOCK(htim);
3093 
3094  return HAL_OK;
3095 }
3096 
3102 __weak void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
3103 {
3104  /* Prevent unused argument(s) compilation warning */
3105  UNUSED(htim);
3106 
3107  /* NOTE : This function should not be modified, when the callback is needed,
3108  the HAL_TIM_Encoder_MspInit could be implemented in the user file
3109  */
3110 }
3111 
3118 {
3119  /* Prevent unused argument(s) compilation warning */
3120  UNUSED(htim);
3121 
3122  /* NOTE : This function should not be modified, when the callback is needed,
3123  the HAL_TIM_Encoder_MspDeInit could be implemented in the user file
3124  */
3125 }
3126 
3138 {
3141  HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1);
3142  HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2);
3143 
3144  /* Check the parameters */
3146 
3147  /* Set the TIM channel(s) state */
3148  if (Channel == TIM_CHANNEL_1)
3149  {
3150  if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
3151  || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY))
3152  {
3153  return HAL_ERROR;
3154  }
3155  else
3156  {
3159  }
3160  }
3161  else if (Channel == TIM_CHANNEL_2)
3162  {
3163  if ((channel_2_state != HAL_TIM_CHANNEL_STATE_READY)
3164  || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY))
3165  {
3166  return HAL_ERROR;
3167  }
3168  else
3169  {
3172  }
3173  }
3174  else
3175  {
3176  if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
3177  || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY)
3178  || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
3179  || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY))
3180  {
3181  return HAL_ERROR;
3182  }
3183  else
3184  {
3189  }
3190  }
3191 
3192  /* Enable the encoder interface channels */
3193  switch (Channel)
3194  {
3195  case TIM_CHANNEL_1:
3196  {
3198  break;
3199  }
3200 
3201  case TIM_CHANNEL_2:
3202  {
3204  break;
3205  }
3206 
3207  default :
3208  {
3211  break;
3212  }
3213  }
3214  /* Enable the Peripheral */
3215  __HAL_TIM_ENABLE(htim);
3216 
3217  /* Return function status */
3218  return HAL_OK;
3219 }
3220 
3232 {
3233  /* Check the parameters */
3235 
3236  /* Disable the Input Capture channels 1 and 2
3237  (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
3238  switch (Channel)
3239  {
3240  case TIM_CHANNEL_1:
3241  {
3243  break;
3244  }
3245 
3246  case TIM_CHANNEL_2:
3247  {
3249  break;
3250  }
3251 
3252  default :
3253  {
3256  break;
3257  }
3258  }
3259 
3260  /* Disable the Peripheral */
3261  __HAL_TIM_DISABLE(htim);
3262 
3263  /* Set the TIM channel(s) state */
3264  if ((Channel == TIM_CHANNEL_1) || (Channel == TIM_CHANNEL_2))
3265  {
3268  }
3269  else
3270  {
3275  }
3276 
3277  /* Return function status */
3278  return HAL_OK;
3279 }
3280 
3292 {
3295  HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1);
3296  HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2);
3297 
3298  /* Check the parameters */
3300 
3301  /* Set the TIM channel(s) state */
3302  if (Channel == TIM_CHANNEL_1)
3303  {
3304  if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
3305  || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY))
3306  {
3307  return HAL_ERROR;
3308  }
3309  else
3310  {
3313  }
3314  }
3315  else if (Channel == TIM_CHANNEL_2)
3316  {
3317  if ((channel_2_state != HAL_TIM_CHANNEL_STATE_READY)
3318  || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY))
3319  {
3320  return HAL_ERROR;
3321  }
3322  else
3323  {
3326  }
3327  }
3328  else
3329  {
3330  if ((channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
3331  || (channel_2_state != HAL_TIM_CHANNEL_STATE_READY)
3332  || (complementary_channel_1_state != HAL_TIM_CHANNEL_STATE_READY)
3333  || (complementary_channel_2_state != HAL_TIM_CHANNEL_STATE_READY))
3334  {
3335  return HAL_ERROR;
3336  }
3337  else
3338  {
3343  }
3344  }
3345 
3346  /* Enable the encoder interface channels */
3347  /* Enable the capture compare Interrupts 1 and/or 2 */
3348  switch (Channel)
3349  {
3350  case TIM_CHANNEL_1:
3351  {
3354  break;
3355  }
3356 
3357  case TIM_CHANNEL_2:
3358  {
3361  break;
3362  }
3363 
3364  default :
3365  {
3370  break;
3371  }
3372  }
3373 
3374  /* Enable the Peripheral */
3375  __HAL_TIM_ENABLE(htim);
3376 
3377  /* Return function status */
3378  return HAL_OK;
3379 }
3380 
3392 {
3393  /* Check the parameters */
3395 
3396  /* Disable the Input Capture channels 1 and 2
3397  (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
3398  if (Channel == TIM_CHANNEL_1)
3399  {
3401 
3402  /* Disable the capture compare Interrupts 1 */
3404  }
3405  else if (Channel == TIM_CHANNEL_2)
3406  {
3408 
3409  /* Disable the capture compare Interrupts 2 */
3411  }
3412  else
3413  {
3416 
3417  /* Disable the capture compare Interrupts 1 and 2 */
3420  }
3421 
3422  /* Disable the Peripheral */
3423  __HAL_TIM_DISABLE(htim);
3424 
3425  /* Set the TIM channel(s) state */
3426  if ((Channel == TIM_CHANNEL_1) || (Channel == TIM_CHANNEL_2))
3427  {
3430  }
3431  else
3432  {
3437  }
3438 
3439  /* Return function status */
3440  return HAL_OK;
3441 }
3442 
3456 HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1,
3457  uint32_t *pData2, uint16_t Length)
3458 {
3461  HAL_TIM_ChannelStateTypeDef complementary_channel_1_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_1);
3462  HAL_TIM_ChannelStateTypeDef complementary_channel_2_state = TIM_CHANNEL_N_STATE_GET(htim, TIM_CHANNEL_2);
3463 
3464  /* Check the parameters */
3466 
3467  /* Set the TIM channel(s) state */
3468  if (Channel == TIM_CHANNEL_1)
3469  {
3470  if ((channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY)
3471  || (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY))
3472  {
3473  return HAL_BUSY;
3474  }
3475  else if ((channel_1_state == HAL_TIM_CHANNEL_STATE_READY)
3476  && (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_READY))
3477  {
3478  if ((pData1 == NULL) && (Length > 0U))
3479  {
3480  return HAL_ERROR;
3481  }
3482  else
3483  {
3486  }
3487  }
3488  else
3489  {
3490  return HAL_ERROR;
3491  }
3492  }
3493  else if (Channel == TIM_CHANNEL_2)
3494  {
3495  if ((channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY)
3496  || (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY))
3497  {
3498  return HAL_BUSY;
3499  }
3500  else if ((channel_2_state == HAL_TIM_CHANNEL_STATE_READY)
3501  && (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_READY))
3502  {
3503  if ((pData2 == NULL) && (Length > 0U))
3504  {
3505  return HAL_ERROR;
3506  }
3507  else
3508  {
3511  }
3512  }
3513  else
3514  {
3515  return HAL_ERROR;
3516  }
3517  }
3518  else
3519  {
3520  if ((channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY)
3521  || (channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY)
3522  || (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_BUSY)
3523  || (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_BUSY))
3524  {
3525  return HAL_BUSY;
3526  }
3527  else if ((channel_1_state == HAL_TIM_CHANNEL_STATE_READY)
3528  && (channel_2_state == HAL_TIM_CHANNEL_STATE_READY)
3529  && (complementary_channel_1_state == HAL_TIM_CHANNEL_STATE_READY)
3530  && (complementary_channel_2_state == HAL_TIM_CHANNEL_STATE_READY))
3531  {
3532  if ((((pData1 == NULL) || (pData2 == NULL))) && (Length > 0U))
3533  {
3534  return HAL_ERROR;
3535  }
3536  else
3537  {
3542  }
3543  }
3544  else
3545  {
3546  return HAL_ERROR;
3547  }
3548  }
3549 
3550  switch (Channel)
3551  {
3552  case TIM_CHANNEL_1:
3553  {
3554  /* Set the DMA capture callbacks */
3557 
3558  /* Set the DMA error callback */
3560 
3561  /* Enable the DMA stream */
3562  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length) != HAL_OK)
3563  {
3564  /* Return error status */
3565  return HAL_ERROR;
3566  }
3567  /* Enable the TIM Input Capture DMA request */
3569 
3570  /* Enable the Peripheral */
3571  __HAL_TIM_ENABLE(htim);
3572 
3573  /* Enable the Capture compare channel */
3575  break;
3576  }
3577 
3578  case TIM_CHANNEL_2:
3579  {
3580  /* Set the DMA capture callbacks */
3583 
3584  /* Set the DMA error callback */
3586  /* Enable the DMA stream */
3587  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length) != HAL_OK)
3588  {
3589  /* Return error status */
3590  return HAL_ERROR;
3591  }
3592  /* Enable the TIM Input Capture DMA request */
3594 
3595  /* Enable the Peripheral */
3596  __HAL_TIM_ENABLE(htim);
3597 
3598  /* Enable the Capture compare channel */
3600  break;
3601  }
3602 
3603  case TIM_CHANNEL_ALL:
3604  {
3605  /* Set the DMA capture callbacks */
3608 
3609  /* Set the DMA error callback */
3611 
3612  /* Enable the DMA stream */
3613  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData1, Length) != HAL_OK)
3614  {
3615  /* Return error status */
3616  return HAL_ERROR;
3617  }
3618 
3619  /* Set the DMA capture callbacks */
3622 
3623  /* Set the DMA error callback */
3625 
3626  /* Enable the DMA stream */
3627  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->CCR2, (uint32_t)pData2, Length) != HAL_OK)
3628  {
3629  /* Return error status */
3630  return HAL_ERROR;
3631  }
3632  /* Enable the Peripheral */
3633  __HAL_TIM_ENABLE(htim);
3634 
3635  /* Enable the Capture compare channel */
3638 
3639  /* Enable the TIM Input Capture DMA request */
3641  /* Enable the TIM Input Capture DMA request */
3643  break;
3644  }
3645 
3646  default:
3647  break;
3648  }
3649 
3650  /* Return function status */
3651  return HAL_OK;
3652 }
3653 
3665 {
3666  /* Check the parameters */
3668 
3669  /* Disable the Input Capture channels 1 and 2
3670  (in the EncoderInterface the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2) */
3671  if (Channel == TIM_CHANNEL_1)
3672  {
3674 
3675  /* Disable the capture compare DMA Request 1 */
3677  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
3678  }
3679  else if (Channel == TIM_CHANNEL_2)
3680  {
3682 
3683  /* Disable the capture compare DMA Request 2 */
3685  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
3686  }
3687  else
3688  {
3691 
3692  /* Disable the capture compare DMA Request 1 and 2 */
3695  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
3696  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
3697  }
3698 
3699  /* Disable the Peripheral */
3700  __HAL_TIM_DISABLE(htim);
3701 
3702  /* Set the TIM channel(s) state */
3703  if ((Channel == TIM_CHANNEL_1) || (Channel == TIM_CHANNEL_2))
3704  {
3707  }
3708  else
3709  {
3714  }
3715 
3716  /* Return function status */
3717  return HAL_OK;
3718 }
3719 
3742 {
3743  /* Capture compare 1 event */
3744  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC1) != RESET)
3745  {
3747  {
3748  {
3751 
3752  /* Input capture event */
3753  if ((htim->Instance->CCMR1 & TIM_CCMR1_CC1S) != 0x00U)
3754  {
3755 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3756  htim->IC_CaptureCallback(htim);
3757 #else
3759 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3760  }
3761  /* Output compare event */
3762  else
3763  {
3764 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3765  htim->OC_DelayElapsedCallback(htim);
3766  htim->PWM_PulseFinishedCallback(htim);
3767 #else
3770 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3771  }
3773  }
3774  }
3775  }
3776  /* Capture compare 2 event */
3777  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC2) != RESET)
3778  {
3780  {
3783  /* Input capture event */
3784  if ((htim->Instance->CCMR1 & TIM_CCMR1_CC2S) != 0x00U)
3785  {
3786 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3787  htim->IC_CaptureCallback(htim);
3788 #else
3790 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3791  }
3792  /* Output compare event */
3793  else
3794  {
3795 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3796  htim->OC_DelayElapsedCallback(htim);
3797  htim->PWM_PulseFinishedCallback(htim);
3798 #else
3801 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3802  }
3804  }
3805  }
3806  /* Capture compare 3 event */
3807  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC3) != RESET)
3808  {
3810  {
3813  /* Input capture event */
3814  if ((htim->Instance->CCMR2 & TIM_CCMR2_CC3S) != 0x00U)
3815  {
3816 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3817  htim->IC_CaptureCallback(htim);
3818 #else
3820 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3821  }
3822  /* Output compare event */
3823  else
3824  {
3825 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3826  htim->OC_DelayElapsedCallback(htim);
3827  htim->PWM_PulseFinishedCallback(htim);
3828 #else
3831 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3832  }
3834  }
3835  }
3836  /* Capture compare 4 event */
3837  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_CC4) != RESET)
3838  {
3840  {
3843  /* Input capture event */
3844  if ((htim->Instance->CCMR2 & TIM_CCMR2_CC4S) != 0x00U)
3845  {
3846 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3847  htim->IC_CaptureCallback(htim);
3848 #else
3850 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3851  }
3852  /* Output compare event */
3853  else
3854  {
3855 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3856  htim->OC_DelayElapsedCallback(htim);
3857  htim->PWM_PulseFinishedCallback(htim);
3858 #else
3861 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3862  }
3864  }
3865  }
3866  /* TIM Update event */
3868  {
3870  {
3872 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3873  htim->PeriodElapsedCallback(htim);
3874 #else
3876 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3877  }
3878  }
3879  /* TIM Break input event */
3880  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET)
3881  {
3883  {
3885 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3886  htim->BreakCallback(htim);
3887 #else
3889 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3890  }
3891  }
3892  /* TIM Break2 input event */
3894  {
3896  {
3898 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3899  htim->Break2Callback(htim);
3900 #else
3902 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3903  }
3904  }
3905  /* TIM Trigger detection event */
3907  {
3909  {
3911 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3912  htim->TriggerCallback(htim);
3913 #else
3915 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3916  }
3917  }
3918  /* TIM commutation event */
3919  if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET)
3920  {
3922  {
3924 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
3925  htim->CommutationCallback(htim);
3926 #else
3928 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
3929  }
3930  }
3931 }
3932 
3972  TIM_OC_InitTypeDef *sConfig,
3973  uint32_t Channel)
3974 {
3975  /* Check the parameters */
3976  assert_param(IS_TIM_CHANNELS(Channel));
3977  assert_param(IS_TIM_OC_MODE(sConfig->OCMode));
3979 
3980  /* Process Locked */
3981  __HAL_LOCK(htim);
3982 
3983  switch (Channel)
3984  {
3985  case TIM_CHANNEL_1:
3986  {
3987  /* Check the parameters */
3989 
3990  /* Configure the TIM Channel 1 in Output Compare */
3991  TIM_OC1_SetConfig(htim->Instance, sConfig);
3992  break;
3993  }
3994 
3995  case TIM_CHANNEL_2:
3996  {
3997  /* Check the parameters */
3999 
4000  /* Configure the TIM Channel 2 in Output Compare */
4001  TIM_OC2_SetConfig(htim->Instance, sConfig);
4002  break;
4003  }
4004 
4005  case TIM_CHANNEL_3:
4006  {
4007  /* Check the parameters */
4009 
4010  /* Configure the TIM Channel 3 in Output Compare */
4011  TIM_OC3_SetConfig(htim->Instance, sConfig);
4012  break;
4013  }
4014 
4015  case TIM_CHANNEL_4:
4016  {
4017  /* Check the parameters */
4019 
4020  /* Configure the TIM Channel 4 in Output Compare */
4021  TIM_OC4_SetConfig(htim->Instance, sConfig);
4022  break;
4023  }
4024 
4025  case TIM_CHANNEL_5:
4026  {
4027  /* Check the parameters */
4029 
4030  /* Configure the TIM Channel 5 in Output Compare */
4031  TIM_OC5_SetConfig(htim->Instance, sConfig);
4032  break;
4033  }
4034 
4035  case TIM_CHANNEL_6:
4036  {
4037  /* Check the parameters */
4039 
4040  /* Configure the TIM Channel 6 in Output Compare */
4041  TIM_OC6_SetConfig(htim->Instance, sConfig);
4042  break;
4043  }
4044 
4045  default:
4046  break;
4047  }
4048 
4049  __HAL_UNLOCK(htim);
4050 
4051  return HAL_OK;
4052 }
4053 
4068 {
4069  /* Check the parameters */
4075 
4076  /* Process Locked */
4077  __HAL_LOCK(htim);
4078 
4079  if (Channel == TIM_CHANNEL_1)
4080  {
4081  /* TI1 Configuration */
4083  sConfig->ICPolarity,
4084  sConfig->ICSelection,
4085  sConfig->ICFilter);
4086 
4087  /* Reset the IC1PSC Bits */
4088  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
4089 
4090  /* Set the IC1PSC value */
4091  htim->Instance->CCMR1 |= sConfig->ICPrescaler;
4092  }
4093  else if (Channel == TIM_CHANNEL_2)
4094  {
4095  /* TI2 Configuration */
4097 
4098  TIM_TI2_SetConfig(htim->Instance,
4099  sConfig->ICPolarity,
4100  sConfig->ICSelection,
4101  sConfig->ICFilter);
4102 
4103  /* Reset the IC2PSC Bits */
4104  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC;
4105 
4106  /* Set the IC2PSC value */
4107  htim->Instance->CCMR1 |= (sConfig->ICPrescaler << 8U);
4108  }
4109  else if (Channel == TIM_CHANNEL_3)
4110  {
4111  /* TI3 Configuration */
4113 
4114  TIM_TI3_SetConfig(htim->Instance,
4115  sConfig->ICPolarity,
4116  sConfig->ICSelection,
4117  sConfig->ICFilter);
4118 
4119  /* Reset the IC3PSC Bits */
4120  htim->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC;
4121 
4122  /* Set the IC3PSC value */
4123  htim->Instance->CCMR2 |= sConfig->ICPrescaler;
4124  }
4125  else
4126  {
4127  /* TI4 Configuration */
4129 
4130  TIM_TI4_SetConfig(htim->Instance,
4131  sConfig->ICPolarity,
4132  sConfig->ICSelection,
4133  sConfig->ICFilter);
4134 
4135  /* Reset the IC4PSC Bits */
4136  htim->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC;
4137 
4138  /* Set the IC4PSC value */
4139  htim->Instance->CCMR2 |= (sConfig->ICPrescaler << 8U);
4140  }
4141 
4142  __HAL_UNLOCK(htim);
4143 
4144  return HAL_OK;
4145 }
4146 
4163  TIM_OC_InitTypeDef *sConfig,
4164  uint32_t Channel)
4165 {
4166  /* Check the parameters */
4167  assert_param(IS_TIM_CHANNELS(Channel));
4168  assert_param(IS_TIM_PWM_MODE(sConfig->OCMode));
4171 
4172  /* Process Locked */
4173  __HAL_LOCK(htim);
4174 
4175  switch (Channel)
4176  {
4177  case TIM_CHANNEL_1:
4178  {
4179  /* Check the parameters */
4181 
4182  /* Configure the Channel 1 in PWM mode */
4183  TIM_OC1_SetConfig(htim->Instance, sConfig);
4184 
4185  /* Set the Preload enable bit for channel1 */
4186  htim->Instance->CCMR1 |= TIM_CCMR1_OC1PE;
4187 
4188  /* Configure the Output Fast mode */
4189  htim->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE;
4190  htim->Instance->CCMR1 |= sConfig->OCFastMode;
4191  break;
4192  }
4193 
4194  case TIM_CHANNEL_2:
4195  {
4196  /* Check the parameters */
4198 
4199  /* Configure the Channel 2 in PWM mode */
4200  TIM_OC2_SetConfig(htim->Instance, sConfig);
4201 
4202  /* Set the Preload enable bit for channel2 */
4203  htim->Instance->CCMR1 |= TIM_CCMR1_OC2PE;
4204 
4205  /* Configure the Output Fast mode */
4206  htim->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE;
4207  htim->Instance->CCMR1 |= sConfig->OCFastMode << 8U;
4208  break;
4209  }
4210 
4211  case TIM_CHANNEL_3:
4212  {
4213  /* Check the parameters */
4215 
4216  /* Configure the Channel 3 in PWM mode */
4217  TIM_OC3_SetConfig(htim->Instance, sConfig);
4218 
4219  /* Set the Preload enable bit for channel3 */
4220  htim->Instance->CCMR2 |= TIM_CCMR2_OC3PE;
4221 
4222  /* Configure the Output Fast mode */
4223  htim->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE;
4224  htim->Instance->CCMR2 |= sConfig->OCFastMode;
4225  break;
4226  }
4227 
4228  case TIM_CHANNEL_4:
4229  {
4230  /* Check the parameters */
4232 
4233  /* Configure the Channel 4 in PWM mode */
4234  TIM_OC4_SetConfig(htim->Instance, sConfig);
4235 
4236  /* Set the Preload enable bit for channel4 */
4237  htim->Instance->CCMR2 |= TIM_CCMR2_OC4PE;
4238 
4239  /* Configure the Output Fast mode */
4240  htim->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE;
4241  htim->Instance->CCMR2 |= sConfig->OCFastMode << 8U;
4242  break;
4243  }
4244 
4245  case TIM_CHANNEL_5:
4246  {
4247  /* Check the parameters */
4249 
4250  /* Configure the Channel 5 in PWM mode */
4251  TIM_OC5_SetConfig(htim->Instance, sConfig);
4252 
4253  /* Set the Preload enable bit for channel5*/
4254  htim->Instance->CCMR3 |= TIM_CCMR3_OC5PE;
4255 
4256  /* Configure the Output Fast mode */
4257  htim->Instance->CCMR3 &= ~TIM_CCMR3_OC5FE;
4258  htim->Instance->CCMR3 |= sConfig->OCFastMode;
4259  break;
4260  }
4261 
4262  case TIM_CHANNEL_6:
4263  {
4264  /* Check the parameters */
4266 
4267  /* Configure the Channel 6 in PWM mode */
4268  TIM_OC6_SetConfig(htim->Instance, sConfig);
4269 
4270  /* Set the Preload enable bit for channel6 */
4271  htim->Instance->CCMR3 |= TIM_CCMR3_OC6PE;
4272 
4273  /* Configure the Output Fast mode */
4274  htim->Instance->CCMR3 &= ~TIM_CCMR3_OC6FE;
4275  htim->Instance->CCMR3 |= sConfig->OCFastMode << 8U;
4276  break;
4277  }
4278 
4279  default:
4280  break;
4281  }
4282 
4283  __HAL_UNLOCK(htim);
4284 
4285  return HAL_OK;
4286 }
4287 
4308  uint32_t OutputChannel, uint32_t InputChannel)
4309 {
4310  TIM_OC_InitTypeDef temp1;
4311 
4312  /* Check the parameters */
4313  assert_param(IS_TIM_OPM_CHANNELS(OutputChannel));
4314  assert_param(IS_TIM_OPM_CHANNELS(InputChannel));
4315 
4316  if (OutputChannel != InputChannel)
4317  {
4318  /* Process Locked */
4319  __HAL_LOCK(htim);
4320 
4321  htim->State = HAL_TIM_STATE_BUSY;
4322 
4323  /* Extract the Output compare configuration from sConfig structure */
4324  temp1.OCMode = sConfig->OCMode;
4325  temp1.Pulse = sConfig->Pulse;
4326  temp1.OCPolarity = sConfig->OCPolarity;
4327  temp1.OCNPolarity = sConfig->OCNPolarity;
4328  temp1.OCIdleState = sConfig->OCIdleState;
4329  temp1.OCNIdleState = sConfig->OCNIdleState;
4330 
4331  switch (OutputChannel)
4332  {
4333  case TIM_CHANNEL_1:
4334  {
4336 
4337  TIM_OC1_SetConfig(htim->Instance, &temp1);
4338  break;
4339  }
4340  case TIM_CHANNEL_2:
4341  {
4343 
4344  TIM_OC2_SetConfig(htim->Instance, &temp1);
4345  break;
4346  }
4347  default:
4348  break;
4349  }
4350 
4351  switch (InputChannel)
4352  {
4353  case TIM_CHANNEL_1:
4354  {
4356 
4357  TIM_TI1_SetConfig(htim->Instance, sConfig->ICPolarity,
4358  sConfig->ICSelection, sConfig->ICFilter);
4359 
4360  /* Reset the IC1PSC Bits */
4361  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
4362 
4363  /* Select the Trigger source */
4364  htim->Instance->SMCR &= ~TIM_SMCR_TS;
4365  htim->Instance->SMCR |= TIM_TS_TI1FP1;
4366 
4367  /* Select the Slave Mode */
4368  htim->Instance->SMCR &= ~TIM_SMCR_SMS;
4370  break;
4371  }
4372  case TIM_CHANNEL_2:
4373  {
4375 
4376  TIM_TI2_SetConfig(htim->Instance, sConfig->ICPolarity,
4377  sConfig->ICSelection, sConfig->ICFilter);
4378 
4379  /* Reset the IC2PSC Bits */
4380  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC;
4381 
4382  /* Select the Trigger source */
4383  htim->Instance->SMCR &= ~TIM_SMCR_TS;
4384  htim->Instance->SMCR |= TIM_TS_TI2FP2;
4385 
4386  /* Select the Slave Mode */
4387  htim->Instance->SMCR &= ~TIM_SMCR_SMS;
4389  break;
4390  }
4391 
4392  default:
4393  break;
4394  }
4395 
4396  htim->State = HAL_TIM_STATE_READY;
4397 
4398  __HAL_UNLOCK(htim);
4399 
4400  return HAL_OK;
4401  }
4402  else
4403  {
4404  return HAL_ERROR;
4405  }
4406 }
4407 
4453 HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
4454  uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
4455 {
4456  return HAL_TIM_DMABurst_MultiWriteStart(htim, BurstBaseAddress, BurstRequestSrc, BurstBuffer, BurstLength,
4457  ((BurstLength) >> 8U) + 1U);
4458 }
4459 
4507  uint32_t BurstRequestSrc, uint32_t *BurstBuffer,
4508  uint32_t BurstLength, uint32_t DataLength)
4509 {
4510  /* Check the parameters */
4512  assert_param(IS_TIM_DMA_BASE(BurstBaseAddress));
4513  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
4514  assert_param(IS_TIM_DMA_LENGTH(BurstLength));
4515  assert_param(IS_TIM_DMA_DATA_LENGTH(DataLength));
4516 
4518  {
4519  return HAL_BUSY;
4520  }
4521  else if (htim->DMABurstState == HAL_DMA_BURST_STATE_READY)
4522  {
4523  if ((BurstBuffer == NULL) && (BurstLength > 0U))
4524  {
4525  return HAL_ERROR;
4526  }
4527  else
4528  {
4530  }
4531  }
4532  else
4533  {
4534  /* nothing to do */
4535  }
4536  switch (BurstRequestSrc)
4537  {
4538  case TIM_DMA_UPDATE:
4539  {
4540  /* Set the DMA Period elapsed callbacks */
4541  htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
4542  htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt;
4543 
4544  /* Set the DMA error callback */
4546 
4547  /* Enable the DMA stream */
4548  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)BurstBuffer,
4549  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4550  {
4551  /* Return error status */
4552  return HAL_ERROR;
4553  }
4554  break;
4555  }
4556  case TIM_DMA_CC1:
4557  {
4558  /* Set the DMA compare callbacks */
4561 
4562  /* Set the DMA error callback */
4564 
4565  /* Enable the DMA stream */
4566  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)BurstBuffer,
4567  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4568  {
4569  /* Return error status */
4570  return HAL_ERROR;
4571  }
4572  break;
4573  }
4574  case TIM_DMA_CC2:
4575  {
4576  /* Set the DMA compare callbacks */
4579 
4580  /* Set the DMA error callback */
4582 
4583  /* Enable the DMA stream */
4584  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)BurstBuffer,
4585  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4586  {
4587  /* Return error status */
4588  return HAL_ERROR;
4589  }
4590  break;
4591  }
4592  case TIM_DMA_CC3:
4593  {
4594  /* Set the DMA compare callbacks */
4597 
4598  /* Set the DMA error callback */
4600 
4601  /* Enable the DMA stream */
4602  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)BurstBuffer,
4603  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4604  {
4605  /* Return error status */
4606  return HAL_ERROR;
4607  }
4608  break;
4609  }
4610  case TIM_DMA_CC4:
4611  {
4612  /* Set the DMA compare callbacks */
4615 
4616  /* Set the DMA error callback */
4618 
4619  /* Enable the DMA stream */
4620  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)BurstBuffer,
4621  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4622  {
4623  /* Return error status */
4624  return HAL_ERROR;
4625  }
4626  break;
4627  }
4628  case TIM_DMA_COM:
4629  {
4630  /* Set the DMA commutation callbacks */
4633 
4634  /* Set the DMA error callback */
4636 
4637  /* Enable the DMA stream */
4638  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)BurstBuffer,
4639  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4640  {
4641  /* Return error status */
4642  return HAL_ERROR;
4643  }
4644  break;
4645  }
4646  case TIM_DMA_TRIGGER:
4647  {
4648  /* Set the DMA trigger callbacks */
4649  htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt;
4650  htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt;
4651 
4652  /* Set the DMA error callback */
4654 
4655  /* Enable the DMA stream */
4656  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)BurstBuffer,
4657  (uint32_t)&htim->Instance->DMAR, DataLength) != HAL_OK)
4658  {
4659  /* Return error status */
4660  return HAL_ERROR;
4661  }
4662  break;
4663  }
4664  default:
4665  break;
4666  }
4667 
4668  /* Configure the DMA Burst Mode */
4669  htim->Instance->DCR = (BurstBaseAddress | BurstLength);
4670  /* Enable the TIM DMA Request */
4671  __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc);
4672 
4673  /* Return function status */
4674  return HAL_OK;
4675 }
4676 
4683 HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
4684 {
4685  /* Check the parameters */
4686  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
4687 
4688  /* Abort the DMA transfer (at least disable the DMA stream) */
4689  switch (BurstRequestSrc)
4690  {
4691  case TIM_DMA_UPDATE:
4692  {
4693  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]);
4694  break;
4695  }
4696  case TIM_DMA_CC1:
4697  {
4698  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
4699  break;
4700  }
4701  case TIM_DMA_CC2:
4702  {
4703  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
4704  break;
4705  }
4706  case TIM_DMA_CC3:
4707  {
4708  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
4709  break;
4710  }
4711  case TIM_DMA_CC4:
4712  {
4713  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
4714  break;
4715  }
4716  case TIM_DMA_COM:
4717  {
4719  break;
4720  }
4721  case TIM_DMA_TRIGGER:
4722  {
4724  break;
4725  }
4726  default:
4727  break;
4728  }
4729 
4730  /* Disable the TIM Update DMA request */
4731  __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc);
4732 
4733  /* Change the DMA burst operation state */
4735 
4736  /* Return function status */
4737  return HAL_OK;
4738 }
4739 
4785 HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
4786  uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
4787 {
4788  return HAL_TIM_DMABurst_MultiReadStart(htim, BurstBaseAddress, BurstRequestSrc, BurstBuffer, BurstLength,
4789  ((BurstLength) >> 8U) + 1U);
4790 }
4791 
4839  uint32_t BurstRequestSrc, uint32_t *BurstBuffer,
4840  uint32_t BurstLength, uint32_t DataLength)
4841 {
4842  /* Check the parameters */
4844  assert_param(IS_TIM_DMA_BASE(BurstBaseAddress));
4845  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
4846  assert_param(IS_TIM_DMA_LENGTH(BurstLength));
4847  assert_param(IS_TIM_DMA_DATA_LENGTH(DataLength));
4848 
4850  {
4851  return HAL_BUSY;
4852  }
4853  else if (htim->DMABurstState == HAL_DMA_BURST_STATE_READY)
4854  {
4855  if ((BurstBuffer == NULL) && (BurstLength > 0U))
4856  {
4857  return HAL_ERROR;
4858  }
4859  else
4860  {
4862  }
4863  }
4864  else
4865  {
4866  /* nothing to do */
4867  }
4868  switch (BurstRequestSrc)
4869  {
4870  case TIM_DMA_UPDATE:
4871  {
4872  /* Set the DMA Period elapsed callbacks */
4873  htim->hdma[TIM_DMA_ID_UPDATE]->XferCpltCallback = TIM_DMAPeriodElapsedCplt;
4874  htim->hdma[TIM_DMA_ID_UPDATE]->XferHalfCpltCallback = TIM_DMAPeriodElapsedHalfCplt;
4875 
4876  /* Set the DMA error callback */
4878 
4879  /* Enable the DMA stream */
4880  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_UPDATE], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4881  DataLength) != HAL_OK)
4882  {
4883  /* Return error status */
4884  return HAL_ERROR;
4885  }
4886  break;
4887  }
4888  case TIM_DMA_CC1:
4889  {
4890  /* Set the DMA capture callbacks */
4893 
4894  /* Set the DMA error callback */
4896 
4897  /* Enable the DMA stream */
4898  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4899  DataLength) != HAL_OK)
4900  {
4901  /* Return error status */
4902  return HAL_ERROR;
4903  }
4904  break;
4905  }
4906  case TIM_DMA_CC2:
4907  {
4908  /* Set the DMA capture callbacks */
4911 
4912  /* Set the DMA error callback */
4914 
4915  /* Enable the DMA stream */
4916  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4917  DataLength) != HAL_OK)
4918  {
4919  /* Return error status */
4920  return HAL_ERROR;
4921  }
4922  break;
4923  }
4924  case TIM_DMA_CC3:
4925  {
4926  /* Set the DMA capture callbacks */
4929 
4930  /* Set the DMA error callback */
4932 
4933  /* Enable the DMA stream */
4934  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4935  DataLength) != HAL_OK)
4936  {
4937  /* Return error status */
4938  return HAL_ERROR;
4939  }
4940  break;
4941  }
4942  case TIM_DMA_CC4:
4943  {
4944  /* Set the DMA capture callbacks */
4947 
4948  /* Set the DMA error callback */
4950 
4951  /* Enable the DMA stream */
4952  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC4], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4953  DataLength) != HAL_OK)
4954  {
4955  /* Return error status */
4956  return HAL_ERROR;
4957  }
4958  break;
4959  }
4960  case TIM_DMA_COM:
4961  {
4962  /* Set the DMA commutation callbacks */
4965 
4966  /* Set the DMA error callback */
4968 
4969  /* Enable the DMA stream */
4970  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_COMMUTATION], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4971  DataLength) != HAL_OK)
4972  {
4973  /* Return error status */
4974  return HAL_ERROR;
4975  }
4976  break;
4977  }
4978  case TIM_DMA_TRIGGER:
4979  {
4980  /* Set the DMA trigger callbacks */
4981  htim->hdma[TIM_DMA_ID_TRIGGER]->XferCpltCallback = TIM_DMATriggerCplt;
4982  htim->hdma[TIM_DMA_ID_TRIGGER]->XferHalfCpltCallback = TIM_DMATriggerHalfCplt;
4983 
4984  /* Set the DMA error callback */
4986 
4987  /* Enable the DMA stream */
4988  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_TRIGGER], (uint32_t)&htim->Instance->DMAR, (uint32_t)BurstBuffer,
4989  DataLength) != HAL_OK)
4990  {
4991  /* Return error status */
4992  return HAL_ERROR;
4993  }
4994  break;
4995  }
4996  default:
4997  break;
4998  }
4999 
5000  /* Configure the DMA Burst Mode */
5001  htim->Instance->DCR = (BurstBaseAddress | BurstLength);
5002 
5003  /* Enable the TIM DMA Request */
5004  __HAL_TIM_ENABLE_DMA(htim, BurstRequestSrc);
5005 
5006  /* Return function status */
5007  return HAL_OK;
5008 }
5009 
5016 HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
5017 {
5018  /* Check the parameters */
5019  assert_param(IS_TIM_DMA_SOURCE(BurstRequestSrc));
5020 
5021  /* Abort the DMA transfer (at least disable the DMA stream) */
5022  switch (BurstRequestSrc)
5023  {
5024  case TIM_DMA_UPDATE:
5025  {
5026  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_UPDATE]);
5027  break;
5028  }
5029  case TIM_DMA_CC1:
5030  {
5031  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
5032  break;
5033  }
5034  case TIM_DMA_CC2:
5035  {
5036  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
5037  break;
5038  }
5039  case TIM_DMA_CC3:
5040  {
5041  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
5042  break;
5043  }
5044  case TIM_DMA_CC4:
5045  {
5046  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC4]);
5047  break;
5048  }
5049  case TIM_DMA_COM:
5050  {
5052  break;
5053  }
5054  case TIM_DMA_TRIGGER:
5055  {
5057  break;
5058  }
5059  default:
5060  break;
5061  }
5062 
5063  /* Disable the TIM Update DMA request */
5064  __HAL_TIM_DISABLE_DMA(htim, BurstRequestSrc);
5065 
5066  /* Change the DMA burst operation state */
5068 
5069  /* Return function status */
5070  return HAL_OK;
5071 }
5072 
5094 HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource)
5095 {
5096  /* Check the parameters */
5098  assert_param(IS_TIM_EVENT_SOURCE(EventSource));
5099 
5100  /* Process Locked */
5101  __HAL_LOCK(htim);
5102 
5103  /* Change the TIM state */
5104  htim->State = HAL_TIM_STATE_BUSY;
5105 
5106  /* Set the event sources */
5107  htim->Instance->EGR = EventSource;
5108 
5109  /* Change the TIM state */
5110  htim->State = HAL_TIM_STATE_READY;
5111 
5112  __HAL_UNLOCK(htim);
5113 
5114  /* Return function status */
5115  return HAL_OK;
5116 }
5117 
5134  TIM_ClearInputConfigTypeDef *sClearInputConfig,
5135  uint32_t Channel)
5136 {
5137  /* Check the parameters */
5140 
5141  /* Process Locked */
5142  __HAL_LOCK(htim);
5143 
5144  htim->State = HAL_TIM_STATE_BUSY;
5145 
5146  switch (sClearInputConfig->ClearInputSource)
5147  {
5149  {
5150  /* Clear the OCREF clear selection bit and the the ETR Bits */
5152  break;
5153  }
5154 
5156  {
5157  /* Check the parameters */
5161 
5162  /* When OCRef clear feature is used with ETR source, ETR prescaler must be off */
5163  if (sClearInputConfig->ClearInputPrescaler != TIM_CLEARINPUTPRESCALER_DIV1)
5164  {
5165  htim->State = HAL_TIM_STATE_READY;
5166  __HAL_UNLOCK(htim);
5167  return HAL_ERROR;
5168  }
5169 
5171  sClearInputConfig->ClearInputPrescaler,
5172  sClearInputConfig->ClearInputPolarity,
5173  sClearInputConfig->ClearInputFilter);
5174  break;
5175  }
5176 
5177  default:
5178  break;
5179  }
5180 
5181  switch (Channel)
5182  {
5183  case TIM_CHANNEL_1:
5184  {
5185  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
5186  {
5187  /* Enable the OCREF clear feature for Channel 1 */
5189  }
5190  else
5191  {
5192  /* Disable the OCREF clear feature for Channel 1 */
5194  }
5195  break;
5196  }
5197  case TIM_CHANNEL_2:
5198  {
5199  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
5200  {
5201  /* Enable the OCREF clear feature for Channel 2 */
5203  }
5204  else
5205  {
5206  /* Disable the OCREF clear feature for Channel 2 */
5208  }
5209  break;
5210  }
5211  case TIM_CHANNEL_3:
5212  {
5213  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
5214  {
5215  /* Enable the OCREF clear feature for Channel 3 */
5217  }
5218  else
5219  {
5220  /* Disable the OCREF clear feature for Channel 3 */
5222  }
5223  break;
5224  }
5225  case TIM_CHANNEL_4:
5226  {
5227  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
5228  {
5229  /* Enable the OCREF clear feature for Channel 4 */
5231  }
5232  else
5233  {
5234  /* Disable the OCREF clear feature for Channel 4 */
5236  }
5237  break;
5238  }
5239  case TIM_CHANNEL_5:
5240  {
5241  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
5242  {
5243  /* Enable the OCREF clear feature for Channel 5 */
5245  }
5246  else
5247  {
5248  /* Disable the OCREF clear feature for Channel 5 */
5250  }
5251  break;
5252  }
5253  case TIM_CHANNEL_6:
5254  {
5255  if (sClearInputConfig->ClearInputState != (uint32_t)DISABLE)
5256  {
5257  /* Enable the OCREF clear feature for Channel 6 */
5259  }
5260  else
5261  {
5262  /* Disable the OCREF clear feature for Channel 6 */
5264  }
5265  break;
5266  }
5267  default:
5268  break;
5269  }
5270 
5271  htim->State = HAL_TIM_STATE_READY;
5272 
5273  __HAL_UNLOCK(htim);
5274 
5275  return HAL_OK;
5276 }
5277 
5286 {
5287  uint32_t tmpsmcr;
5288 
5289  /* Process Locked */
5290  __HAL_LOCK(htim);
5291 
5292  htim->State = HAL_TIM_STATE_BUSY;
5293 
5294  /* Check the parameters */
5295  assert_param(IS_TIM_CLOCKSOURCE(sClockSourceConfig->ClockSource));
5296 
5297  /* Reset the SMS, TS, ECE, ETPS and ETRF bits */
5298  tmpsmcr = htim->Instance->SMCR;
5299  tmpsmcr &= ~(TIM_SMCR_SMS | TIM_SMCR_TS);
5301  htim->Instance->SMCR = tmpsmcr;
5302 
5303  switch (sClockSourceConfig->ClockSource)
5304  {
5306  {
5308  break;
5309  }
5310 
5312  {
5313  /* Check whether or not the timer instance supports external trigger input mode 1 (ETRF)*/
5315 
5316  /* Check ETR input conditioning related parameters */
5317  assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler));
5318  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
5319  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
5320 
5321  /* Configure the ETR Clock source */
5323  sClockSourceConfig->ClockPrescaler,
5324  sClockSourceConfig->ClockPolarity,
5325  sClockSourceConfig->ClockFilter);
5326 
5327  /* Select the External clock mode1 and the ETRF trigger */
5328  tmpsmcr = htim->Instance->SMCR;
5330  /* Write to TIMx SMCR */
5331  htim->Instance->SMCR = tmpsmcr;
5332  break;
5333  }
5334 
5336  {
5337  /* Check whether or not the timer instance supports external trigger input mode 2 (ETRF)*/
5339 
5340  /* Check ETR input conditioning related parameters */
5341  assert_param(IS_TIM_CLOCKPRESCALER(sClockSourceConfig->ClockPrescaler));
5342  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
5343  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
5344 
5345  /* Configure the ETR Clock source */
5347  sClockSourceConfig->ClockPrescaler,
5348  sClockSourceConfig->ClockPolarity,
5349  sClockSourceConfig->ClockFilter);
5350  /* Enable the External clock mode2 */
5351  htim->Instance->SMCR |= TIM_SMCR_ECE;
5352  break;
5353  }
5354 
5355  case TIM_CLOCKSOURCE_TI1:
5356  {
5357  /* Check whether or not the timer instance supports external clock mode 1 */
5359 
5360  /* Check TI1 input conditioning related parameters */
5361  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
5362  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
5363 
5364  TIM_TI1_ConfigInputStage(htim->Instance,
5365  sClockSourceConfig->ClockPolarity,
5366  sClockSourceConfig->ClockFilter);
5367  TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1);
5368  break;
5369  }
5370 
5371  case TIM_CLOCKSOURCE_TI2:
5372  {
5373  /* Check whether or not the timer instance supports external clock mode 1 (ETRF)*/
5375 
5376  /* Check TI2 input conditioning related parameters */
5377  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
5378  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
5379 
5380  TIM_TI2_ConfigInputStage(htim->Instance,
5381  sClockSourceConfig->ClockPolarity,
5382  sClockSourceConfig->ClockFilter);
5383  TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI2);
5384  break;
5385  }
5386 
5387  case TIM_CLOCKSOURCE_TI1ED:
5388  {
5389  /* Check whether or not the timer instance supports external clock mode 1 */
5391 
5392  /* Check TI1 input conditioning related parameters */
5393  assert_param(IS_TIM_CLOCKPOLARITY(sClockSourceConfig->ClockPolarity));
5394  assert_param(IS_TIM_CLOCKFILTER(sClockSourceConfig->ClockFilter));
5395 
5396  TIM_TI1_ConfigInputStage(htim->Instance,
5397  sClockSourceConfig->ClockPolarity,
5398  sClockSourceConfig->ClockFilter);
5399  TIM_ITRx_SetConfig(htim->Instance, TIM_CLOCKSOURCE_TI1ED);
5400  break;
5401  }
5402 
5403  case TIM_CLOCKSOURCE_ITR0:
5404  case TIM_CLOCKSOURCE_ITR1:
5405  case TIM_CLOCKSOURCE_ITR2:
5406  case TIM_CLOCKSOURCE_ITR3:
5407  case TIM_CLOCKSOURCE_ITR4:
5408  case TIM_CLOCKSOURCE_ITR5:
5409  case TIM_CLOCKSOURCE_ITR6:
5410  case TIM_CLOCKSOURCE_ITR7:
5411  case TIM_CLOCKSOURCE_ITR8:
5412  {
5413  /* Check whether or not the timer instance supports internal trigger input */
5415 
5416  TIM_ITRx_SetConfig(htim->Instance, sClockSourceConfig->ClockSource);
5417  break;
5418  }
5419 
5420  default:
5421  break;
5422  }
5423  htim->State = HAL_TIM_STATE_READY;
5424 
5425  __HAL_UNLOCK(htim);
5426 
5427  return HAL_OK;
5428 }
5429 
5442 HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection)
5443 {
5444  uint32_t tmpcr2;
5445 
5446  /* Check the parameters */
5448  assert_param(IS_TIM_TI1SELECTION(TI1_Selection));
5449 
5450  /* Get the TIMx CR2 register value */
5451  tmpcr2 = htim->Instance->CR2;
5452 
5453  /* Reset the TI1 selection */
5454  tmpcr2 &= ~TIM_CR2_TI1S;
5455 
5456  /* Set the TI1 selection */
5457  tmpcr2 |= TI1_Selection;
5458 
5459  /* Write to TIMxCR2 */
5460  htim->Instance->CR2 = tmpcr2;
5461 
5462  return HAL_OK;
5463 }
5464 
5475 {
5476  /* Check the parameters */
5478  assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode));
5480 
5481  __HAL_LOCK(htim);
5482 
5483  htim->State = HAL_TIM_STATE_BUSY;
5484 
5485  if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK)
5486  {
5487  htim->State = HAL_TIM_STATE_READY;
5488  __HAL_UNLOCK(htim);
5489  return HAL_ERROR;
5490  }
5491 
5492  /* Disable Trigger Interrupt */
5494 
5495  /* Disable Trigger DMA request */
5497 
5498  htim->State = HAL_TIM_STATE_READY;
5499 
5500  __HAL_UNLOCK(htim);
5501 
5502  return HAL_OK;
5503 }
5504 
5515  TIM_SlaveConfigTypeDef *sSlaveConfig)
5516 {
5517  /* Check the parameters */
5519  assert_param(IS_TIM_SLAVE_MODE(sSlaveConfig->SlaveMode));
5521 
5522  __HAL_LOCK(htim);
5523 
5524  htim->State = HAL_TIM_STATE_BUSY;
5525 
5526  if (TIM_SlaveTimer_SetConfig(htim, sSlaveConfig) != HAL_OK)
5527  {
5528  htim->State = HAL_TIM_STATE_READY;
5529  __HAL_UNLOCK(htim);
5530  return HAL_ERROR;
5531  }
5532 
5533  /* Enable Trigger Interrupt */
5535 
5536  /* Disable Trigger DMA request */
5538 
5539  htim->State = HAL_TIM_STATE_READY;
5540 
5541  __HAL_UNLOCK(htim);
5542 
5543  return HAL_OK;
5544 }
5545 
5557 uint32_t HAL_TIM_ReadCapturedValue(TIM_HandleTypeDef *htim, uint32_t Channel)
5558 {
5559  uint32_t tmpreg = 0U;
5560 
5561  switch (Channel)
5562  {
5563  case TIM_CHANNEL_1:
5564  {
5565  /* Check the parameters */
5567 
5568  /* Return the capture 1 value */
5569  tmpreg = htim->Instance->CCR1;
5570 
5571  break;
5572  }
5573  case TIM_CHANNEL_2:
5574  {
5575  /* Check the parameters */
5577 
5578  /* Return the capture 2 value */
5579  tmpreg = htim->Instance->CCR2;
5580 
5581  break;
5582  }
5583 
5584  case TIM_CHANNEL_3:
5585  {
5586  /* Check the parameters */
5588 
5589  /* Return the capture 3 value */
5590  tmpreg = htim->Instance->CCR3;
5591 
5592  break;
5593  }
5594 
5595  case TIM_CHANNEL_4:
5596  {
5597  /* Check the parameters */
5599 
5600  /* Return the capture 4 value */
5601  tmpreg = htim->Instance->CCR4;
5602 
5603  break;
5604  }
5605 
5606  default:
5607  break;
5608  }
5609 
5610  return tmpreg;
5611 }
5612 
5642 {
5643  /* Prevent unused argument(s) compilation warning */
5644  UNUSED(htim);
5645 
5646  /* NOTE : This function should not be modified, when the callback is needed,
5647  the HAL_TIM_PeriodElapsedCallback could be implemented in the user file
5648  */
5649 }
5650 
5657 {
5658  /* Prevent unused argument(s) compilation warning */
5659  UNUSED(htim);
5660 
5661  /* NOTE : This function should not be modified, when the callback is needed,
5662  the HAL_TIM_PeriodElapsedHalfCpltCallback could be implemented in the user file
5663  */
5664 }
5665 
5672 {
5673  /* Prevent unused argument(s) compilation warning */
5674  UNUSED(htim);
5675 
5676  /* NOTE : This function should not be modified, when the callback is needed,
5677  the HAL_TIM_OC_DelayElapsedCallback could be implemented in the user file
5678  */
5679 }
5680 
5687 {
5688  /* Prevent unused argument(s) compilation warning */
5689  UNUSED(htim);
5690 
5691  /* NOTE : This function should not be modified, when the callback is needed,
5692  the HAL_TIM_IC_CaptureCallback could be implemented in the user file
5693  */
5694 }
5695 
5702 {
5703  /* Prevent unused argument(s) compilation warning */
5704  UNUSED(htim);
5705 
5706  /* NOTE : This function should not be modified, when the callback is needed,
5707  the HAL_TIM_IC_CaptureHalfCpltCallback could be implemented in the user file
5708  */
5709 }
5710 
5717 {
5718  /* Prevent unused argument(s) compilation warning */
5719  UNUSED(htim);
5720 
5721  /* NOTE : This function should not be modified, when the callback is needed,
5722  the HAL_TIM_PWM_PulseFinishedCallback could be implemented in the user file
5723  */
5724 }
5725 
5732 {
5733  /* Prevent unused argument(s) compilation warning */
5734  UNUSED(htim);
5735 
5736  /* NOTE : This function should not be modified, when the callback is needed,
5737  the HAL_TIM_PWM_PulseFinishedHalfCpltCallback could be implemented in the user file
5738  */
5739 }
5740 
5746 __weak void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim)
5747 {
5748  /* Prevent unused argument(s) compilation warning */
5749  UNUSED(htim);
5750 
5751  /* NOTE : This function should not be modified, when the callback is needed,
5752  the HAL_TIM_TriggerCallback could be implemented in the user file
5753  */
5754 }
5755 
5762 {
5763  /* Prevent unused argument(s) compilation warning */
5764  UNUSED(htim);
5765 
5766  /* NOTE : This function should not be modified, when the callback is needed,
5767  the HAL_TIM_TriggerHalfCpltCallback could be implemented in the user file
5768  */
5769 }
5770 
5776 __weak void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim)
5777 {
5778  /* Prevent unused argument(s) compilation warning */
5779  UNUSED(htim);
5780 
5781  /* NOTE : This function should not be modified, when the callback is needed,
5782  the HAL_TIM_ErrorCallback could be implemented in the user file
5783  */
5784 }
5785 
5786 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
5787 
5823 HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID,
5824  pTIM_CallbackTypeDef pCallback)
5825 {
5826  HAL_StatusTypeDef status = HAL_OK;
5827 
5828  if (pCallback == NULL)
5829  {
5830  return HAL_ERROR;
5831  }
5832  /* Process locked */
5833  __HAL_LOCK(htim);
5834 
5835  if (htim->State == HAL_TIM_STATE_READY)
5836  {
5837  switch (CallbackID)
5838  {
5839  case HAL_TIM_BASE_MSPINIT_CB_ID :
5840  htim->Base_MspInitCallback = pCallback;
5841  break;
5842 
5843  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
5844  htim->Base_MspDeInitCallback = pCallback;
5845  break;
5846 
5847  case HAL_TIM_IC_MSPINIT_CB_ID :
5848  htim->IC_MspInitCallback = pCallback;
5849  break;
5850 
5851  case HAL_TIM_IC_MSPDEINIT_CB_ID :
5852  htim->IC_MspDeInitCallback = pCallback;
5853  break;
5854 
5855  case HAL_TIM_OC_MSPINIT_CB_ID :
5856  htim->OC_MspInitCallback = pCallback;
5857  break;
5858 
5859  case HAL_TIM_OC_MSPDEINIT_CB_ID :
5860  htim->OC_MspDeInitCallback = pCallback;
5861  break;
5862 
5863  case HAL_TIM_PWM_MSPINIT_CB_ID :
5864  htim->PWM_MspInitCallback = pCallback;
5865  break;
5866 
5867  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
5868  htim->PWM_MspDeInitCallback = pCallback;
5869  break;
5870 
5871  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
5872  htim->OnePulse_MspInitCallback = pCallback;
5873  break;
5874 
5875  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
5876  htim->OnePulse_MspDeInitCallback = pCallback;
5877  break;
5878 
5879  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
5880  htim->Encoder_MspInitCallback = pCallback;
5881  break;
5882 
5883  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
5884  htim->Encoder_MspDeInitCallback = pCallback;
5885  break;
5886 
5887  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
5888  htim->HallSensor_MspInitCallback = pCallback;
5889  break;
5890 
5891  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
5892  htim->HallSensor_MspDeInitCallback = pCallback;
5893  break;
5894 
5895  case HAL_TIM_PERIOD_ELAPSED_CB_ID :
5896  htim->PeriodElapsedCallback = pCallback;
5897  break;
5898 
5899  case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID :
5900  htim->PeriodElapsedHalfCpltCallback = pCallback;
5901  break;
5902 
5903  case HAL_TIM_TRIGGER_CB_ID :
5904  htim->TriggerCallback = pCallback;
5905  break;
5906 
5907  case HAL_TIM_TRIGGER_HALF_CB_ID :
5908  htim->TriggerHalfCpltCallback = pCallback;
5909  break;
5910 
5911  case HAL_TIM_IC_CAPTURE_CB_ID :
5912  htim->IC_CaptureCallback = pCallback;
5913  break;
5914 
5915  case HAL_TIM_IC_CAPTURE_HALF_CB_ID :
5916  htim->IC_CaptureHalfCpltCallback = pCallback;
5917  break;
5918 
5919  case HAL_TIM_OC_DELAY_ELAPSED_CB_ID :
5920  htim->OC_DelayElapsedCallback = pCallback;
5921  break;
5922 
5923  case HAL_TIM_PWM_PULSE_FINISHED_CB_ID :
5924  htim->PWM_PulseFinishedCallback = pCallback;
5925  break;
5926 
5927  case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID :
5928  htim->PWM_PulseFinishedHalfCpltCallback = pCallback;
5929  break;
5930 
5931  case HAL_TIM_ERROR_CB_ID :
5932  htim->ErrorCallback = pCallback;
5933  break;
5934 
5935  case HAL_TIM_COMMUTATION_CB_ID :
5936  htim->CommutationCallback = pCallback;
5937  break;
5938 
5939  case HAL_TIM_COMMUTATION_HALF_CB_ID :
5940  htim->CommutationHalfCpltCallback = pCallback;
5941  break;
5942 
5943  case HAL_TIM_BREAK_CB_ID :
5944  htim->BreakCallback = pCallback;
5945  break;
5946 
5947  case HAL_TIM_BREAK2_CB_ID :
5948  htim->Break2Callback = pCallback;
5949  break;
5950 
5951  default :
5952  /* Return error status */
5953  status = HAL_ERROR;
5954  break;
5955  }
5956  }
5957  else if (htim->State == HAL_TIM_STATE_RESET)
5958  {
5959  switch (CallbackID)
5960  {
5961  case HAL_TIM_BASE_MSPINIT_CB_ID :
5962  htim->Base_MspInitCallback = pCallback;
5963  break;
5964 
5965  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
5966  htim->Base_MspDeInitCallback = pCallback;
5967  break;
5968 
5969  case HAL_TIM_IC_MSPINIT_CB_ID :
5970  htim->IC_MspInitCallback = pCallback;
5971  break;
5972 
5973  case HAL_TIM_IC_MSPDEINIT_CB_ID :
5974  htim->IC_MspDeInitCallback = pCallback;
5975  break;
5976 
5977  case HAL_TIM_OC_MSPINIT_CB_ID :
5978  htim->OC_MspInitCallback = pCallback;
5979  break;
5980 
5981  case HAL_TIM_OC_MSPDEINIT_CB_ID :
5982  htim->OC_MspDeInitCallback = pCallback;
5983  break;
5984 
5985  case HAL_TIM_PWM_MSPINIT_CB_ID :
5986  htim->PWM_MspInitCallback = pCallback;
5987  break;
5988 
5989  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
5990  htim->PWM_MspDeInitCallback = pCallback;
5991  break;
5992 
5993  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
5994  htim->OnePulse_MspInitCallback = pCallback;
5995  break;
5996 
5997  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
5998  htim->OnePulse_MspDeInitCallback = pCallback;
5999  break;
6000 
6001  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
6002  htim->Encoder_MspInitCallback = pCallback;
6003  break;
6004 
6005  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
6006  htim->Encoder_MspDeInitCallback = pCallback;
6007  break;
6008 
6009  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
6010  htim->HallSensor_MspInitCallback = pCallback;
6011  break;
6012 
6013  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
6014  htim->HallSensor_MspDeInitCallback = pCallback;
6015  break;
6016 
6017  default :
6018  /* Return error status */
6019  status = HAL_ERROR;
6020  break;
6021  }
6022  }
6023  else
6024  {
6025  /* Return error status */
6026  status = HAL_ERROR;
6027  }
6028 
6029  /* Release Lock */
6030  __HAL_UNLOCK(htim);
6031 
6032  return status;
6033 }
6034 
6071 HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID)
6072 {
6073  HAL_StatusTypeDef status = HAL_OK;
6074 
6075  /* Process locked */
6076  __HAL_LOCK(htim);
6077 
6078  if (htim->State == HAL_TIM_STATE_READY)
6079  {
6080  switch (CallbackID)
6081  {
6082  case HAL_TIM_BASE_MSPINIT_CB_ID :
6083  htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; /* Legacy weak Base MspInit Callback */
6084  break;
6085 
6086  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
6087  htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; /* Legacy weak Base Msp DeInit Callback */
6088  break;
6089 
6090  case HAL_TIM_IC_MSPINIT_CB_ID :
6091  htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; /* Legacy weak IC Msp Init Callback */
6092  break;
6093 
6094  case HAL_TIM_IC_MSPDEINIT_CB_ID :
6095  htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; /* Legacy weak IC Msp DeInit Callback */
6096  break;
6097 
6098  case HAL_TIM_OC_MSPINIT_CB_ID :
6099  htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; /* Legacy weak OC Msp Init Callback */
6100  break;
6101 
6102  case HAL_TIM_OC_MSPDEINIT_CB_ID :
6103  htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; /* Legacy weak OC Msp DeInit Callback */
6104  break;
6105 
6106  case HAL_TIM_PWM_MSPINIT_CB_ID :
6107  htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; /* Legacy weak PWM Msp Init Callback */
6108  break;
6109 
6110  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
6111  htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; /* Legacy weak PWM Msp DeInit Callback */
6112  break;
6113 
6114  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
6115  htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; /* Legacy weak One Pulse Msp Init Callback */
6116  break;
6117 
6118  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
6119  htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; /* Legacy weak One Pulse Msp DeInit Callback */
6120  break;
6121 
6122  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
6123  htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; /* Legacy weak Encoder Msp Init Callback */
6124  break;
6125 
6126  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
6127  htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; /* Legacy weak Encoder Msp DeInit Callback */
6128  break;
6129 
6130  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
6131  htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; /* Legacy weak Hall Sensor Msp Init Callback */
6132  break;
6133 
6134  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
6135  htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; /* Legacy weak Hall Sensor Msp DeInit Callback */
6136  break;
6137 
6138  case HAL_TIM_PERIOD_ELAPSED_CB_ID :
6139  htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; /* Legacy weak Period Elapsed Callback */
6140  break;
6141 
6142  case HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID :
6143  htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; /* Legacy weak Period Elapsed half complete Callback */
6144  break;
6145 
6146  case HAL_TIM_TRIGGER_CB_ID :
6147  htim->TriggerCallback = HAL_TIM_TriggerCallback; /* Legacy weak Trigger Callback */
6148  break;
6149 
6150  case HAL_TIM_TRIGGER_HALF_CB_ID :
6151  htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; /* Legacy weak Trigger half complete Callback */
6152  break;
6153 
6154  case HAL_TIM_IC_CAPTURE_CB_ID :
6155  htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; /* Legacy weak IC Capture Callback */
6156  break;
6157 
6158  case HAL_TIM_IC_CAPTURE_HALF_CB_ID :
6159  htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; /* Legacy weak IC Capture half complete Callback */
6160  break;
6161 
6162  case HAL_TIM_OC_DELAY_ELAPSED_CB_ID :
6163  htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; /* Legacy weak OC Delay Elapsed Callback */
6164  break;
6165 
6166  case HAL_TIM_PWM_PULSE_FINISHED_CB_ID :
6167  htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; /* Legacy weak PWM Pulse Finished Callback */
6168  break;
6169 
6170  case HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID :
6171  htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; /* Legacy weak PWM Pulse Finished half complete Callback */
6172  break;
6173 
6174  case HAL_TIM_ERROR_CB_ID :
6175  htim->ErrorCallback = HAL_TIM_ErrorCallback; /* Legacy weak Error Callback */
6176  break;
6177 
6178  case HAL_TIM_COMMUTATION_CB_ID :
6179  htim->CommutationCallback = HAL_TIMEx_CommutCallback; /* Legacy weak Commutation Callback */
6180  break;
6181 
6182  case HAL_TIM_COMMUTATION_HALF_CB_ID :
6183  htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; /* Legacy weak Commutation half complete Callback */
6184  break;
6185 
6186  case HAL_TIM_BREAK_CB_ID :
6187  htim->BreakCallback = HAL_TIMEx_BreakCallback; /* Legacy weak Break Callback */
6188  break;
6189 
6190  case HAL_TIM_BREAK2_CB_ID :
6191  htim->Break2Callback = HAL_TIMEx_Break2Callback; /* Legacy weak Break2 Callback */
6192  break;
6193 
6194  default :
6195  /* Return error status */
6196  status = HAL_ERROR;
6197  break;
6198  }
6199  }
6200  else if (htim->State == HAL_TIM_STATE_RESET)
6201  {
6202  switch (CallbackID)
6203  {
6204  case HAL_TIM_BASE_MSPINIT_CB_ID :
6205  htim->Base_MspInitCallback = HAL_TIM_Base_MspInit; /* Legacy weak Base MspInit Callback */
6206  break;
6207 
6208  case HAL_TIM_BASE_MSPDEINIT_CB_ID :
6209  htim->Base_MspDeInitCallback = HAL_TIM_Base_MspDeInit; /* Legacy weak Base Msp DeInit Callback */
6210  break;
6211 
6212  case HAL_TIM_IC_MSPINIT_CB_ID :
6213  htim->IC_MspInitCallback = HAL_TIM_IC_MspInit; /* Legacy weak IC Msp Init Callback */
6214  break;
6215 
6216  case HAL_TIM_IC_MSPDEINIT_CB_ID :
6217  htim->IC_MspDeInitCallback = HAL_TIM_IC_MspDeInit; /* Legacy weak IC Msp DeInit Callback */
6218  break;
6219 
6220  case HAL_TIM_OC_MSPINIT_CB_ID :
6221  htim->OC_MspInitCallback = HAL_TIM_OC_MspInit; /* Legacy weak OC Msp Init Callback */
6222  break;
6223 
6224  case HAL_TIM_OC_MSPDEINIT_CB_ID :
6225  htim->OC_MspDeInitCallback = HAL_TIM_OC_MspDeInit; /* Legacy weak OC Msp DeInit Callback */
6226  break;
6227 
6228  case HAL_TIM_PWM_MSPINIT_CB_ID :
6229  htim->PWM_MspInitCallback = HAL_TIM_PWM_MspInit; /* Legacy weak PWM Msp Init Callback */
6230  break;
6231 
6232  case HAL_TIM_PWM_MSPDEINIT_CB_ID :
6233  htim->PWM_MspDeInitCallback = HAL_TIM_PWM_MspDeInit; /* Legacy weak PWM Msp DeInit Callback */
6234  break;
6235 
6236  case HAL_TIM_ONE_PULSE_MSPINIT_CB_ID :
6237  htim->OnePulse_MspInitCallback = HAL_TIM_OnePulse_MspInit; /* Legacy weak One Pulse Msp Init Callback */
6238  break;
6239 
6240  case HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID :
6241  htim->OnePulse_MspDeInitCallback = HAL_TIM_OnePulse_MspDeInit; /* Legacy weak One Pulse Msp DeInit Callback */
6242  break;
6243 
6244  case HAL_TIM_ENCODER_MSPINIT_CB_ID :
6245  htim->Encoder_MspInitCallback = HAL_TIM_Encoder_MspInit; /* Legacy weak Encoder Msp Init Callback */
6246  break;
6247 
6248  case HAL_TIM_ENCODER_MSPDEINIT_CB_ID :
6249  htim->Encoder_MspDeInitCallback = HAL_TIM_Encoder_MspDeInit; /* Legacy weak Encoder Msp DeInit Callback */
6250  break;
6251 
6252  case HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID :
6253  htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit; /* Legacy weak Hall Sensor Msp Init Callback */
6254  break;
6255 
6256  case HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID :
6257  htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit; /* Legacy weak Hall Sensor Msp DeInit Callback */
6258  break;
6259 
6260  default :
6261  /* Return error status */
6262  status = HAL_ERROR;
6263  break;
6264  }
6265  }
6266  else
6267  {
6268  /* Return error status */
6269  status = HAL_ERROR;
6270  }
6271 
6272  /* Release Lock */
6273  __HAL_UNLOCK(htim);
6274 
6275  return status;
6276 }
6277 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6278 
6304 {
6305  return htim->State;
6306 }
6307 
6314 {
6315  return htim->State;
6316 }
6317 
6324 {
6325  return htim->State;
6326 }
6327 
6334 {
6335  return htim->State;
6336 }
6337 
6344 {
6345  return htim->State;
6346 }
6347 
6354 {
6355  return htim->State;
6356 }
6357 
6364 {
6365  return htim->Channel;
6366 }
6367 
6382 {
6383  HAL_TIM_ChannelStateTypeDef channel_state;
6384 
6385  /* Check the parameters */
6386  assert_param(IS_TIM_CCX_INSTANCE(htim->Instance, Channel));
6387 
6388  channel_state = TIM_CHANNEL_STATE_GET(htim, Channel);
6389 
6390  return channel_state;
6391 }
6392 
6399 {
6400  /* Check the parameters */
6402 
6403  return htim->DMABurstState;
6404 }
6405 
6423 void TIM_DMAError(DMA_HandleTypeDef *hdma)
6424 {
6425  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6426 
6427  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
6428  {
6431  }
6432  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
6433  {
6436  }
6437  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
6438  {
6441  }
6442  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
6443  {
6446  }
6447  else
6448  {
6449  htim->State = HAL_TIM_STATE_READY;
6450  }
6451 
6452 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6453  htim->ErrorCallback(htim);
6454 #else
6455  HAL_TIM_ErrorCallback(htim);
6456 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6457 
6459 }
6460 
6466 static void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma)
6467 {
6468  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6469 
6470  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
6471  {
6473 
6474  if (hdma->Init.Mode == DMA_NORMAL)
6475  {
6477  }
6478  }
6479  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
6480  {
6482 
6483  if (hdma->Init.Mode == DMA_NORMAL)
6484  {
6486  }
6487  }
6488  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
6489  {
6491 
6492  if (hdma->Init.Mode == DMA_NORMAL)
6493  {
6495  }
6496  }
6497  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
6498  {
6500 
6501  if (hdma->Init.Mode == DMA_NORMAL)
6502  {
6504  }
6505  }
6506  else
6507  {
6508  /* nothing to do */
6509  }
6510 
6511 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6512  htim->PWM_PulseFinishedCallback(htim);
6513 #else
6515 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6516 
6518 }
6519 
6526 {
6527  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6528 
6529  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
6530  {
6532  }
6533  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
6534  {
6536  }
6537  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
6538  {
6540  }
6541  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
6542  {
6544  }
6545  else
6546  {
6547  /* nothing to do */
6548  }
6549 
6550 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6551  htim->PWM_PulseFinishedHalfCpltCallback(htim);
6552 #else
6554 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6555 
6557 }
6558 
6565 {
6566  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6567 
6568  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
6569  {
6571 
6572  if (hdma->Init.Mode == DMA_NORMAL)
6573  {
6576  }
6577  }
6578  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
6579  {
6581 
6582  if (hdma->Init.Mode == DMA_NORMAL)
6583  {
6586  }
6587  }
6588  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
6589  {
6591 
6592  if (hdma->Init.Mode == DMA_NORMAL)
6593  {
6596  }
6597  }
6598  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
6599  {
6601 
6602  if (hdma->Init.Mode == DMA_NORMAL)
6603  {
6606  }
6607  }
6608  else
6609  {
6610  /* nothing to do */
6611  }
6612 
6613 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6614  htim->IC_CaptureCallback(htim);
6615 #else
6617 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6618 
6620 }
6621 
6628 {
6629  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6630 
6631  if (hdma == htim->hdma[TIM_DMA_ID_CC1])
6632  {
6634  }
6635  else if (hdma == htim->hdma[TIM_DMA_ID_CC2])
6636  {
6638  }
6639  else if (hdma == htim->hdma[TIM_DMA_ID_CC3])
6640  {
6642  }
6643  else if (hdma == htim->hdma[TIM_DMA_ID_CC4])
6644  {
6646  }
6647  else
6648  {
6649  /* nothing to do */
6650  }
6651 
6652 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6653  htim->IC_CaptureHalfCpltCallback(htim);
6654 #else
6656 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6657 
6659 }
6660 
6666 static void TIM_DMAPeriodElapsedCplt(DMA_HandleTypeDef *hdma)
6667 {
6668  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6669 
6670  if (htim->hdma[TIM_DMA_ID_UPDATE]->Init.Mode == DMA_NORMAL)
6671  {
6672  htim->State = HAL_TIM_STATE_READY;
6673  }
6674 
6675 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6676  htim->PeriodElapsedCallback(htim);
6677 #else
6679 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6680 }
6681 
6687 static void TIM_DMAPeriodElapsedHalfCplt(DMA_HandleTypeDef *hdma)
6688 {
6689  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6690 
6691 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6692  htim->PeriodElapsedHalfCpltCallback(htim);
6693 #else
6695 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6696 }
6697 
6703 static void TIM_DMATriggerCplt(DMA_HandleTypeDef *hdma)
6704 {
6705  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6706 
6707  if (htim->hdma[TIM_DMA_ID_TRIGGER]->Init.Mode == DMA_NORMAL)
6708  {
6709  htim->State = HAL_TIM_STATE_READY;
6710  }
6711 
6712 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6713  htim->TriggerCallback(htim);
6714 #else
6716 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6717 }
6718 
6724 static void TIM_DMATriggerHalfCplt(DMA_HandleTypeDef *hdma)
6725 {
6726  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
6727 
6728 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
6729  htim->TriggerHalfCpltCallback(htim);
6730 #else
6732 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
6733 }
6734 
6741 void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
6742 {
6743  uint32_t tmpcr1;
6744  tmpcr1 = TIMx->CR1;
6745 
6746  /* Set TIM Time Base Unit parameters ---------------------------------------*/
6748  {
6749  /* Select the Counter Mode */
6750  tmpcr1 &= ~(TIM_CR1_DIR | TIM_CR1_CMS);
6751  tmpcr1 |= Structure->CounterMode;
6752  }
6753 
6755  {
6756  /* Set the clock division */
6757  tmpcr1 &= ~TIM_CR1_CKD;
6758  tmpcr1 |= (uint32_t)Structure->ClockDivision;
6759  }
6760 
6761  /* Set the auto-reload preload */
6762  MODIFY_REG(tmpcr1, TIM_CR1_ARPE, Structure->AutoReloadPreload);
6763 
6764  TIMx->CR1 = tmpcr1;
6765 
6766  /* Set the Autoreload value */
6767  TIMx->ARR = (uint32_t)Structure->Period ;
6768 
6769  /* Set the Prescaler value */
6770  TIMx->PSC = Structure->Prescaler;
6771 
6773  {
6774  /* Set the Repetition Counter value */
6775  TIMx->RCR = Structure->RepetitionCounter;
6776  }
6777 
6778  /* Generate an update event to reload the Prescaler
6779  and the repetition counter (only for advanced timer) value immediately */
6780  TIMx->EGR = TIM_EGR_UG;
6781 }
6782 
6789 static void TIM_OC1_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
6790 {
6791  uint32_t tmpccmrx;
6792  uint32_t tmpccer;
6793  uint32_t tmpcr2;
6794 
6795  /* Disable the Channel 1: Reset the CC1E Bit */
6796  TIMx->CCER &= ~TIM_CCER_CC1E;
6797 
6798  /* Get the TIMx CCER register value */
6799  tmpccer = TIMx->CCER;
6800  /* Get the TIMx CR2 register value */
6801  tmpcr2 = TIMx->CR2;
6802 
6803  /* Get the TIMx CCMR1 register value */
6804  tmpccmrx = TIMx->CCMR1;
6805 
6806  /* Reset the Output Compare Mode Bits */
6807  tmpccmrx &= ~TIM_CCMR1_OC1M;
6808  tmpccmrx &= ~TIM_CCMR1_CC1S;
6809  /* Select the Output Compare Mode */
6810  tmpccmrx |= OC_Config->OCMode;
6811 
6812  /* Reset the Output Polarity level */
6813  tmpccer &= ~TIM_CCER_CC1P;
6814  /* Set the Output Compare Polarity */
6815  tmpccer |= OC_Config->OCPolarity;
6816 
6818  {
6819  /* Check parameters */
6821 
6822  /* Reset the Output N Polarity level */
6823  tmpccer &= ~TIM_CCER_CC1NP;
6824  /* Set the Output N Polarity */
6825  tmpccer |= OC_Config->OCNPolarity;
6826  /* Reset the Output N State */
6827  tmpccer &= ~TIM_CCER_CC1NE;
6828  }
6829 
6830  if (IS_TIM_BREAK_INSTANCE(TIMx))
6831  {
6832  /* Check parameters */
6835 
6836  /* Reset the Output Compare and Output Compare N IDLE State */
6837  tmpcr2 &= ~TIM_CR2_OIS1;
6838  tmpcr2 &= ~TIM_CR2_OIS1N;
6839  /* Set the Output Idle state */
6840  tmpcr2 |= OC_Config->OCIdleState;
6841  /* Set the Output N Idle state */
6842  tmpcr2 |= OC_Config->OCNIdleState;
6843  }
6844 
6845  /* Write to TIMx CR2 */
6846  TIMx->CR2 = tmpcr2;
6847 
6848  /* Write to TIMx CCMR1 */
6849  TIMx->CCMR1 = tmpccmrx;
6850 
6851  /* Set the Capture Compare Register value */
6852  TIMx->CCR1 = OC_Config->Pulse;
6853 
6854  /* Write to TIMx CCER */
6855  TIMx->CCER = tmpccer;
6856 }
6857 
6864 void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
6865 {
6866  uint32_t tmpccmrx;
6867  uint32_t tmpccer;
6868  uint32_t tmpcr2;
6869 
6870  /* Disable the Channel 2: Reset the CC2E Bit */
6871  TIMx->CCER &= ~TIM_CCER_CC2E;
6872 
6873  /* Get the TIMx CCER register value */
6874  tmpccer = TIMx->CCER;
6875  /* Get the TIMx CR2 register value */
6876  tmpcr2 = TIMx->CR2;
6877 
6878  /* Get the TIMx CCMR1 register value */
6879  tmpccmrx = TIMx->CCMR1;
6880 
6881  /* Reset the Output Compare mode and Capture/Compare selection Bits */
6882  tmpccmrx &= ~TIM_CCMR1_OC2M;
6883  tmpccmrx &= ~TIM_CCMR1_CC2S;
6884 
6885  /* Select the Output Compare Mode */
6886  tmpccmrx |= (OC_Config->OCMode << 8U);
6887 
6888  /* Reset the Output Polarity level */
6889  tmpccer &= ~TIM_CCER_CC2P;
6890  /* Set the Output Compare Polarity */
6891  tmpccer |= (OC_Config->OCPolarity << 4U);
6892 
6894  {
6896 
6897  /* Reset the Output N Polarity level */
6898  tmpccer &= ~TIM_CCER_CC2NP;
6899  /* Set the Output N Polarity */
6900  tmpccer |= (OC_Config->OCNPolarity << 4U);
6901  /* Reset the Output N State */
6902  tmpccer &= ~TIM_CCER_CC2NE;
6903 
6904  }
6905 
6906  if (IS_TIM_BREAK_INSTANCE(TIMx))
6907  {
6908  /* Check parameters */
6911 
6912  /* Reset the Output Compare and Output Compare N IDLE State */
6913  tmpcr2 &= ~TIM_CR2_OIS2;
6914  tmpcr2 &= ~TIM_CR2_OIS2N;
6915  /* Set the Output Idle state */
6916  tmpcr2 |= (OC_Config->OCIdleState << 2U);
6917  /* Set the Output N Idle state */
6918  tmpcr2 |= (OC_Config->OCNIdleState << 2U);
6919  }
6920 
6921  /* Write to TIMx CR2 */
6922  TIMx->CR2 = tmpcr2;
6923 
6924  /* Write to TIMx CCMR1 */
6925  TIMx->CCMR1 = tmpccmrx;
6926 
6927  /* Set the Capture Compare Register value */
6928  TIMx->CCR2 = OC_Config->Pulse;
6929 
6930  /* Write to TIMx CCER */
6931  TIMx->CCER = tmpccer;
6932 }
6933 
6940 static void TIM_OC3_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
6941 {
6942  uint32_t tmpccmrx;
6943  uint32_t tmpccer;
6944  uint32_t tmpcr2;
6945 
6946  /* Disable the Channel 3: Reset the CC2E Bit */
6947  TIMx->CCER &= ~TIM_CCER_CC3E;
6948 
6949  /* Get the TIMx CCER register value */
6950  tmpccer = TIMx->CCER;
6951  /* Get the TIMx CR2 register value */
6952  tmpcr2 = TIMx->CR2;
6953 
6954  /* Get the TIMx CCMR2 register value */
6955  tmpccmrx = TIMx->CCMR2;
6956 
6957  /* Reset the Output Compare mode and Capture/Compare selection Bits */
6958  tmpccmrx &= ~TIM_CCMR2_OC3M;
6959  tmpccmrx &= ~TIM_CCMR2_CC3S;
6960  /* Select the Output Compare Mode */
6961  tmpccmrx |= OC_Config->OCMode;
6962 
6963  /* Reset the Output Polarity level */
6964  tmpccer &= ~TIM_CCER_CC3P;
6965  /* Set the Output Compare Polarity */
6966  tmpccer |= (OC_Config->OCPolarity << 8U);
6967 
6969  {
6971 
6972  /* Reset the Output N Polarity level */
6973  tmpccer &= ~TIM_CCER_CC3NP;
6974  /* Set the Output N Polarity */
6975  tmpccer |= (OC_Config->OCNPolarity << 8U);
6976  /* Reset the Output N State */
6977  tmpccer &= ~TIM_CCER_CC3NE;
6978  }
6979 
6980  if (IS_TIM_BREAK_INSTANCE(TIMx))
6981  {
6982  /* Check parameters */
6985 
6986  /* Reset the Output Compare and Output Compare N IDLE State */
6987  tmpcr2 &= ~TIM_CR2_OIS3;
6988  tmpcr2 &= ~TIM_CR2_OIS3N;
6989  /* Set the Output Idle state */
6990  tmpcr2 |= (OC_Config->OCIdleState << 4U);
6991  /* Set the Output N Idle state */
6992  tmpcr2 |= (OC_Config->OCNIdleState << 4U);
6993  }
6994 
6995  /* Write to TIMx CR2 */
6996  TIMx->CR2 = tmpcr2;
6997 
6998  /* Write to TIMx CCMR2 */
6999  TIMx->CCMR2 = tmpccmrx;
7000 
7001  /* Set the Capture Compare Register value */
7002  TIMx->CCR3 = OC_Config->Pulse;
7003 
7004  /* Write to TIMx CCER */
7005  TIMx->CCER = tmpccer;
7006 }
7007 
7014 static void TIM_OC4_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
7015 {
7016  uint32_t tmpccmrx;
7017  uint32_t tmpccer;
7018  uint32_t tmpcr2;
7019 
7020  /* Disable the Channel 4: Reset the CC4E Bit */
7021  TIMx->CCER &= ~TIM_CCER_CC4E;
7022 
7023  /* Get the TIMx CCER register value */
7024  tmpccer = TIMx->CCER;
7025  /* Get the TIMx CR2 register value */
7026  tmpcr2 = TIMx->CR2;
7027 
7028  /* Get the TIMx CCMR2 register value */
7029  tmpccmrx = TIMx->CCMR2;
7030 
7031  /* Reset the Output Compare mode and Capture/Compare selection Bits */
7032  tmpccmrx &= ~TIM_CCMR2_OC4M;
7033  tmpccmrx &= ~TIM_CCMR2_CC4S;
7034 
7035  /* Select the Output Compare Mode */
7036  tmpccmrx |= (OC_Config->OCMode << 8U);
7037 
7038  /* Reset the Output Polarity level */
7039  tmpccer &= ~TIM_CCER_CC4P;
7040  /* Set the Output Compare Polarity */
7041  tmpccer |= (OC_Config->OCPolarity << 12U);
7042 
7043  if (IS_TIM_BREAK_INSTANCE(TIMx))
7044  {
7045  /* Check parameters */
7047 
7048  /* Reset the Output Compare IDLE State */
7049  tmpcr2 &= ~TIM_CR2_OIS4;
7050 
7051  /* Set the Output Idle state */
7052  tmpcr2 |= (OC_Config->OCIdleState << 6U);
7053  }
7054 
7055  /* Write to TIMx CR2 */
7056  TIMx->CR2 = tmpcr2;
7057 
7058  /* Write to TIMx CCMR2 */
7059  TIMx->CCMR2 = tmpccmrx;
7060 
7061  /* Set the Capture Compare Register value */
7062  TIMx->CCR4 = OC_Config->Pulse;
7063 
7064  /* Write to TIMx CCER */
7065  TIMx->CCER = tmpccer;
7066 }
7067 
7074 static void TIM_OC5_SetConfig(TIM_TypeDef *TIMx,
7075  TIM_OC_InitTypeDef *OC_Config)
7076 {
7077  uint32_t tmpccmrx;
7078  uint32_t tmpccer;
7079  uint32_t tmpcr2;
7080 
7081  /* Disable the output: Reset the CCxE Bit */
7082  TIMx->CCER &= ~TIM_CCER_CC5E;
7083 
7084  /* Get the TIMx CCER register value */
7085  tmpccer = TIMx->CCER;
7086  /* Get the TIMx CR2 register value */
7087  tmpcr2 = TIMx->CR2;
7088  /* Get the TIMx CCMR1 register value */
7089  tmpccmrx = TIMx->CCMR3;
7090 
7091  /* Reset the Output Compare Mode Bits */
7092  tmpccmrx &= ~(TIM_CCMR3_OC5M);
7093  /* Select the Output Compare Mode */
7094  tmpccmrx |= OC_Config->OCMode;
7095 
7096  /* Reset the Output Polarity level */
7097  tmpccer &= ~TIM_CCER_CC5P;
7098  /* Set the Output Compare Polarity */
7099  tmpccer |= (OC_Config->OCPolarity << 16U);
7100 
7101  if (IS_TIM_BREAK_INSTANCE(TIMx))
7102  {
7103  /* Reset the Output Compare IDLE State */
7104  tmpcr2 &= ~TIM_CR2_OIS5;
7105  /* Set the Output Idle state */
7106  tmpcr2 |= (OC_Config->OCIdleState << 8U);
7107  }
7108  /* Write to TIMx CR2 */
7109  TIMx->CR2 = tmpcr2;
7110 
7111  /* Write to TIMx CCMR3 */
7112  TIMx->CCMR3 = tmpccmrx;
7113 
7114  /* Set the Capture Compare Register value */
7115  TIMx->CCR5 = OC_Config->Pulse;
7116 
7117  /* Write to TIMx CCER */
7118  TIMx->CCER = tmpccer;
7119 }
7120 
7127 static void TIM_OC6_SetConfig(TIM_TypeDef *TIMx,
7128  TIM_OC_InitTypeDef *OC_Config)
7129 {
7130  uint32_t tmpccmrx;
7131  uint32_t tmpccer;
7132  uint32_t tmpcr2;
7133 
7134  /* Disable the output: Reset the CCxE Bit */
7135  TIMx->CCER &= ~TIM_CCER_CC6E;
7136 
7137  /* Get the TIMx CCER register value */
7138  tmpccer = TIMx->CCER;
7139  /* Get the TIMx CR2 register value */
7140  tmpcr2 = TIMx->CR2;
7141  /* Get the TIMx CCMR1 register value */
7142  tmpccmrx = TIMx->CCMR3;
7143 
7144  /* Reset the Output Compare Mode Bits */
7145  tmpccmrx &= ~(TIM_CCMR3_OC6M);
7146  /* Select the Output Compare Mode */
7147  tmpccmrx |= (OC_Config->OCMode << 8U);
7148 
7149  /* Reset the Output Polarity level */
7150  tmpccer &= (uint32_t)~TIM_CCER_CC6P;
7151  /* Set the Output Compare Polarity */
7152  tmpccer |= (OC_Config->OCPolarity << 20U);
7153 
7154  if (IS_TIM_BREAK_INSTANCE(TIMx))
7155  {
7156  /* Reset the Output Compare IDLE State */
7157  tmpcr2 &= ~TIM_CR2_OIS6;
7158  /* Set the Output Idle state */
7159  tmpcr2 |= (OC_Config->OCIdleState << 10U);
7160  }
7161 
7162  /* Write to TIMx CR2 */
7163  TIMx->CR2 = tmpcr2;
7164 
7165  /* Write to TIMx CCMR3 */
7166  TIMx->CCMR3 = tmpccmrx;
7167 
7168  /* Set the Capture Compare Register value */
7169  TIMx->CCR6 = OC_Config->Pulse;
7170 
7171  /* Write to TIMx CCER */
7172  TIMx->CCER = tmpccer;
7173 }
7174 
7181 static HAL_StatusTypeDef TIM_SlaveTimer_SetConfig(TIM_HandleTypeDef *htim,
7182  TIM_SlaveConfigTypeDef *sSlaveConfig)
7183 {
7184  uint32_t tmpsmcr;
7185  uint32_t tmpccmr1;
7186  uint32_t tmpccer;
7187 
7188  /* Get the TIMx SMCR register value */
7189  tmpsmcr = htim->Instance->SMCR;
7190 
7191  /* Reset the Trigger Selection Bits */
7192  tmpsmcr &= ~TIM_SMCR_TS;
7193  /* Set the Input Trigger source */
7194  tmpsmcr |= sSlaveConfig->InputTrigger;
7195 
7196  /* Reset the slave mode Bits */
7197  tmpsmcr &= ~TIM_SMCR_SMS;
7198  /* Set the slave mode */
7199  tmpsmcr |= sSlaveConfig->SlaveMode;
7200 
7201  /* Write to TIMx SMCR */
7202  htim->Instance->SMCR = tmpsmcr;
7203 
7204  /* Configure the trigger prescaler, filter, and polarity */
7205  switch (sSlaveConfig->InputTrigger)
7206  {
7207  case TIM_TS_ETRF:
7208  {
7209  /* Check the parameters */
7214  /* Configure the ETR Trigger source */
7216  sSlaveConfig->TriggerPrescaler,
7217  sSlaveConfig->TriggerPolarity,
7218  sSlaveConfig->TriggerFilter);
7219  break;
7220  }
7221 
7222  case TIM_TS_TI1F_ED:
7223  {
7224  /* Check the parameters */
7227 
7228  if (sSlaveConfig->SlaveMode == TIM_SLAVEMODE_GATED)
7229  {
7230  return HAL_ERROR;
7231  }
7232 
7233  /* Disable the Channel 1: Reset the CC1E Bit */
7234  tmpccer = htim->Instance->CCER;
7235  htim->Instance->CCER &= ~TIM_CCER_CC1E;
7236  tmpccmr1 = htim->Instance->CCMR1;
7237 
7238  /* Set the filter */
7239  tmpccmr1 &= ~TIM_CCMR1_IC1F;
7240  tmpccmr1 |= ((sSlaveConfig->TriggerFilter) << 4U);
7241 
7242  /* Write to TIMx CCMR1 and CCER registers */
7243  htim->Instance->CCMR1 = tmpccmr1;
7244  htim->Instance->CCER = tmpccer;
7245  break;
7246  }
7247 
7248  case TIM_TS_TI1FP1:
7249  {
7250  /* Check the parameters */
7254 
7255  /* Configure TI1 Filter and Polarity */
7256  TIM_TI1_ConfigInputStage(htim->Instance,
7257  sSlaveConfig->TriggerPolarity,
7258  sSlaveConfig->TriggerFilter);
7259  break;
7260  }
7261 
7262  case TIM_TS_TI2FP2:
7263  {
7264  /* Check the parameters */
7268 
7269  /* Configure TI2 Filter and Polarity */
7270  TIM_TI2_ConfigInputStage(htim->Instance,
7271  sSlaveConfig->TriggerPolarity,
7272  sSlaveConfig->TriggerFilter);
7273  break;
7274  }
7275 
7276  case TIM_TS_ITR0:
7277  case TIM_TS_ITR1:
7278  case TIM_TS_ITR2:
7279  case TIM_TS_ITR3:
7280  case TIM_TS_ITR4:
7281  case TIM_TS_ITR5:
7282  case TIM_TS_ITR6:
7283  case TIM_TS_ITR7:
7284  case TIM_TS_ITR8:
7285  case TIM_TS_ITR9:
7286  case TIM_TS_ITR10:
7287  case TIM_TS_ITR11:
7288  case TIM_TS_ITR12:
7289  case TIM_TS_ITR13:
7290  {
7291  /* Check the parameter */
7293  break;
7294  }
7295 
7296  default:
7297  break;
7298  }
7299  return HAL_OK;
7300 }
7301 
7322 void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
7323  uint32_t TIM_ICFilter)
7324 {
7325  uint32_t tmpccmr1;
7326  uint32_t tmpccer;
7327 
7328  /* Disable the Channel 1: Reset the CC1E Bit */
7329  TIMx->CCER &= ~TIM_CCER_CC1E;
7330  tmpccmr1 = TIMx->CCMR1;
7331  tmpccer = TIMx->CCER;
7332 
7333  /* Select the Input */
7334  if (IS_TIM_CC2_INSTANCE(TIMx) != RESET)
7335  {
7336  tmpccmr1 &= ~TIM_CCMR1_CC1S;
7337  tmpccmr1 |= TIM_ICSelection;
7338  }
7339  else
7340  {
7341  tmpccmr1 |= TIM_CCMR1_CC1S_0;
7342  }
7343 
7344  /* Set the filter */
7345  tmpccmr1 &= ~TIM_CCMR1_IC1F;
7346  tmpccmr1 |= ((TIM_ICFilter << 4U) & TIM_CCMR1_IC1F);
7347 
7348  /* Select the Polarity and set the CC1E Bit */
7349  tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP);
7350  tmpccer |= (TIM_ICPolarity & (TIM_CCER_CC1P | TIM_CCER_CC1NP));
7351 
7352  /* Write to TIMx CCMR1 and CCER registers */
7353  TIMx->CCMR1 = tmpccmr1;
7354  TIMx->CCER = tmpccer;
7355 }
7356 
7369 static void TIM_TI1_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
7370 {
7371  uint32_t tmpccmr1;
7372  uint32_t tmpccer;
7373 
7374  /* Disable the Channel 1: Reset the CC1E Bit */
7375  tmpccer = TIMx->CCER;
7376  TIMx->CCER &= ~TIM_CCER_CC1E;
7377  tmpccmr1 = TIMx->CCMR1;
7378 
7379  /* Set the filter */
7380  tmpccmr1 &= ~TIM_CCMR1_IC1F;
7381  tmpccmr1 |= (TIM_ICFilter << 4U);
7382 
7383  /* Select the Polarity and set the CC1E Bit */
7384  tmpccer &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP);
7385  tmpccer |= TIM_ICPolarity;
7386 
7387  /* Write to TIMx CCMR1 and CCER registers */
7388  TIMx->CCMR1 = tmpccmr1;
7389  TIMx->CCER = tmpccer;
7390 }
7391 
7412 static void TIM_TI2_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
7413  uint32_t TIM_ICFilter)
7414 {
7415  uint32_t tmpccmr1;
7416  uint32_t tmpccer;
7417 
7418  /* Disable the Channel 2: Reset the CC2E Bit */
7419  TIMx->CCER &= ~TIM_CCER_CC2E;
7420  tmpccmr1 = TIMx->CCMR1;
7421  tmpccer = TIMx->CCER;
7422 
7423  /* Select the Input */
7424  tmpccmr1 &= ~TIM_CCMR1_CC2S;
7425  tmpccmr1 |= (TIM_ICSelection << 8U);
7426 
7427  /* Set the filter */
7428  tmpccmr1 &= ~TIM_CCMR1_IC2F;
7429  tmpccmr1 |= ((TIM_ICFilter << 12U) & TIM_CCMR1_IC2F);
7430 
7431  /* Select the Polarity and set the CC2E Bit */
7432  tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP);
7433  tmpccer |= ((TIM_ICPolarity << 4U) & (TIM_CCER_CC2P | TIM_CCER_CC2NP));
7434 
7435  /* Write to TIMx CCMR1 and CCER registers */
7436  TIMx->CCMR1 = tmpccmr1 ;
7437  TIMx->CCER = tmpccer;
7438 }
7439 
7452 static void TIM_TI2_ConfigInputStage(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICFilter)
7453 {
7454  uint32_t tmpccmr1;
7455  uint32_t tmpccer;
7456 
7457  /* Disable the Channel 2: Reset the CC2E Bit */
7458  TIMx->CCER &= ~TIM_CCER_CC2E;
7459  tmpccmr1 = TIMx->CCMR1;
7460  tmpccer = TIMx->CCER;
7461 
7462  /* Set the filter */
7463  tmpccmr1 &= ~TIM_CCMR1_IC2F;
7464  tmpccmr1 |= (TIM_ICFilter << 12U);
7465 
7466  /* Select the Polarity and set the CC2E Bit */
7467  tmpccer &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP);
7468  tmpccer |= (TIM_ICPolarity << 4U);
7469 
7470  /* Write to TIMx CCMR1 and CCER registers */
7471  TIMx->CCMR1 = tmpccmr1 ;
7472  TIMx->CCER = tmpccer;
7473 }
7474 
7495 static void TIM_TI3_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
7496  uint32_t TIM_ICFilter)
7497 {
7498  uint32_t tmpccmr2;
7499  uint32_t tmpccer;
7500 
7501  /* Disable the Channel 3: Reset the CC3E Bit */
7502  TIMx->CCER &= ~TIM_CCER_CC3E;
7503  tmpccmr2 = TIMx->CCMR2;
7504  tmpccer = TIMx->CCER;
7505 
7506  /* Select the Input */
7507  tmpccmr2 &= ~TIM_CCMR2_CC3S;
7508  tmpccmr2 |= TIM_ICSelection;
7509 
7510  /* Set the filter */
7511  tmpccmr2 &= ~TIM_CCMR2_IC3F;
7512  tmpccmr2 |= ((TIM_ICFilter << 4U) & TIM_CCMR2_IC3F);
7513 
7514  /* Select the Polarity and set the CC3E Bit */
7515  tmpccer &= ~(TIM_CCER_CC3P | TIM_CCER_CC3NP);
7516  tmpccer |= ((TIM_ICPolarity << 8U) & (TIM_CCER_CC3P | TIM_CCER_CC3NP));
7517 
7518  /* Write to TIMx CCMR2 and CCER registers */
7519  TIMx->CCMR2 = tmpccmr2;
7520  TIMx->CCER = tmpccer;
7521 }
7522 
7543 static void TIM_TI4_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection,
7544  uint32_t TIM_ICFilter)
7545 {
7546  uint32_t tmpccmr2;
7547  uint32_t tmpccer;
7548 
7549  /* Disable the Channel 4: Reset the CC4E Bit */
7550  TIMx->CCER &= ~TIM_CCER_CC4E;
7551  tmpccmr2 = TIMx->CCMR2;
7552  tmpccer = TIMx->CCER;
7553 
7554  /* Select the Input */
7555  tmpccmr2 &= ~TIM_CCMR2_CC4S;
7556  tmpccmr2 |= (TIM_ICSelection << 8U);
7557 
7558  /* Set the filter */
7559  tmpccmr2 &= ~TIM_CCMR2_IC4F;
7560  tmpccmr2 |= ((TIM_ICFilter << 12U) & TIM_CCMR2_IC4F);
7561 
7562  /* Select the Polarity and set the CC4E Bit */
7563  tmpccer &= ~(TIM_CCER_CC4P | TIM_CCER_CC4NP);
7564  tmpccer |= ((TIM_ICPolarity << 12U) & (TIM_CCER_CC4P | TIM_CCER_CC4NP));
7565 
7566  /* Write to TIMx CCMR2 and CCER registers */
7567  TIMx->CCMR2 = tmpccmr2;
7568  TIMx->CCER = tmpccer ;
7569 }
7570 
7599 static void TIM_ITRx_SetConfig(TIM_TypeDef *TIMx, uint32_t InputTriggerSource)
7600 {
7601  uint32_t tmpsmcr;
7602 
7603  /* Get the TIMx SMCR register value */
7604  tmpsmcr = TIMx->SMCR;
7605  /* Reset the TS Bits */
7606  tmpsmcr &= ~TIM_SMCR_TS;
7607  /* Set the Input Trigger source and the slave mode*/
7608  tmpsmcr |= (InputTriggerSource | TIM_SLAVEMODE_EXTERNAL1);
7609  /* Write to TIMx SMCR */
7610  TIMx->SMCR = tmpsmcr;
7611 }
7629 void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler,
7630  uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter)
7631 {
7632  uint32_t tmpsmcr;
7633 
7634  tmpsmcr = TIMx->SMCR;
7635 
7636  /* Reset the ETR Bits */
7638 
7639  /* Set the Prescaler, the Filter value and the Polarity */
7640  tmpsmcr |= (uint32_t)(TIM_ExtTRGPrescaler | (TIM_ExtTRGPolarity | (ExtTRGFilter << 8U)));
7641 
7642  /* Write to TIMx SMCR */
7643  TIMx->SMCR = tmpsmcr;
7644 }
7645 
7661 void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
7662 {
7663  uint32_t tmp;
7664 
7665  /* Check the parameters */
7667  assert_param(IS_TIM_CHANNELS(Channel));
7668 
7669  tmp = TIM_CCER_CC1E << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */
7670 
7671  /* Reset the CCxE Bit */
7672  TIMx->CCER &= ~tmp;
7673 
7674  /* Set or reset the CCxE Bit */
7675  TIMx->CCER |= (uint32_t)(ChannelState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */
7676 }
7677 
7678 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
7679 
7685 void TIM_ResetCallback(TIM_HandleTypeDef *htim)
7686 {
7687  /* Reset the TIM callback to the legacy weak callbacks */
7688  htim->PeriodElapsedCallback = HAL_TIM_PeriodElapsedCallback; /* Legacy weak PeriodElapsedCallback */
7689  htim->PeriodElapsedHalfCpltCallback = HAL_TIM_PeriodElapsedHalfCpltCallback; /* Legacy weak PeriodElapsedHalfCpltCallback */
7690  htim->TriggerCallback = HAL_TIM_TriggerCallback; /* Legacy weak TriggerCallback */
7691  htim->TriggerHalfCpltCallback = HAL_TIM_TriggerHalfCpltCallback; /* Legacy weak TriggerHalfCpltCallback */
7692  htim->IC_CaptureCallback = HAL_TIM_IC_CaptureCallback; /* Legacy weak IC_CaptureCallback */
7693  htim->IC_CaptureHalfCpltCallback = HAL_TIM_IC_CaptureHalfCpltCallback; /* Legacy weak IC_CaptureHalfCpltCallback */
7694  htim->OC_DelayElapsedCallback = HAL_TIM_OC_DelayElapsedCallback; /* Legacy weak OC_DelayElapsedCallback */
7695  htim->PWM_PulseFinishedCallback = HAL_TIM_PWM_PulseFinishedCallback; /* Legacy weak PWM_PulseFinishedCallback */
7696  htim->PWM_PulseFinishedHalfCpltCallback = HAL_TIM_PWM_PulseFinishedHalfCpltCallback; /* Legacy weak PWM_PulseFinishedHalfCpltCallback */
7697  htim->ErrorCallback = HAL_TIM_ErrorCallback; /* Legacy weak ErrorCallback */
7698  htim->CommutationCallback = HAL_TIMEx_CommutCallback; /* Legacy weak CommutationCallback */
7699  htim->CommutationHalfCpltCallback = HAL_TIMEx_CommutHalfCpltCallback; /* Legacy weak CommutationHalfCpltCallback */
7700  htim->BreakCallback = HAL_TIMEx_BreakCallback; /* Legacy weak BreakCallback */
7701  htim->Break2Callback = HAL_TIMEx_Break2Callback; /* Legacy weak Break2Callback */
7702 }
7703 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
7704 
7709 #endif /* HAL_TIM_MODULE_ENABLED */
7710 
7717 /************************ (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
TIM_CR2_OIS5
#define TIM_CR2_OIS5
Definition: stm32f769xx.h:14364
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_CCER_CC5P
#define TIM_CCER_CC5P
Definition: stm32f769xx.h:14791
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
TIM_CHANNEL_N_STATE_SET
#define TIM_CHANNEL_N_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2089
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
HAL_TIM_ActiveChannel
HAL_TIM_ActiveChannel
HAL Active channel structures definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:300
TIM_CCMR3_OC5CE
#define TIM_CCMR3_OC5CE
Definition: stm32f769xx.h:14968
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)
TIM_CLOCKSOURCE_ITR8
#define TIM_CLOCKSOURCE_ITR8
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:794
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)
IS_TIM_CC6_INSTANCE
#define IS_TIM_CC6_INSTANCE(__INSTANCE__)
Definition: stm32f769xx.h:21711
TIM_TS_ITR4
#define TIM_TS_ITR4
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1019
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
TIM_TypeDef::CCR5
__IO uint32_t CCR5
Definition: stm32f769xx.h:979
TIM_CLOCKSOURCE_ITR5
#define TIM_CLOCKSOURCE_ITR5
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:791
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
TIM_HandleTypeDef::DMABurstState
__IO HAL_TIM_DMABurstStateTypeDef DMABurstState
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:359
HAL_DMA_Abort_IT
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
TIM_CR1_CKD
#define TIM_CR1_CKD
Definition: stm32f407xx.h:11928
TIM_TS_ITR6
#define TIM_TS_ITR6
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1021
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)
HAL_TIM_CHANNEL_STATE_READY
@ HAL_TIM_CHANNEL_STATE_READY
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:313
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_CLOCKSOURCE_ITR4
#define TIM_CLOCKSOURCE_ITR4
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:790
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_TS_ITR9
#define TIM_TS_ITR9
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1024
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_TypeDef::CCR6
__IO uint32_t CCR6
Definition: stm32f769xx.h:980
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
TIM_CHANNEL_6
#define TIM_CHANNEL_6
Definition: stm32f7xx_hal_tim.h:748
IS_TIM_CC5_INSTANCE
#define IS_TIM_CC5_INSTANCE(__INSTANCE__)
Definition: stm32f769xx.h:21707
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
__DMA_HandleTypeDef::Init
DMA_InitTypeDef Init
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:143
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
IS_TIM_DMA_DATA_LENGTH
#define IS_TIM_DMA_DATA_LENGTH(LENGTH)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2020
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)
HAL_TIM_CHANNEL_STATE_BUSY
@ HAL_TIM_CHANNEL_STATE_BUSY
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:314
TIM_Base_InitTypeDef::ClockDivision
uint32_t ClockDivision
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:59
TIM_TS_ITR8
#define TIM_TS_ITR8
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1023
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
TIM_CCMR3_OC6CE
#define TIM_CCMR3_OC6CE
Definition: stm32f769xx.h:14987
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_TS_ITR13
#define TIM_TS_ITR13
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1028
TIM_FLAG_BREAK
#define TIM_FLAG_BREAK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:695
HAL_DMA_BURST_STATE_RESET
@ HAL_DMA_BURST_STATE_RESET
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:322
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
HAL_TIMEx_Break2Callback
void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim)
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_DMABurstStateTypeDef
HAL_TIM_DMABurstStateTypeDef
DMA Burst States definition.
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:320
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_TS_ITR11
#define TIM_TS_ITR11
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1026
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_CLOCKSOURCE_ITR7
#define TIM_CLOCKSOURCE_ITR7
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:793
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_CLOCKSOURCE_ITR6
#define TIM_CLOCKSOURCE_ITR6
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:792
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_TS_ITR5
#define TIM_TS_ITR5
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1020
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)
TIM_TypeDef::CCMR3
__IO uint32_t CCMR3
Definition: stm32f769xx.h:978
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_CHANNEL_N_STATE_GET
#define TIM_CHANNEL_N_STATE_GET(__HANDLE__, __CHANNEL__)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2083
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_CHANNEL_STATE_SET_ALL
#define TIM_CHANNEL_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2074
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_CCMR3_OC6PE
#define TIM_CCMR3_OC6PE
Definition: stm32f769xx.h:14975
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_ChannelStateTypeDef
HAL_TIM_ChannelStateTypeDef
TIM Channel States definition.
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:310
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_DMA_BURST_STATE_READY
@ HAL_DMA_BURST_STATE_READY
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:323
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_CHANNEL_N_STATE_SET_ALL
#define TIM_CHANNEL_N_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2095
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_CHANNEL_STATE_SET
#define TIM_CHANNEL_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2066
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_CCER_CC6P
#define TIM_CCER_CC6P
Definition: stm32f769xx.h:14797
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_CCER_CC5E
#define TIM_CCER_CC5E
Definition: stm32f769xx.h:14788
TIM_CCMR3_OC5PE
#define TIM_CCMR3_OC5PE
Definition: stm32f769xx.h:14956
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_DMABurstState
HAL_TIM_DMABurstStateTypeDef HAL_TIM_DMABurstState(TIM_HandleTypeDef *htim)
HAL_TIM_OC_MspDeInit
void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim)
DMA_NORMAL
#define DMA_NORMAL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:281
HAL_TIM_PWM_Stop
HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_CCMR3_OC6M
#define TIM_CCMR3_OC6M
Definition: stm32f769xx.h:14979
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_CCMR3_OC5FE
#define TIM_CCMR3_OC5FE
Definition: stm32f769xx.h:14953
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
HAL_TIM_DMABurst_MultiWriteStart
HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength, uint32_t DataLength)
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_CHANNEL_STATE_RESET
@ HAL_TIM_CHANNEL_STATE_RESET
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:312
__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_DMA_BURST_STATE_BUSY
@ HAL_DMA_BURST_STATE_BUSY
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:324
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)
HAL_TIM_GetChannelState
HAL_TIM_ChannelStateTypeDef HAL_TIM_GetChannelState(TIM_HandleTypeDef *htim, uint32_t Channel)
TIM_CHANNEL_STATE_GET
#define TIM_CHANNEL_STATE_GET(__HANDLE__, __CHANNEL__)
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:2058
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
TIM_TS_ITR10
#define TIM_TS_ITR10
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1025
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
TIM_TS_ITR12
#define TIM_TS_ITR12
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1027
HAL_TIM_OC_MspInit
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim)
HAL_TIM_GetActiveChannel
HAL_TIM_ActiveChannel HAL_TIM_GetActiveChannel(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
DMA_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:70
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
TIM_CHANNEL_5
#define TIM_CHANNEL_5
Definition: stm32f7xx_hal_tim.h:747
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)
TIM_TS_ITR7
#define TIM_TS_ITR7
Definition: stm32h735/stm32h735g-dk/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_tim.h:1022
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_DMABurst_MultiReadStart
HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength, uint32_t DataLength)
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_FLAG_BREAK2
#define TIM_FLAG_BREAK2
Definition: stm32f7xx_hal_tim.h:730
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
__HAL_TIM_CLEAR_FLAG
#define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the specified TIM interrupt flag.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:1172
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
TIM_CCMR3_OC5M
#define TIM_CCMR3_OC5M
Definition: stm32f769xx.h:14960
IS_TIM_XOR_INSTANCE
#define IS_TIM_XOR_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15221
TIM_CCER_CC6E
#define TIM_CCER_CC6E
Definition: stm32f769xx.h:14794
TIM_CCMR3_OC6FE
#define TIM_CCMR3_OC6FE
Definition: stm32f769xx.h:14972
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
TIM_CR2_OIS6
#define TIM_CR2_OIS6
Definition: stm32f769xx.h:14367
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
IS_TIM_ENCODER_INTERFACE_INSTANCE
#define IS_TIM_ENCODER_INTERFACE_INSTANCE(INSTANCE)
Definition: stm32f407xx.h:15446
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:55