STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_tim_ex.c
Go to the documentation of this file.
1 
79 /* Includes ------------------------------------------------------------------*/
80 #include "stm32l4xx_hal.h"
81 
91 #ifdef HAL_TIM_MODULE_ENABLED
92 
93 /* Private typedef -----------------------------------------------------------*/
94 /* Private define ------------------------------------------------------------*/
95 /* Private macro -------------------------------------------------------------*/
96 /* Private variables ---------------------------------------------------------*/
97 /* Private function prototypes -----------------------------------------------*/
98 static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState);
99 
100 /* Exported functions --------------------------------------------------------*/
133 {
134  TIM_OC_InitTypeDef OC_Config;
135 
136  /* Check the TIM handle allocation */
137  if (htim == NULL)
138  {
139  return HAL_ERROR;
140  }
141 
142  /* Check the parameters */
143  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
144  assert_param(IS_TIM_COUNTER_MODE(htim->Init.CounterMode));
145  assert_param(IS_TIM_CLOCKDIVISION_DIV(htim->Init.ClockDivision));
146  assert_param(IS_TIM_AUTORELOAD_PRELOAD(htim->Init.AutoReloadPreload));
147  assert_param(IS_TIM_IC_POLARITY(sConfig->IC1Polarity));
148  assert_param(IS_TIM_IC_PRESCALER(sConfig->IC1Prescaler));
149  assert_param(IS_TIM_IC_FILTER(sConfig->IC1Filter));
150 
151  if (htim->State == HAL_TIM_STATE_RESET)
152  {
153  /* Allocate lock resource and initialize it */
154  htim->Lock = HAL_UNLOCKED;
155 
156 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
157  /* Reset interrupt callbacks to legacy week callbacks */
158  TIM_ResetCallback(htim);
159 
160  if (htim->HallSensor_MspInitCallback == NULL)
161  {
162  htim->HallSensor_MspInitCallback = HAL_TIMEx_HallSensor_MspInit;
163  }
164  /* Init the low level hardware : GPIO, CLOCK, NVIC */
165  htim->HallSensor_MspInitCallback(htim);
166 #else
167  /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */
169 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
170  }
171 
172  /* Set the TIM state */
173  htim->State = HAL_TIM_STATE_BUSY;
174 
175  /* Configure the Time base in the Encoder Mode */
176  TIM_Base_SetConfig(htim->Instance, &htim->Init);
177 
178  /* Configure the Channel 1 as Input Channel to interface with the three Outputs of the Hall sensor */
179  TIM_TI1_SetConfig(htim->Instance, sConfig->IC1Polarity, TIM_ICSELECTION_TRC, sConfig->IC1Filter);
180 
181  /* Reset the IC1PSC Bits */
182  htim->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC;
183  /* Set the IC1PSC value */
184  htim->Instance->CCMR1 |= sConfig->IC1Prescaler;
185 
186  /* Enable the Hall sensor interface (XOR function of the three inputs) */
187  htim->Instance->CR2 |= TIM_CR2_TI1S;
188 
189  /* Select the TIM_TS_TI1F_ED signal as Input trigger for the TIM */
190  htim->Instance->SMCR &= ~TIM_SMCR_TS;
191  htim->Instance->SMCR |= TIM_TS_TI1F_ED;
192 
193  /* Use the TIM_TS_TI1F_ED signal to reset the TIM counter each edge detection */
194  htim->Instance->SMCR &= ~TIM_SMCR_SMS;
195  htim->Instance->SMCR |= TIM_SLAVEMODE_RESET;
196 
197  /* Program channel 2 in PWM 2 mode with the desired Commutation_Delay*/
198  OC_Config.OCFastMode = TIM_OCFAST_DISABLE;
199  OC_Config.OCIdleState = TIM_OCIDLESTATE_RESET;
200  OC_Config.OCMode = TIM_OCMODE_PWM2;
201  OC_Config.OCNIdleState = TIM_OCNIDLESTATE_RESET;
202  OC_Config.OCNPolarity = TIM_OCNPOLARITY_HIGH;
203  OC_Config.OCPolarity = TIM_OCPOLARITY_HIGH;
204  OC_Config.Pulse = sConfig->Commutation_Delay;
205 
206  TIM_OC2_SetConfig(htim->Instance, &OC_Config);
207 
208  /* Select OC2REF as trigger output on TRGO: write the MMS bits in the TIMx_CR2
209  register to 101 */
210  htim->Instance->CR2 &= ~TIM_CR2_MMS;
211  htim->Instance->CR2 |= TIM_TRGO_OC2REF;
212 
213  /* Initialize the TIM state*/
214  htim->State = HAL_TIM_STATE_READY;
215 
216  return HAL_OK;
217 }
218 
225 {
226  /* Check the parameters */
227  assert_param(IS_TIM_INSTANCE(htim->Instance));
228 
229  htim->State = HAL_TIM_STATE_BUSY;
230 
231  /* Disable the TIM Peripheral Clock */
232  __HAL_TIM_DISABLE(htim);
233 
234 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
235  if (htim->HallSensor_MspDeInitCallback == NULL)
236  {
237  htim->HallSensor_MspDeInitCallback = HAL_TIMEx_HallSensor_MspDeInit;
238  }
239  /* DeInit the low level hardware */
240  htim->HallSensor_MspDeInitCallback(htim);
241 #else
242  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
244 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
245 
246  /* Change TIM state */
247  htim->State = HAL_TIM_STATE_RESET;
248 
249  /* Release Lock */
250  __HAL_UNLOCK(htim);
251 
252  return HAL_OK;
253 }
254 
261 {
262  /* Prevent unused argument(s) compilation warning */
263  UNUSED(htim);
264 
265  /* NOTE : This function should not be modified, when the callback is needed,
266  the HAL_TIMEx_HallSensor_MspInit could be implemented in the user file
267  */
268 }
269 
276 {
277  /* Prevent unused argument(s) compilation warning */
278  UNUSED(htim);
279 
280  /* NOTE : This function should not be modified, when the callback is needed,
281  the HAL_TIMEx_HallSensor_MspDeInit could be implemented in the user file
282  */
283 }
284 
291 {
292  uint32_t tmpsmcr;
293 
294  /* Check the parameters */
295  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
296 
297  /* Enable the Input Capture channel 1
298  (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */
299  TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
300 
301  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
302  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
303  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
304  {
305  __HAL_TIM_ENABLE(htim);
306  }
307 
308  /* Return function status */
309  return HAL_OK;
310 }
311 
318 {
319  /* Check the parameters */
320  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
321 
322  /* Disable the Input Capture channels 1, 2 and 3
323  (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */
324  TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
325 
326  /* Disable the Peripheral */
327  __HAL_TIM_DISABLE(htim);
328 
329  /* Return function status */
330  return HAL_OK;
331 }
332 
339 {
340  uint32_t tmpsmcr;
341 
342  /* Check the parameters */
343  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
344 
345  /* Enable the capture compare Interrupts 1 event */
346  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
347 
348  /* Enable the Input Capture channel 1
349  (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */
350  TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
351 
352  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
353  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
354  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
355  {
356  __HAL_TIM_ENABLE(htim);
357  }
358 
359  /* Return function status */
360  return HAL_OK;
361 }
362 
369 {
370  /* Check the parameters */
371  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
372 
373  /* Disable the Input Capture channel 1
374  (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */
375  TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
376 
377  /* Disable the capture compare Interrupts event */
378  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
379 
380  /* Disable the Peripheral */
381  __HAL_TIM_DISABLE(htim);
382 
383  /* Return function status */
384  return HAL_OK;
385 }
386 
394 HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
395 {
396  uint32_t tmpsmcr;
397 
398  /* Check the parameters */
399  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
400 
401  if ((htim->State == HAL_TIM_STATE_BUSY))
402  {
403  return HAL_BUSY;
404  }
405  else if ((htim->State == HAL_TIM_STATE_READY))
406  {
407  if (((uint32_t)pData == 0U) && (Length > 0U))
408  {
409  return HAL_ERROR;
410  }
411  else
412  {
413  htim->State = HAL_TIM_STATE_BUSY;
414  }
415  }
416  else
417  {
418  /* nothing to do */
419  }
420  /* Enable the Input Capture channel 1
421  (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */
422  TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE);
423 
424  /* Set the DMA Input Capture 1 Callbacks */
425  htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMACaptureCplt;
426  htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMACaptureHalfCplt;
427  /* Set the DMA error callback */
428  htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
429 
430  /* Enable the DMA channel for Capture 1*/
431  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)&htim->Instance->CCR1, (uint32_t)pData, Length) != HAL_OK)
432  {
433  return HAL_ERROR;
434  }
435  /* Enable the capture compare 1 Interrupt */
436  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
437 
438  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
439  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
440  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
441  {
442  __HAL_TIM_ENABLE(htim);
443  }
444 
445  /* Return function status */
446  return HAL_OK;
447 }
448 
455 {
456  /* Check the parameters */
457  assert_param(IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(htim->Instance));
458 
459  /* Disable the Input Capture channel 1
460  (in the Hall Sensor Interface the three possible channels that can be used are TIM_CHANNEL_1, TIM_CHANNEL_2 and TIM_CHANNEL_3) */
461  TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_DISABLE);
462 
463 
464  /* Disable the capture compare Interrupts 1 event */
465  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
466 
467  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
468  /* Disable the Peripheral */
469  __HAL_TIM_DISABLE(htim);
470 
471  /* Return function status */
472  return HAL_OK;
473 }
474 
510 HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
511 {
512  uint32_t tmpsmcr;
513 
514  /* Check the parameters */
515  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
516 
517  /* Enable the Capture compare channel N */
518  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE);
519 
520  /* Enable the Main Output */
521  __HAL_TIM_MOE_ENABLE(htim);
522 
523  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
524  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
525  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
526  {
527  __HAL_TIM_ENABLE(htim);
528  }
529 
530  /* Return function status */
531  return HAL_OK;
532 }
533 
545 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
546 {
547  /* Check the parameters */
548  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
549 
550  /* Disable the Capture compare channel N */
551  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE);
552 
553  /* Disable the Main Output */
554  __HAL_TIM_MOE_DISABLE(htim);
555 
556  /* Disable the Peripheral */
557  __HAL_TIM_DISABLE(htim);
558 
559  /* Return function status */
560  return HAL_OK;
561 }
562 
574 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
575 {
576  uint32_t tmpsmcr;
577 
578  /* Check the parameters */
579  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
580 
581  switch (Channel)
582  {
583  case TIM_CHANNEL_1:
584  {
585  /* Enable the TIM Output Compare interrupt */
586  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
587  break;
588  }
589 
590  case TIM_CHANNEL_2:
591  {
592  /* Enable the TIM Output Compare interrupt */
593  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
594  break;
595  }
596 
597  case TIM_CHANNEL_3:
598  {
599  /* Enable the TIM Output Compare interrupt */
600  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3);
601  break;
602  }
603 
604 
605  default:
606  break;
607  }
608 
609  /* Enable the TIM Break interrupt */
610  __HAL_TIM_ENABLE_IT(htim, TIM_IT_BREAK);
611 
612  /* Enable the Capture compare channel N */
613  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE);
614 
615  /* Enable the Main Output */
616  __HAL_TIM_MOE_ENABLE(htim);
617 
618  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
619  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
620  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
621  {
622  __HAL_TIM_ENABLE(htim);
623  }
624 
625  /* Return function status */
626  return HAL_OK;
627 }
628 
640 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
641 {
642  uint32_t tmpccer;
643  /* Check the parameters */
644  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
645 
646  switch (Channel)
647  {
648  case TIM_CHANNEL_1:
649  {
650  /* Disable the TIM Output Compare interrupt */
651  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
652  break;
653  }
654 
655  case TIM_CHANNEL_2:
656  {
657  /* Disable the TIM Output Compare interrupt */
658  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
659  break;
660  }
661 
662  case TIM_CHANNEL_3:
663  {
664  /* Disable the TIM Output Compare interrupt */
665  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3);
666  break;
667  }
668 
669  default:
670  break;
671  }
672 
673  /* Disable the Capture compare channel N */
674  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE);
675 
676  /* Disable the TIM Break interrupt (only if no more channel is active) */
677  tmpccer = htim->Instance->CCER;
678  if ((tmpccer & (TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) == (uint32_t)RESET)
679  {
680  __HAL_TIM_DISABLE_IT(htim, TIM_IT_BREAK);
681  }
682 
683  /* Disable the Main Output */
684  __HAL_TIM_MOE_DISABLE(htim);
685 
686  /* Disable the Peripheral */
687  __HAL_TIM_DISABLE(htim);
688 
689  /* Return function status */
690  return HAL_OK;
691 }
692 
706 HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
707 {
708  uint32_t tmpsmcr;
709 
710  /* Check the parameters */
711  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
712 
713  if ((htim->State == HAL_TIM_STATE_BUSY))
714  {
715  return HAL_BUSY;
716  }
717  else if ((htim->State == HAL_TIM_STATE_READY))
718  {
719  if (((uint32_t)pData == 0U) && (Length > 0U))
720  {
721  return HAL_ERROR;
722  }
723  else
724  {
725  htim->State = HAL_TIM_STATE_BUSY;
726  }
727  }
728  else
729  {
730  /* nothing to do */
731  }
732 
733  switch (Channel)
734  {
735  case TIM_CHANNEL_1:
736  {
737  /* Set the DMA compare callbacks */
738  htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
739  htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;
740 
741  /* Set the DMA error callback */
742  htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
743 
744  /* Enable the DMA channel */
745  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK)
746  {
747  return HAL_ERROR;
748  }
749  /* Enable the TIM Output Compare DMA request */
750  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
751  break;
752  }
753 
754  case TIM_CHANNEL_2:
755  {
756  /* Set the DMA compare callbacks */
757  htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt;
758  htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;
759 
760  /* Set the DMA error callback */
761  htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
762 
763  /* Enable the DMA channel */
764  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK)
765  {
766  return HAL_ERROR;
767  }
768  /* Enable the TIM Output Compare DMA request */
769  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
770  break;
771  }
772 
773  case TIM_CHANNEL_3:
774  {
775  /* Set the DMA compare callbacks */
776  htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt;
777  htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;
778 
779  /* Set the DMA error callback */
780  htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
781 
782  /* Enable the DMA channel */
783  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK)
784  {
785  return HAL_ERROR;
786  }
787  /* Enable the TIM Output Compare DMA request */
788  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3);
789  break;
790  }
791 
792  default:
793  break;
794  }
795 
796  /* Enable the Capture compare channel N */
797  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE);
798 
799  /* Enable the Main Output */
800  __HAL_TIM_MOE_ENABLE(htim);
801 
802  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
803  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
804  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
805  {
806  __HAL_TIM_ENABLE(htim);
807  }
808 
809  /* Return function status */
810  return HAL_OK;
811 }
812 
824 HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
825 {
826  /* Check the parameters */
827  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
828 
829  switch (Channel)
830  {
831  case TIM_CHANNEL_1:
832  {
833  /* Disable the TIM Output Compare DMA request */
834  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
835  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
836  break;
837  }
838 
839  case TIM_CHANNEL_2:
840  {
841  /* Disable the TIM Output Compare DMA request */
842  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
843  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
844  break;
845  }
846 
847  case TIM_CHANNEL_3:
848  {
849  /* Disable the TIM Output Compare DMA request */
850  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3);
851  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
852  break;
853  }
854 
855  default:
856  break;
857  }
858 
859  /* Disable the Capture compare channel N */
860  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE);
861 
862  /* Disable the Main Output */
863  __HAL_TIM_MOE_DISABLE(htim);
864 
865  /* Disable the Peripheral */
866  __HAL_TIM_DISABLE(htim);
867 
868  /* Change the htim state */
869  htim->State = HAL_TIM_STATE_READY;
870 
871  /* Return function status */
872  return HAL_OK;
873 }
874 
919 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
920 {
921  uint32_t tmpsmcr;
922 
923  /* Check the parameters */
924  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
925 
926  /* Enable the complementary PWM output */
927  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE);
928 
929  /* Enable the Main Output */
930  __HAL_TIM_MOE_ENABLE(htim);
931 
932  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
933  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
934  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
935  {
936  __HAL_TIM_ENABLE(htim);
937  }
938 
939  /* Return function status */
940  return HAL_OK;
941 }
942 
953 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
954 {
955  /* Check the parameters */
956  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
957 
958  /* Disable the complementary PWM output */
959  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE);
960 
961  /* Disable the Main Output */
962  __HAL_TIM_MOE_DISABLE(htim);
963 
964  /* Disable the Peripheral */
965  __HAL_TIM_DISABLE(htim);
966 
967  /* Return function status */
968  return HAL_OK;
969 }
970 
982 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
983 {
984  uint32_t tmpsmcr;
985 
986  /* Check the parameters */
987  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
988 
989  switch (Channel)
990  {
991  case TIM_CHANNEL_1:
992  {
993  /* Enable the TIM Capture/Compare 1 interrupt */
994  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
995  break;
996  }
997 
998  case TIM_CHANNEL_2:
999  {
1000  /* Enable the TIM Capture/Compare 2 interrupt */
1001  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
1002  break;
1003  }
1004 
1005  case TIM_CHANNEL_3:
1006  {
1007  /* Enable the TIM Capture/Compare 3 interrupt */
1008  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC3);
1009  break;
1010  }
1011 
1012  default:
1013  break;
1014  }
1015 
1016  /* Enable the TIM Break interrupt */
1017  __HAL_TIM_ENABLE_IT(htim, TIM_IT_BREAK);
1018 
1019  /* Enable the complementary PWM output */
1020  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE);
1021 
1022  /* Enable the Main Output */
1023  __HAL_TIM_MOE_ENABLE(htim);
1024 
1025  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1026  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1027  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1028  {
1029  __HAL_TIM_ENABLE(htim);
1030  }
1031 
1032  /* Return function status */
1033  return HAL_OK;
1034 }
1035 
1047 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
1048 {
1049  uint32_t tmpccer;
1050 
1051  /* Check the parameters */
1052  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
1053 
1054  switch (Channel)
1055  {
1056  case TIM_CHANNEL_1:
1057  {
1058  /* Disable the TIM Capture/Compare 1 interrupt */
1059  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
1060  break;
1061  }
1062 
1063  case TIM_CHANNEL_2:
1064  {
1065  /* Disable the TIM Capture/Compare 2 interrupt */
1066  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
1067  break;
1068  }
1069 
1070  case TIM_CHANNEL_3:
1071  {
1072  /* Disable the TIM Capture/Compare 3 interrupt */
1073  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC3);
1074  break;
1075  }
1076 
1077  default:
1078  break;
1079  }
1080 
1081  /* Disable the complementary PWM output */
1082  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE);
1083 
1084  /* Disable the TIM Break interrupt (only if no more channel is active) */
1085  tmpccer = htim->Instance->CCER;
1086  if ((tmpccer & (TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE)) == (uint32_t)RESET)
1087  {
1088  __HAL_TIM_DISABLE_IT(htim, TIM_IT_BREAK);
1089  }
1090 
1091  /* Disable the Main Output */
1092  __HAL_TIM_MOE_DISABLE(htim);
1093 
1094  /* Disable the Peripheral */
1095  __HAL_TIM_DISABLE(htim);
1096 
1097  /* Return function status */
1098  return HAL_OK;
1099 }
1100 
1114 HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
1115 {
1116  uint32_t tmpsmcr;
1117 
1118  /* Check the parameters */
1119  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
1120 
1121  if ((htim->State == HAL_TIM_STATE_BUSY))
1122  {
1123  return HAL_BUSY;
1124  }
1125  else if ((htim->State == HAL_TIM_STATE_READY))
1126  {
1127  if (((uint32_t)pData == 0U) && (Length > 0U))
1128  {
1129  return HAL_ERROR;
1130  }
1131  else
1132  {
1133  htim->State = HAL_TIM_STATE_BUSY;
1134  }
1135  }
1136  else
1137  {
1138  /* nothing to do */
1139  }
1140  switch (Channel)
1141  {
1142  case TIM_CHANNEL_1:
1143  {
1144  /* Set the DMA compare callbacks */
1145  htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
1146  htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;
1147 
1148  /* Set the DMA error callback */
1149  htim->hdma[TIM_DMA_ID_CC1]->XferErrorCallback = TIM_DMAError ;
1150 
1151  /* Enable the DMA channel */
1152  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC1], (uint32_t)pData, (uint32_t)&htim->Instance->CCR1, Length) != HAL_OK)
1153  {
1154  return HAL_ERROR;
1155  }
1156  /* Enable the TIM Capture/Compare 1 DMA request */
1157  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC1);
1158  break;
1159  }
1160 
1161  case TIM_CHANNEL_2:
1162  {
1163  /* Set the DMA compare callbacks */
1164  htim->hdma[TIM_DMA_ID_CC2]->XferCpltCallback = TIM_DMADelayPulseCplt;
1165  htim->hdma[TIM_DMA_ID_CC2]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;
1166 
1167  /* Set the DMA error callback */
1168  htim->hdma[TIM_DMA_ID_CC2]->XferErrorCallback = TIM_DMAError ;
1169 
1170  /* Enable the DMA channel */
1171  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC2], (uint32_t)pData, (uint32_t)&htim->Instance->CCR2, Length) != HAL_OK)
1172  {
1173  return HAL_ERROR;
1174  }
1175  /* Enable the TIM Capture/Compare 2 DMA request */
1176  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC2);
1177  break;
1178  }
1179 
1180  case TIM_CHANNEL_3:
1181  {
1182  /* Set the DMA compare callbacks */
1183  htim->hdma[TIM_DMA_ID_CC3]->XferCpltCallback = TIM_DMADelayPulseCplt;
1184  htim->hdma[TIM_DMA_ID_CC3]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;
1185 
1186  /* Set the DMA error callback */
1187  htim->hdma[TIM_DMA_ID_CC3]->XferErrorCallback = TIM_DMAError ;
1188 
1189  /* Enable the DMA channel */
1190  if (HAL_DMA_Start_IT(htim->hdma[TIM_DMA_ID_CC3], (uint32_t)pData, (uint32_t)&htim->Instance->CCR3, Length) != HAL_OK)
1191  {
1192  return HAL_ERROR;
1193  }
1194  /* Enable the TIM Capture/Compare 3 DMA request */
1195  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_CC3);
1196  break;
1197  }
1198 
1199  default:
1200  break;
1201  }
1202 
1203  /* Enable the complementary PWM output */
1204  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_ENABLE);
1205 
1206  /* Enable the Main Output */
1207  __HAL_TIM_MOE_ENABLE(htim);
1208 
1209  /* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
1210  tmpsmcr = htim->Instance->SMCR & TIM_SMCR_SMS;
1211  if (!IS_TIM_SLAVEMODE_TRIGGER_ENABLED(tmpsmcr))
1212  {
1213  __HAL_TIM_ENABLE(htim);
1214  }
1215 
1216  /* Return function status */
1217  return HAL_OK;
1218 }
1219 
1231 HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
1232 {
1233  /* Check the parameters */
1234  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, Channel));
1235 
1236  switch (Channel)
1237  {
1238  case TIM_CHANNEL_1:
1239  {
1240  /* Disable the TIM Capture/Compare 1 DMA request */
1241  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC1);
1242  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC1]);
1243  break;
1244  }
1245 
1246  case TIM_CHANNEL_2:
1247  {
1248  /* Disable the TIM Capture/Compare 2 DMA request */
1249  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC2);
1250  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC2]);
1251  break;
1252  }
1253 
1254  case TIM_CHANNEL_3:
1255  {
1256  /* Disable the TIM Capture/Compare 3 DMA request */
1257  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_CC3);
1258  (void)HAL_DMA_Abort_IT(htim->hdma[TIM_DMA_ID_CC3]);
1259  break;
1260  }
1261 
1262  default:
1263  break;
1264  }
1265 
1266  /* Disable the complementary PWM output */
1267  TIM_CCxNChannelCmd(htim->Instance, Channel, TIM_CCxN_DISABLE);
1268 
1269  /* Disable the Main Output */
1270  __HAL_TIM_MOE_DISABLE(htim);
1271 
1272  /* Disable the Peripheral */
1273  __HAL_TIM_DISABLE(htim);
1274 
1275  /* Change the htim state */
1276  htim->State = HAL_TIM_STATE_READY;
1277 
1278  /* Return function status */
1279  return HAL_OK;
1280 }
1281 
1314 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
1315 {
1316  /* Check the parameters */
1317  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel));
1318 
1319  /* Enable the complementary One Pulse output */
1320  TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_ENABLE);
1321 
1322  /* Enable the Main Output */
1323  __HAL_TIM_MOE_ENABLE(htim);
1324 
1325  /* Return function status */
1326  return HAL_OK;
1327 }
1328 
1339 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
1340 {
1341 
1342  /* Check the parameters */
1343  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel));
1344 
1345  /* Disable the complementary One Pulse output */
1346  TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_DISABLE);
1347 
1348  /* Disable the Main Output */
1349  __HAL_TIM_MOE_DISABLE(htim);
1350 
1351  /* Disable the Peripheral */
1352  __HAL_TIM_DISABLE(htim);
1353 
1354  /* Return function status */
1355  return HAL_OK;
1356 }
1357 
1368 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
1369 {
1370  /* Check the parameters */
1371  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel));
1372 
1373  /* Enable the TIM Capture/Compare 1 interrupt */
1374  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC1);
1375 
1376  /* Enable the TIM Capture/Compare 2 interrupt */
1377  __HAL_TIM_ENABLE_IT(htim, TIM_IT_CC2);
1378 
1379  /* Enable the complementary One Pulse output */
1380  TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_ENABLE);
1381 
1382  /* Enable the Main Output */
1383  __HAL_TIM_MOE_ENABLE(htim);
1384 
1385  /* Return function status */
1386  return HAL_OK;
1387 }
1388 
1399 HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
1400 {
1401  /* Check the parameters */
1402  assert_param(IS_TIM_CCXN_INSTANCE(htim->Instance, OutputChannel));
1403 
1404  /* Disable the TIM Capture/Compare 1 interrupt */
1405  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC1);
1406 
1407  /* Disable the TIM Capture/Compare 2 interrupt */
1408  __HAL_TIM_DISABLE_IT(htim, TIM_IT_CC2);
1409 
1410  /* Disable the complementary One Pulse output */
1411  TIM_CCxNChannelCmd(htim->Instance, OutputChannel, TIM_CCxN_DISABLE);
1412 
1413  /* Disable the Main Output */
1414  __HAL_TIM_MOE_DISABLE(htim);
1415 
1416  /* Disable the Peripheral */
1417  __HAL_TIM_DISABLE(htim);
1418 
1419  /* Return function status */
1420  return HAL_OK;
1421 }
1422 
1470 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
1471  uint32_t CommutationSource)
1472 {
1473  /* Check the parameters */
1474  assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance));
1475  assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger));
1476 
1477  __HAL_LOCK(htim);
1478 
1479  if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) ||
1480  (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3))
1481  {
1482  /* Select the Input trigger */
1483  htim->Instance->SMCR &= ~TIM_SMCR_TS;
1484  htim->Instance->SMCR |= InputTrigger;
1485  }
1486 
1487  /* Select the Capture Compare preload feature */
1488  htim->Instance->CR2 |= TIM_CR2_CCPC;
1489  /* Select the Commutation event source */
1490  htim->Instance->CR2 &= ~TIM_CR2_CCUS;
1491  htim->Instance->CR2 |= CommutationSource;
1492 
1493  /* Disable Commutation Interrupt */
1494  __HAL_TIM_DISABLE_IT(htim, TIM_IT_COM);
1495 
1496  /* Disable Commutation DMA request */
1497  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_COM);
1498 
1499  __HAL_UNLOCK(htim);
1500 
1501  return HAL_OK;
1502 }
1503 
1526 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
1527  uint32_t CommutationSource)
1528 {
1529  /* Check the parameters */
1530  assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance));
1531  assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger));
1532 
1533  __HAL_LOCK(htim);
1534 
1535  if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) ||
1536  (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3))
1537  {
1538  /* Select the Input trigger */
1539  htim->Instance->SMCR &= ~TIM_SMCR_TS;
1540  htim->Instance->SMCR |= InputTrigger;
1541  }
1542 
1543  /* Select the Capture Compare preload feature */
1544  htim->Instance->CR2 |= TIM_CR2_CCPC;
1545  /* Select the Commutation event source */
1546  htim->Instance->CR2 &= ~TIM_CR2_CCUS;
1547  htim->Instance->CR2 |= CommutationSource;
1548 
1549  /* Disable Commutation DMA request */
1550  __HAL_TIM_DISABLE_DMA(htim, TIM_DMA_COM);
1551 
1552  /* Enable the Commutation Interrupt */
1553  __HAL_TIM_ENABLE_IT(htim, TIM_IT_COM);
1554 
1555  __HAL_UNLOCK(htim);
1556 
1557  return HAL_OK;
1558 }
1559 
1583 HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger,
1584  uint32_t CommutationSource)
1585 {
1586  /* Check the parameters */
1587  assert_param(IS_TIM_COMMUTATION_EVENT_INSTANCE(htim->Instance));
1588  assert_param(IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(InputTrigger));
1589 
1590  __HAL_LOCK(htim);
1591 
1592  if ((InputTrigger == TIM_TS_ITR0) || (InputTrigger == TIM_TS_ITR1) ||
1593  (InputTrigger == TIM_TS_ITR2) || (InputTrigger == TIM_TS_ITR3))
1594  {
1595  /* Select the Input trigger */
1596  htim->Instance->SMCR &= ~TIM_SMCR_TS;
1597  htim->Instance->SMCR |= InputTrigger;
1598  }
1599 
1600  /* Select the Capture Compare preload feature */
1601  htim->Instance->CR2 |= TIM_CR2_CCPC;
1602  /* Select the Commutation event source */
1603  htim->Instance->CR2 &= ~TIM_CR2_CCUS;
1604  htim->Instance->CR2 |= CommutationSource;
1605 
1606  /* Enable the Commutation DMA Request */
1607  /* Set the DMA Commutation Callback */
1608  htim->hdma[TIM_DMA_ID_COMMUTATION]->XferCpltCallback = TIMEx_DMACommutationCplt;
1609  htim->hdma[TIM_DMA_ID_COMMUTATION]->XferHalfCpltCallback = TIMEx_DMACommutationHalfCplt;
1610  /* Set the DMA error callback */
1611  htim->hdma[TIM_DMA_ID_COMMUTATION]->XferErrorCallback = TIM_DMAError;
1612 
1613  /* Disable Commutation Interrupt */
1614  __HAL_TIM_DISABLE_IT(htim, TIM_IT_COM);
1615 
1616  /* Enable the Commutation DMA Request */
1617  __HAL_TIM_ENABLE_DMA(htim, TIM_DMA_COM);
1618 
1619  __HAL_UNLOCK(htim);
1620 
1621  return HAL_OK;
1622 }
1623 
1633  TIM_MasterConfigTypeDef *sMasterConfig)
1634 {
1635  uint32_t tmpcr2;
1636  uint32_t tmpsmcr;
1637 
1638  /* Check the parameters */
1639  assert_param(IS_TIM_SYNCHRO_INSTANCE(htim->Instance));
1640  assert_param(IS_TIM_TRGO_SOURCE(sMasterConfig->MasterOutputTrigger));
1641  assert_param(IS_TIM_MSM_STATE(sMasterConfig->MasterSlaveMode));
1642 
1643  /* Check input state */
1644  __HAL_LOCK(htim);
1645 
1646  /* Change the handler state */
1647  htim->State = HAL_TIM_STATE_BUSY;
1648 
1649  /* Get the TIMx CR2 register value */
1650  tmpcr2 = htim->Instance->CR2;
1651 
1652  /* Get the TIMx SMCR register value */
1653  tmpsmcr = htim->Instance->SMCR;
1654 
1655  /* If the timer supports ADC synchronization through TRGO2, set the master mode selection 2 */
1656  if (IS_TIM_TRGO2_INSTANCE(htim->Instance))
1657  {
1658  /* Check the parameters */
1659  assert_param(IS_TIM_TRGO2_SOURCE(sMasterConfig->MasterOutputTrigger2));
1660 
1661  /* Clear the MMS2 bits */
1662  tmpcr2 &= ~TIM_CR2_MMS2;
1663  /* Select the TRGO2 source*/
1664  tmpcr2 |= sMasterConfig->MasterOutputTrigger2;
1665  }
1666 
1667  /* Reset the MMS Bits */
1668  tmpcr2 &= ~TIM_CR2_MMS;
1669  /* Select the TRGO source */
1670  tmpcr2 |= sMasterConfig->MasterOutputTrigger;
1671 
1672  /* Reset the MSM Bit */
1673  tmpsmcr &= ~TIM_SMCR_MSM;
1674  /* Set master mode */
1675  tmpsmcr |= sMasterConfig->MasterSlaveMode;
1676 
1677  /* Update TIMx CR2 */
1678  htim->Instance->CR2 = tmpcr2;
1679 
1680  /* Update TIMx SMCR */
1681  htim->Instance->SMCR = tmpsmcr;
1682 
1683  /* Change the htim state */
1684  htim->State = HAL_TIM_STATE_READY;
1685 
1686  __HAL_UNLOCK(htim);
1687 
1688  return HAL_OK;
1689 }
1690 
1700  TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig)
1701 {
1702  /* Keep this variable initialized to 0 as it is used to configure BDTR register */
1703  uint32_t tmpbdtr = 0U;
1704 
1705  /* Check the parameters */
1706  assert_param(IS_TIM_BREAK_INSTANCE(htim->Instance));
1707  assert_param(IS_TIM_OSSR_STATE(sBreakDeadTimeConfig->OffStateRunMode));
1708  assert_param(IS_TIM_OSSI_STATE(sBreakDeadTimeConfig->OffStateIDLEMode));
1709  assert_param(IS_TIM_LOCK_LEVEL(sBreakDeadTimeConfig->LockLevel));
1710  assert_param(IS_TIM_DEADTIME(sBreakDeadTimeConfig->DeadTime));
1711  assert_param(IS_TIM_BREAK_STATE(sBreakDeadTimeConfig->BreakState));
1712  assert_param(IS_TIM_BREAK_POLARITY(sBreakDeadTimeConfig->BreakPolarity));
1713  assert_param(IS_TIM_BREAK_FILTER(sBreakDeadTimeConfig->BreakFilter));
1714  assert_param(IS_TIM_AUTOMATIC_OUTPUT_STATE(sBreakDeadTimeConfig->AutomaticOutput));
1715 
1716  /* Check input state */
1717  __HAL_LOCK(htim);
1718 
1719  /* Set the Lock level, the Break enable Bit and the Polarity, the OSSR State,
1720  the OSSI State, the dead time value and the Automatic Output Enable Bit */
1721 
1722  /* Set the BDTR bits */
1723  MODIFY_REG(tmpbdtr, TIM_BDTR_DTG, sBreakDeadTimeConfig->DeadTime);
1724  MODIFY_REG(tmpbdtr, TIM_BDTR_LOCK, sBreakDeadTimeConfig->LockLevel);
1725  MODIFY_REG(tmpbdtr, TIM_BDTR_OSSI, sBreakDeadTimeConfig->OffStateIDLEMode);
1726  MODIFY_REG(tmpbdtr, TIM_BDTR_OSSR, sBreakDeadTimeConfig->OffStateRunMode);
1727  MODIFY_REG(tmpbdtr, TIM_BDTR_BKE, sBreakDeadTimeConfig->BreakState);
1728  MODIFY_REG(tmpbdtr, TIM_BDTR_BKP, sBreakDeadTimeConfig->BreakPolarity);
1729  MODIFY_REG(tmpbdtr, TIM_BDTR_AOE, sBreakDeadTimeConfig->AutomaticOutput);
1730  MODIFY_REG(tmpbdtr, TIM_BDTR_BKF, (sBreakDeadTimeConfig->BreakFilter << TIM_BDTR_BKF_Pos));
1731 
1732  if (IS_TIM_BKIN2_INSTANCE(htim->Instance))
1733  {
1734  /* Check the parameters */
1735  assert_param(IS_TIM_BREAK2_STATE(sBreakDeadTimeConfig->Break2State));
1736  assert_param(IS_TIM_BREAK2_POLARITY(sBreakDeadTimeConfig->Break2Polarity));
1737  assert_param(IS_TIM_BREAK_FILTER(sBreakDeadTimeConfig->Break2Filter));
1738 
1739  /* Set the BREAK2 input related BDTR bits */
1740  MODIFY_REG(tmpbdtr, TIM_BDTR_BK2F, (sBreakDeadTimeConfig->Break2Filter << TIM_BDTR_BK2F_Pos));
1741  MODIFY_REG(tmpbdtr, TIM_BDTR_BK2E, sBreakDeadTimeConfig->Break2State);
1742  MODIFY_REG(tmpbdtr, TIM_BDTR_BK2P, sBreakDeadTimeConfig->Break2Polarity);
1743  }
1744 
1745  /* Set TIMx_BDTR */
1746  htim->Instance->BDTR = tmpbdtr;
1747 
1748  __HAL_UNLOCK(htim);
1749 
1750  return HAL_OK;
1751 }
1752 
1764  uint32_t BreakInput,
1765  TIMEx_BreakInputConfigTypeDef *sBreakInputConfig)
1766 
1767 {
1768  uint32_t tmporx;
1769  uint32_t bkin_enable_mask = 0U;
1770  uint32_t bkin_polarity_mask = 0U;
1771  uint32_t bkin_enable_bitpos = 0U;
1772  uint32_t bkin_polarity_bitpos = 0U;
1773 
1774  /* Check the parameters */
1775  assert_param(IS_TIM_BREAK_INSTANCE(htim->Instance));
1776  assert_param(IS_TIM_BREAKINPUT(BreakInput));
1777  assert_param(IS_TIM_BREAKINPUTSOURCE(sBreakInputConfig->Source));
1778  assert_param(IS_TIM_BREAKINPUTSOURCE_STATE(sBreakInputConfig->Enable));
1779 #if defined(DFSDM1_Channel0)
1780  if (sBreakInputConfig->Source != TIM_BREAKINPUTSOURCE_DFSDM1)
1781  {
1782  assert_param(IS_TIM_BREAKINPUTSOURCE_POLARITY(sBreakInputConfig->Polarity));
1783  }
1784 #else
1785  assert_param(IS_TIM_BREAKINPUTSOURCE_POLARITY(sBreakInputConfig->Polarity));
1786 #endif /* DFSDM1_Channel0 */
1787 
1788  /* Check input state */
1789  __HAL_LOCK(htim);
1790 
1791  switch (sBreakInputConfig->Source)
1792  {
1793  case TIM_BREAKINPUTSOURCE_BKIN:
1794  {
1795  bkin_enable_mask = TIM1_OR2_BKINE;
1796  bkin_enable_bitpos = TIM1_OR2_BKINE_Pos;
1797  bkin_polarity_mask = TIM1_OR2_BKINP;
1798  bkin_polarity_bitpos = TIM1_OR2_BKINP_Pos;
1799  break;
1800  }
1801  case TIM_BREAKINPUTSOURCE_COMP1:
1802  {
1803  bkin_enable_mask = TIM1_OR2_BKCMP1E;
1804  bkin_enable_bitpos = TIM1_OR2_BKCMP1E_Pos;
1805  bkin_polarity_mask = TIM1_OR2_BKCMP1P;
1806  bkin_polarity_bitpos = TIM1_OR2_BKCMP1P_Pos;
1807  break;
1808  }
1809  case TIM_BREAKINPUTSOURCE_COMP2:
1810  {
1811  bkin_enable_mask = TIM1_OR2_BKCMP2E;
1812  bkin_enable_bitpos = TIM1_OR2_BKCMP2E_Pos;
1813  bkin_polarity_mask = TIM1_OR2_BKCMP2P;
1814  bkin_polarity_bitpos = TIM1_OR2_BKCMP2P_Pos;
1815  break;
1816  }
1817 #if defined(DFSDM1_Channel0)
1818  case TIM_BREAKINPUTSOURCE_DFSDM1:
1819  {
1820  bkin_enable_mask = TIM1_OR2_BKDF1BK0E;
1821  bkin_enable_bitpos = 8U;
1822  break;
1823  }
1824 #endif /* DFSDM1_Channel0 */
1825 
1826  default:
1827  break;
1828  }
1829 
1830  switch (BreakInput)
1831  {
1832  case TIM_BREAKINPUT_BRK:
1833  {
1834  /* Get the TIMx_OR2 register value */
1835  tmporx = htim->Instance->OR2;
1836 
1837  /* Enable the break input */
1838  tmporx &= ~bkin_enable_mask;
1839  tmporx |= (sBreakInputConfig->Enable << bkin_enable_bitpos) & bkin_enable_mask;
1840 
1841  /* Set the break input polarity */
1842 #if defined(DFSDM1_Channel0)
1843  if (sBreakInputConfig->Source != TIM_BREAKINPUTSOURCE_DFSDM1)
1844 #endif /* DFSDM1_Channel0 */
1845  {
1846  tmporx &= ~bkin_polarity_mask;
1847  tmporx |= (sBreakInputConfig->Polarity << bkin_polarity_bitpos) & bkin_polarity_mask;
1848  }
1849 
1850  /* Set TIMx_OR2 */
1851  htim->Instance->OR2 = tmporx;
1852  break;
1853  }
1854  case TIM_BREAKINPUT_BRK2:
1855  {
1856  /* Get the TIMx_OR3 register value */
1857  tmporx = htim->Instance->OR3;
1858 
1859  /* Enable the break input */
1860  tmporx &= ~bkin_enable_mask;
1861  tmporx |= (sBreakInputConfig->Enable << bkin_enable_bitpos) & bkin_enable_mask;
1862 
1863  /* Set the break input polarity */
1864 #if defined(DFSDM1_Channel0)
1865  if (sBreakInputConfig->Source != TIM_BREAKINPUTSOURCE_DFSDM1)
1866 #endif /* DFSDM1_Channel0 */
1867  {
1868  tmporx &= ~bkin_polarity_mask;
1869  tmporx |= (sBreakInputConfig->Polarity << bkin_polarity_bitpos) & bkin_polarity_mask;
1870  }
1871 
1872  /* Set TIMx_OR3 */
1873  htim->Instance->OR3 = tmporx;
1874  break;
1875  }
1876  default:
1877  break;
1878  }
1879 
1880  __HAL_UNLOCK(htim);
1881 
1882  return HAL_OK;
1883 }
1884 
2107 HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap)
2108 {
2109  uint32_t tmpor1 = 0U;
2110  uint32_t tmpor2 = 0U;
2111 
2112  __HAL_LOCK(htim);
2113 
2114  /* Check parameters */
2115  assert_param(IS_TIM_REMAP_INSTANCE(htim->Instance));
2116  assert_param(IS_TIM_REMAP(Remap));
2117 
2118  /* Set ETR_SEL bit field (if required) */
2119  if (IS_TIM_ETRSEL_INSTANCE(htim->Instance))
2120  {
2121  tmpor2 = htim->Instance->OR2;
2122  tmpor2 &= ~TIM1_OR2_ETRSEL_Msk;
2123  tmpor2 |= (Remap & TIM1_OR2_ETRSEL_Msk);
2124 
2125  /* Set TIMx_OR2 */
2126  htim->Instance->OR2 = tmpor2;
2127  }
2128 
2129  /* Set other remapping capabilities */
2130  tmpor1 = Remap;
2131  tmpor1 &= ~TIM1_OR2_ETRSEL_Msk;
2132 
2133  /* Set TIMx_OR1 */
2134  htim->Instance->OR1 = tmpor1;
2135 
2136  __HAL_UNLOCK(htim);
2137 
2138  return HAL_OK;
2139 }
2140 
2152 HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels)
2153 {
2154  /* Check parameters */
2155  assert_param(IS_TIM_COMBINED3PHASEPWM_INSTANCE(htim->Instance));
2156  assert_param(IS_TIM_GROUPCH5(Channels));
2157 
2158  /* Process Locked */
2159  __HAL_LOCK(htim);
2160 
2161  htim->State = HAL_TIM_STATE_BUSY;
2162 
2163  /* Clear GC5Cx bit fields */
2164  htim->Instance->CCR5 &= ~(TIM_CCR5_GC5C3 | TIM_CCR5_GC5C2 | TIM_CCR5_GC5C1);
2165 
2166  /* Set GC5Cx bit fields */
2167  htim->Instance->CCR5 |= Channels;
2168 
2169  /* Change the htim state */
2170  htim->State = HAL_TIM_STATE_READY;
2171 
2172  __HAL_UNLOCK(htim);
2173 
2174  return HAL_OK;
2175 }
2176 
2203 {
2204  /* Prevent unused argument(s) compilation warning */
2205  UNUSED(htim);
2206 
2207  /* NOTE : This function should not be modified, when the callback is needed,
2208  the HAL_TIMEx_CommutCallback could be implemented in the user file
2209  */
2210 }
2217 {
2218  /* Prevent unused argument(s) compilation warning */
2219  UNUSED(htim);
2220 
2221  /* NOTE : This function should not be modified, when the callback is needed,
2222  the HAL_TIMEx_CommutHalfCpltCallback could be implemented in the user file
2223  */
2224 }
2225 
2232 {
2233  /* Prevent unused argument(s) compilation warning */
2234  UNUSED(htim);
2235 
2236  /* NOTE : This function should not be modified, when the callback is needed,
2237  the HAL_TIMEx_BreakCallback could be implemented in the user file
2238  */
2239 }
2240 
2247 {
2248  /* Prevent unused argument(s) compilation warning */
2249  UNUSED(htim);
2250 
2251  /* NOTE : This function Should not be modified, when the callback is needed,
2252  the HAL_TIMEx_Break2Callback could be implemented in the user file
2253  */
2254 }
2280 {
2281  return htim->State;
2282 }
2283 
2292 /* Private functions ---------------------------------------------------------*/
2303 {
2304  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
2305 
2306  /* Change the htim state */
2307  htim->State = HAL_TIM_STATE_READY;
2308 
2309 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2310  htim->CommutationCallback(htim);
2311 #else
2313 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2314 }
2315 
2322 {
2323  TIM_HandleTypeDef *htim = (TIM_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
2324 
2325  /* Change the htim state */
2326  htim->State = HAL_TIM_STATE_READY;
2327 
2328 #if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2329  htim->CommutationHalfCpltCallback(htim);
2330 #else
2332 #endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2333 }
2334 
2335 
2348 static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState)
2349 {
2350  uint32_t tmp;
2351 
2352  tmp = TIM_CCER_CC1NE << (Channel & 0x1FU); /* 0x1FU = 31 bits max shift */
2353 
2354  /* Reset the CCxNE Bit */
2355  TIMx->CCER &= ~tmp;
2356 
2357  /* Set or reset the CCxNE Bit */
2358  TIMx->CCER |= (uint32_t)(ChannelNState << (Channel & 0x1FU)); /* 0x1FU = 31 bits max shift */
2359 }
2364 #endif /* HAL_TIM_MODULE_ENABLED */
2365 
2373 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
void HAL_TIMEx_HallSensor_MspDeInit(TIM_HandleTypeDef *htim)
DeInitializes TIM Hall Sensor MSP.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM PWM signal generation in DMA mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the PWM signal generation in interrupt mode on the complementary output.
void TIMEx_DMACommutationHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Commutation half complete callback.
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM Output Compare signal generation in interrupt mode on the complementary output...
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Init(TIM_HandleTypeDef *htim, TIM_HallSensor_InitTypeDef *sConfig)
Initializes the TIM Hall Sensor Interface and initialize the associated handle.
void HAL_TIMEx_BreakCallback(TIM_HandleTypeDef *htim)
Hall Break detection callback in non-blocking mode.
DMA handle Structure definition.
HAL_StatusTypeDef HAL_TIMEx_OCN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the TIM Output Compare signal generation on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_DMA(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
Configure the TIM commutation event sequence with DMA.
void HAL_TIMEx_HallSensor_MspInit(TIM_HandleTypeDef *htim)
Initializes the TIM Hall Sensor MSP.
void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter)
Configure the TI1 as Input.
This file contains all the functions prototypes for the HAL module driver.
void TIM_Base_SetConfig(TIM_TypeDef *TIMx, TIM_Base_InitTypeDef *Structure)
Time Base configuration.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
Starts the TIM PWM signal generation in DMA mode on the complementary output.
void TIM_ResetCallback(TIM_HandleTypeDef *htim)
Reset interrupt callbacks to the legacy weak callbacks.
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the TIM Output Compare signal generation in interrupt mode on the complementary output...
HAL_StatusTypeDef HAL_TIMEx_GroupChannel5(TIM_HandleTypeDef *htim, uint32_t Channels)
Group channel 5 and channel 1, 2 or 3.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_DMA(TIM_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)
Starts the TIM Hall Sensor Interface in DMA mode.
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Starts the TIM One Pulse signal generation on the complementary output.
void TIM_DMADelayPulseCplt(DMA_HandleTypeDef *hdma)
TIM DMA Delay Pulse complete callback.
HAL_StatusTypeDef HAL_TIMEx_ConfigBreakInput(TIM_HandleTypeDef *htim, uint32_t BreakInput, TIMEx_BreakInputConfigTypeDef *sBreakInputConfig)
Configures the break input source.
TIM Master configuration Structure definition.
HAL_StatusTypeDef HAL_DMA_Abort_IT(DMA_HandleTypeDef *hdma)
Aborts the DMA Transfer in Interrupt mode.
__HAL_UNLOCK(hrtc)
void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Delay Pulse half complete callback.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the PWM signal generation on the complementary output.
TIM Hall sensor Configuration Structure definition.
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
Start the DMA Transfer with interrupt enabled.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
Configure the TIM commutation event sequence.
__HAL_LOCK(hrtc)
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Stops the TIM One Pulse signal generation on the complementary output.
void TIM_DMAError(DMA_HandleTypeDef *hdma)
TIM DMA error callback.
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM Output Compare signal generation on the complementary output.
return HAL_OK
void HAL_TIMEx_CommutCallback(TIM_HandleTypeDef *htim)
Hall commutation changed callback in non-blocking mode.
void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma)
TIM DMA Capture half complete callback.
HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim, TIM_MasterConfigTypeDef *sMasterConfig)
Configures the TIM in master mode.
HAL_StatusTypeDef HAL_TIMEx_ConfigCommutEvent_IT(TIM_HandleTypeDef *htim, uint32_t InputTrigger, uint32_t CommutationSource)
Configure the TIM commutation event sequence with interrupt.
HAL_TIM_StateTypeDef
HAL State structures definition.
void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma)
TIM DMA Capture complete callback.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_DeInit(TIM_HandleTypeDef *htim)
DeInitializes the TIM Hall Sensor interface.
HAL_StatusTypeDef HAL_TIMEx_RemapConfig(TIM_HandleTypeDef *htim, uint32_t Remap)
Configures the TIMx Remapping input capabilities.
HAL_StatusTypeDef HAL_TIMEx_OCN_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)
Starts the TIM Output Compare signal generation in DMA mode on the complementary output.
void HAL_TIMEx_CommutHalfCpltCallback(TIM_HandleTypeDef *htim)
Hall commutation changed half complete callback in non-blocking mode.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start(TIM_HandleTypeDef *htim)
Starts the TIM Hall Sensor Interface.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Start_IT(TIM_HandleTypeDef *htim)
Starts the TIM Hall Sensor Interface in interrupt mode.
static void TIM_CCxNChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelNState)
Enables or disables the TIM Capture Compare Channel xN.
HAL_StatusTypeDef HAL_TIMEx_ConfigBreakDeadTime(TIM_HandleTypeDef *htim, TIM_BreakDeadTimeConfigTypeDef *sBreakDeadTimeConfig)
Configures the Break feature, dead time, Lock level, OSSI/OSSR State and the AOE(automatic output ena...
void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
Enables or disables the TIM Capture Compare Channel x.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_IT(TIM_HandleTypeDef *htim)
Stops the TIM Hall Sensor Interface in interrupt mode.
TIM Output Compare Configuration Structure definition.
TIM Break input(s) and Dead time configuration Structure definition.
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Starts the TIM One Pulse signal generation in interrupt mode on the complementary channel...
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
HAL_StatusTypeDef HAL_TIMEx_OCN_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the TIM Output Compare signal generation in DMA mode on the complementary output.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop_DMA(TIM_HandleTypeDef *htim)
Stops the TIM Hall Sensor Interface in DMA mode.
void HAL_TIMEx_Break2Callback(TIM_HandleTypeDef *htim)
Hall Break2 detection callback in non blocking mode.
void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, TIM_OC_InitTypeDef *OC_Config)
Timer Output Compare 2 configuration.
struct __TIM_HandleTypeDef else typedef struct endif TIM_HandleTypeDef
TIM Time Base Handle Structure definition.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel)
Stops the PWM signal generation in interrupt mode on the complementary output.
TIM Break/Break2 input configuration.
void TIMEx_DMACommutationCplt(DMA_HandleTypeDef *hdma)
TIM DMA Commutation callback.
HAL_StatusTypeDef HAL_TIMEx_HallSensor_Stop(TIM_HandleTypeDef *htim)
Stops the TIM Hall sensor Interface.
HAL_TIM_StateTypeDef HAL_TIMEx_HallSensor_GetState(TIM_HandleTypeDef *htim)
Return the TIM Hall Sensor interface handle state.
HAL_StatusTypeDef HAL_TIMEx_PWMN_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
Starts the PWM signal generation on the complementary output.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
HAL_StatusTypeDef HAL_TIMEx_OnePulseN_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
Stops the TIM One Pulse signal generation in interrupt mode on the complementary channel.