RTEMS 6.1-rc1
stm32h7xx_hal_tim.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_TIM_H
21#define STM32H7xx_HAL_TIM_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
38/* Exported types ------------------------------------------------------------*/
47typedef struct
48{
49 uint32_t Prescaler;
52 uint32_t CounterMode;
55 uint32_t Period;
59 uint32_t ClockDivision;
76
80typedef struct
81{
82 uint32_t OCMode;
85 uint32_t Pulse;
88 uint32_t OCPolarity;
91 uint32_t OCNPolarity;
95 uint32_t OCFastMode;
100 uint32_t OCIdleState;
104 uint32_t OCNIdleState;
108
112typedef struct
113{
114 uint32_t OCMode;
117 uint32_t Pulse;
120 uint32_t OCPolarity;
123 uint32_t OCNPolarity;
127 uint32_t OCIdleState;
131 uint32_t OCNIdleState;
135 uint32_t ICPolarity;
138 uint32_t ICSelection;
141 uint32_t ICFilter;
144
148typedef struct
149{
150 uint32_t ICPolarity;
153 uint32_t ICSelection;
156 uint32_t ICPrescaler;
159 uint32_t ICFilter;
162
166typedef struct
167{
168 uint32_t EncoderMode;
171 uint32_t IC1Polarity;
174 uint32_t IC1Selection;
177 uint32_t IC1Prescaler;
180 uint32_t IC1Filter;
183 uint32_t IC2Polarity;
186 uint32_t IC2Selection;
189 uint32_t IC2Prescaler;
192 uint32_t IC2Filter;
195
199typedef struct
200{
201 uint32_t ClockSource;
203 uint32_t ClockPolarity;
205 uint32_t ClockPrescaler;
207 uint32_t ClockFilter;
210
214typedef struct
215{
228
234typedef struct
235{
248
252typedef struct
253{
254 uint32_t SlaveMode;
256 uint32_t InputTrigger;
262 uint32_t TriggerFilter;
266
272typedef struct
273{
278 uint32_t LockLevel;
280 uint32_t DeadTime;
282 uint32_t BreakState;
284 uint32_t BreakPolarity;
286 uint32_t BreakFilter;
288#if defined(TIM_BDTR_BKBID)
289 uint32_t BreakAFMode;
291#endif /* TIM_BDTR_BKBID */
292 uint32_t Break2State;
294 uint32_t Break2Polarity;
296 uint32_t Break2Filter;
298#if defined(TIM_BDTR_BKBID)
299 uint32_t Break2AFMode;
301#endif /* TIM_BDTR_BKBID */
305
309typedef enum
310{
315 HAL_TIM_STATE_ERROR = 0x04U
317
321typedef enum
322{
327
331typedef enum
332{
337
341typedef enum
342{
351
355#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
356typedef struct __TIM_HandleTypeDef
357#else
358typedef struct
359#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
360{
372#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
373 void (* Base_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
374 void (* Base_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
375 void (* IC_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
376 void (* IC_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
377 void (* OC_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
378 void (* OC_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
379 void (* PWM_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
380 void (* PWM_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
381 void (* OnePulse_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
382 void (* OnePulse_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
383 void (* Encoder_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
384 void (* Encoder_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
385 void (* HallSensor_MspInitCallback)(struct __TIM_HandleTypeDef *htim);
386 void (* HallSensor_MspDeInitCallback)(struct __TIM_HandleTypeDef *htim);
387 void (* PeriodElapsedCallback)(struct __TIM_HandleTypeDef *htim);
388 void (* PeriodElapsedHalfCpltCallback)(struct __TIM_HandleTypeDef *htim);
389 void (* TriggerCallback)(struct __TIM_HandleTypeDef *htim);
390 void (* TriggerHalfCpltCallback)(struct __TIM_HandleTypeDef *htim);
391 void (* IC_CaptureCallback)(struct __TIM_HandleTypeDef *htim);
392 void (* IC_CaptureHalfCpltCallback)(struct __TIM_HandleTypeDef *htim);
393 void (* OC_DelayElapsedCallback)(struct __TIM_HandleTypeDef *htim);
394 void (* PWM_PulseFinishedCallback)(struct __TIM_HandleTypeDef *htim);
395 void (* PWM_PulseFinishedHalfCpltCallback)(struct __TIM_HandleTypeDef *htim);
396 void (* ErrorCallback)(struct __TIM_HandleTypeDef *htim);
397 void (* CommutationCallback)(struct __TIM_HandleTypeDef *htim);
398 void (* CommutationHalfCpltCallback)(struct __TIM_HandleTypeDef *htim);
399 void (* BreakCallback)(struct __TIM_HandleTypeDef *htim);
400 void (* Break2Callback)(struct __TIM_HandleTypeDef *htim);
401#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
403
404#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
408typedef enum
409{
410 HAL_TIM_BASE_MSPINIT_CB_ID = 0x00U
411 , HAL_TIM_BASE_MSPDEINIT_CB_ID = 0x01U
412 , HAL_TIM_IC_MSPINIT_CB_ID = 0x02U
413 , HAL_TIM_IC_MSPDEINIT_CB_ID = 0x03U
414 , HAL_TIM_OC_MSPINIT_CB_ID = 0x04U
415 , HAL_TIM_OC_MSPDEINIT_CB_ID = 0x05U
416 , HAL_TIM_PWM_MSPINIT_CB_ID = 0x06U
417 , HAL_TIM_PWM_MSPDEINIT_CB_ID = 0x07U
418 , HAL_TIM_ONE_PULSE_MSPINIT_CB_ID = 0x08U
419 , HAL_TIM_ONE_PULSE_MSPDEINIT_CB_ID = 0x09U
420 , HAL_TIM_ENCODER_MSPINIT_CB_ID = 0x0AU
421 , HAL_TIM_ENCODER_MSPDEINIT_CB_ID = 0x0BU
422 , HAL_TIM_HALL_SENSOR_MSPINIT_CB_ID = 0x0CU
423 , HAL_TIM_HALL_SENSOR_MSPDEINIT_CB_ID = 0x0DU
424 , HAL_TIM_PERIOD_ELAPSED_CB_ID = 0x0EU
425 , HAL_TIM_PERIOD_ELAPSED_HALF_CB_ID = 0x0FU
426 , HAL_TIM_TRIGGER_CB_ID = 0x10U
427 , HAL_TIM_TRIGGER_HALF_CB_ID = 0x11U
429 , HAL_TIM_IC_CAPTURE_CB_ID = 0x12U
430 , HAL_TIM_IC_CAPTURE_HALF_CB_ID = 0x13U
431 , HAL_TIM_OC_DELAY_ELAPSED_CB_ID = 0x14U
432 , HAL_TIM_PWM_PULSE_FINISHED_CB_ID = 0x15U
433 , HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID = 0x16U
434 , HAL_TIM_ERROR_CB_ID = 0x17U
435 , HAL_TIM_COMMUTATION_CB_ID = 0x18U
436 , HAL_TIM_COMMUTATION_HALF_CB_ID = 0x19U
437 , HAL_TIM_BREAK_CB_ID = 0x1AU
438 , HAL_TIM_BREAK2_CB_ID = 0x1BU
439} HAL_TIM_CallbackIDTypeDef;
440
444typedef void (*pTIM_CallbackTypeDef)(TIM_HandleTypeDef *htim);
446#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
447
451/* End of exported types -----------------------------------------------------*/
452
453/* Exported constants --------------------------------------------------------*/
463#define TIM_CLEARINPUTSOURCE_NONE 0x00000000U
464#define TIM_CLEARINPUTSOURCE_ETR 0x00000001U
473#define TIM_DMABASE_CR1 0x00000000U
474#define TIM_DMABASE_CR2 0x00000001U
475#define TIM_DMABASE_SMCR 0x00000002U
476#define TIM_DMABASE_DIER 0x00000003U
477#define TIM_DMABASE_SR 0x00000004U
478#define TIM_DMABASE_EGR 0x00000005U
479#define TIM_DMABASE_CCMR1 0x00000006U
480#define TIM_DMABASE_CCMR2 0x00000007U
481#define TIM_DMABASE_CCER 0x00000008U
482#define TIM_DMABASE_CNT 0x00000009U
483#define TIM_DMABASE_PSC 0x0000000AU
484#define TIM_DMABASE_ARR 0x0000000BU
485#define TIM_DMABASE_RCR 0x0000000CU
486#define TIM_DMABASE_CCR1 0x0000000DU
487#define TIM_DMABASE_CCR2 0x0000000EU
488#define TIM_DMABASE_CCR3 0x0000000FU
489#define TIM_DMABASE_CCR4 0x00000010U
490#define TIM_DMABASE_BDTR 0x00000011U
491#define TIM_DMABASE_DCR 0x00000012U
492#define TIM_DMABASE_DMAR 0x00000013U
493#define TIM_DMABASE_CCMR3 0x00000015U
494#define TIM_DMABASE_CCR5 0x00000016U
495#define TIM_DMABASE_CCR6 0x00000017U
496#if defined(TIM_BREAK_INPUT_SUPPORT)
497#define TIM_DMABASE_AF1 0x00000018U
498#define TIM_DMABASE_AF2 0x00000019U
499#endif /* TIM_BREAK_INPUT_SUPPORT */
500#define TIM_DMABASE_TISEL 0x0000001AU
509#define TIM_EVENTSOURCE_UPDATE TIM_EGR_UG
510#define TIM_EVENTSOURCE_CC1 TIM_EGR_CC1G
511#define TIM_EVENTSOURCE_CC2 TIM_EGR_CC2G
512#define TIM_EVENTSOURCE_CC3 TIM_EGR_CC3G
513#define TIM_EVENTSOURCE_CC4 TIM_EGR_CC4G
514#define TIM_EVENTSOURCE_COM TIM_EGR_COMG
515#define TIM_EVENTSOURCE_TRIGGER TIM_EGR_TG
516#define TIM_EVENTSOURCE_BREAK TIM_EGR_BG
517#define TIM_EVENTSOURCE_BREAK2 TIM_EGR_B2G
526#define TIM_INPUTCHANNELPOLARITY_RISING 0x00000000U
527#define TIM_INPUTCHANNELPOLARITY_FALLING TIM_CCER_CC1P
528#define TIM_INPUTCHANNELPOLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP)
537#define TIM_ETRPOLARITY_INVERTED TIM_SMCR_ETP
538#define TIM_ETRPOLARITY_NONINVERTED 0x00000000U
547#define TIM_ETRPRESCALER_DIV1 0x00000000U
548#define TIM_ETRPRESCALER_DIV2 TIM_SMCR_ETPS_0
549#define TIM_ETRPRESCALER_DIV4 TIM_SMCR_ETPS_1
550#define TIM_ETRPRESCALER_DIV8 TIM_SMCR_ETPS
559#define TIM_COUNTERMODE_UP 0x00000000U
560#define TIM_COUNTERMODE_DOWN TIM_CR1_DIR
561#define TIM_COUNTERMODE_CENTERALIGNED1 TIM_CR1_CMS_0
562#define TIM_COUNTERMODE_CENTERALIGNED2 TIM_CR1_CMS_1
563#define TIM_COUNTERMODE_CENTERALIGNED3 TIM_CR1_CMS
572#define TIM_UIFREMAP_DISABLE 0x00000000U
573#define TIM_UIFREMAP_ENABLE TIM_CR1_UIFREMAP
582#define TIM_CLOCKDIVISION_DIV1 0x00000000U
583#define TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0
584#define TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1
593#define TIM_OUTPUTSTATE_DISABLE 0x00000000U
594#define TIM_OUTPUTSTATE_ENABLE TIM_CCER_CC1E
603#define TIM_AUTORELOAD_PRELOAD_DISABLE 0x00000000U
604#define TIM_AUTORELOAD_PRELOAD_ENABLE TIM_CR1_ARPE
614#define TIM_OCFAST_DISABLE 0x00000000U
615#define TIM_OCFAST_ENABLE TIM_CCMR1_OC1FE
624#define TIM_OUTPUTNSTATE_DISABLE 0x00000000U
625#define TIM_OUTPUTNSTATE_ENABLE TIM_CCER_CC1NE
634#define TIM_OCPOLARITY_HIGH 0x00000000U
635#define TIM_OCPOLARITY_LOW TIM_CCER_CC1P
644#define TIM_OCNPOLARITY_HIGH 0x00000000U
645#define TIM_OCNPOLARITY_LOW TIM_CCER_CC1NP
654#define TIM_OCIDLESTATE_SET TIM_CR2_OIS1
655#define TIM_OCIDLESTATE_RESET 0x00000000U
664#define TIM_OCNIDLESTATE_SET TIM_CR2_OIS1N
665#define TIM_OCNIDLESTATE_RESET 0x00000000U
674#define TIM_ICPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
675#define TIM_ICPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
676#define TIM_ICPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
685#define TIM_ENCODERINPUTPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
686#define TIM_ENCODERINPUTPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
695#define TIM_ICSELECTION_DIRECTTI TIM_CCMR1_CC1S_0
696#define TIM_ICSELECTION_INDIRECTTI TIM_CCMR1_CC1S_1
697#define TIM_ICSELECTION_TRC TIM_CCMR1_CC1S
706#define TIM_ICPSC_DIV1 0x00000000U
707#define TIM_ICPSC_DIV2 TIM_CCMR1_IC1PSC_0
708#define TIM_ICPSC_DIV4 TIM_CCMR1_IC1PSC_1
709#define TIM_ICPSC_DIV8 TIM_CCMR1_IC1PSC
718#define TIM_OPMODE_SINGLE TIM_CR1_OPM
719#define TIM_OPMODE_REPETITIVE 0x00000000U
728#define TIM_ENCODERMODE_TI1 TIM_SMCR_SMS_0
729#define TIM_ENCODERMODE_TI2 TIM_SMCR_SMS_1
730#define TIM_ENCODERMODE_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0)
739#define TIM_IT_UPDATE TIM_DIER_UIE
740#define TIM_IT_CC1 TIM_DIER_CC1IE
741#define TIM_IT_CC2 TIM_DIER_CC2IE
742#define TIM_IT_CC3 TIM_DIER_CC3IE
743#define TIM_IT_CC4 TIM_DIER_CC4IE
744#define TIM_IT_COM TIM_DIER_COMIE
745#define TIM_IT_TRIGGER TIM_DIER_TIE
746#define TIM_IT_BREAK TIM_DIER_BIE
755#define TIM_COMMUTATION_TRGI TIM_CR2_CCUS
756#define TIM_COMMUTATION_SOFTWARE 0x00000000U
765#define TIM_DMA_UPDATE TIM_DIER_UDE
766#define TIM_DMA_CC1 TIM_DIER_CC1DE
767#define TIM_DMA_CC2 TIM_DIER_CC2DE
768#define TIM_DMA_CC3 TIM_DIER_CC3DE
769#define TIM_DMA_CC4 TIM_DIER_CC4DE
770#define TIM_DMA_COM TIM_DIER_COMDE
771#define TIM_DMA_TRIGGER TIM_DIER_TDE
780#define TIM_CCDMAREQUEST_CC 0x00000000U
781#define TIM_CCDMAREQUEST_UPDATE TIM_CR2_CCDS
790#define TIM_FLAG_UPDATE TIM_SR_UIF
791#define TIM_FLAG_CC1 TIM_SR_CC1IF
792#define TIM_FLAG_CC2 TIM_SR_CC2IF
793#define TIM_FLAG_CC3 TIM_SR_CC3IF
794#define TIM_FLAG_CC4 TIM_SR_CC4IF
795#define TIM_FLAG_CC5 TIM_SR_CC5IF
796#define TIM_FLAG_CC6 TIM_SR_CC6IF
797#define TIM_FLAG_COM TIM_SR_COMIF
798#define TIM_FLAG_TRIGGER TIM_SR_TIF
799#define TIM_FLAG_BREAK TIM_SR_BIF
800#define TIM_FLAG_BREAK2 TIM_SR_B2IF
801#define TIM_FLAG_SYSTEM_BREAK TIM_SR_SBIF
802#define TIM_FLAG_CC1OF TIM_SR_CC1OF
803#define TIM_FLAG_CC2OF TIM_SR_CC2OF
804#define TIM_FLAG_CC3OF TIM_SR_CC3OF
805#define TIM_FLAG_CC4OF TIM_SR_CC4OF
814#define TIM_CHANNEL_1 0x00000000U
815#define TIM_CHANNEL_2 0x00000004U
816#define TIM_CHANNEL_3 0x00000008U
817#define TIM_CHANNEL_4 0x0000000CU
818#define TIM_CHANNEL_5 0x00000010U
819#define TIM_CHANNEL_6 0x00000014U
820#define TIM_CHANNEL_ALL 0x0000003CU
829#define TIM_CLOCKSOURCE_INTERNAL TIM_SMCR_ETPS_0
830#define TIM_CLOCKSOURCE_ETRMODE1 TIM_TS_ETRF
831#define TIM_CLOCKSOURCE_ETRMODE2 TIM_SMCR_ETPS_1
832#define TIM_CLOCKSOURCE_TI1ED TIM_TS_TI1F_ED
833#define TIM_CLOCKSOURCE_TI1 TIM_TS_TI1FP1
834#define TIM_CLOCKSOURCE_TI2 TIM_TS_TI2FP2
835#define TIM_CLOCKSOURCE_ITR0 TIM_TS_ITR0
836#define TIM_CLOCKSOURCE_ITR1 TIM_TS_ITR1
837#define TIM_CLOCKSOURCE_ITR2 TIM_TS_ITR2
838#define TIM_CLOCKSOURCE_ITR3 TIM_TS_ITR3
839#define TIM_CLOCKSOURCE_ITR4 TIM_TS_ITR4
840#define TIM_CLOCKSOURCE_ITR5 TIM_TS_ITR5
841#define TIM_CLOCKSOURCE_ITR6 TIM_TS_ITR6
842#define TIM_CLOCKSOURCE_ITR7 TIM_TS_ITR7
843#define TIM_CLOCKSOURCE_ITR8 TIM_TS_ITR8
852#define TIM_CLOCKPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED
853#define TIM_CLOCKPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED
854#define TIM_CLOCKPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
855#define TIM_CLOCKPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
856#define TIM_CLOCKPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
865#define TIM_CLOCKPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1
866#define TIM_CLOCKPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2
867#define TIM_CLOCKPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4
868#define TIM_CLOCKPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8
877#define TIM_CLEARINPUTPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED
878#define TIM_CLEARINPUTPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED
887#define TIM_CLEARINPUTPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1
888#define TIM_CLEARINPUTPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2
889#define TIM_CLEARINPUTPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4
890#define TIM_CLEARINPUTPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8
899#define TIM_OSSR_ENABLE TIM_BDTR_OSSR
900#define TIM_OSSR_DISABLE 0x00000000U
909#define TIM_OSSI_ENABLE TIM_BDTR_OSSI
910#define TIM_OSSI_DISABLE 0x00000000U
918#define TIM_LOCKLEVEL_OFF 0x00000000U
919#define TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0
920#define TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1
921#define TIM_LOCKLEVEL_3 TIM_BDTR_LOCK
930#define TIM_BREAK_ENABLE TIM_BDTR_BKE
931#define TIM_BREAK_DISABLE 0x00000000U
940#define TIM_BREAKPOLARITY_LOW 0x00000000U
941#define TIM_BREAKPOLARITY_HIGH TIM_BDTR_BKP
945#if defined(TIM_BDTR_BKBID)
946
951#define TIM_BREAK_AFMODE_INPUT 0x00000000U
952#define TIM_BREAK_AFMODE_BIDIRECTIONAL TIM_BDTR_BKBID
956#endif /*TIM_BDTR_BKBID */
957
962#define TIM_BREAK2_DISABLE 0x00000000U
963#define TIM_BREAK2_ENABLE TIM_BDTR_BK2E
972#define TIM_BREAK2POLARITY_LOW 0x00000000U
973#define TIM_BREAK2POLARITY_HIGH TIM_BDTR_BK2P
977#if defined(TIM_BDTR_BKBID)
978
983#define TIM_BREAK2_AFMODE_INPUT 0x00000000U
984#define TIM_BREAK2_AFMODE_BIDIRECTIONAL TIM_BDTR_BK2BID
988#endif /* TIM_BDTR_BKBID */
989
994#define TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U
995#define TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE
1004#define TIM_GROUPCH5_NONE 0x00000000U
1005#define TIM_GROUPCH5_OC1REFC TIM_CCR5_GC5C1
1006#define TIM_GROUPCH5_OC2REFC TIM_CCR5_GC5C2
1007#define TIM_GROUPCH5_OC3REFC TIM_CCR5_GC5C3
1016#define TIM_TRGO_RESET 0x00000000U
1017#define TIM_TRGO_ENABLE TIM_CR2_MMS_0
1018#define TIM_TRGO_UPDATE TIM_CR2_MMS_1
1019#define TIM_TRGO_OC1 (TIM_CR2_MMS_1 | TIM_CR2_MMS_0)
1020#define TIM_TRGO_OC1REF TIM_CR2_MMS_2
1021#define TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0)
1022#define TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1)
1023#define TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0)
1032#define TIM_TRGO2_RESET 0x00000000U
1033#define TIM_TRGO2_ENABLE TIM_CR2_MMS2_0
1034#define TIM_TRGO2_UPDATE TIM_CR2_MMS2_1
1035#define TIM_TRGO2_OC1 (TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1036#define TIM_TRGO2_OC1REF TIM_CR2_MMS2_2
1037#define TIM_TRGO2_OC2REF (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_0)
1038#define TIM_TRGO2_OC3REF (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1)
1039#define TIM_TRGO2_OC4REF (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1040#define TIM_TRGO2_OC5REF TIM_CR2_MMS2_3
1041#define TIM_TRGO2_OC6REF (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_0)
1042#define TIM_TRGO2_OC4REF_RISINGFALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_1)
1043#define TIM_TRGO2_OC6REF_RISINGFALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1044#define TIM_TRGO2_OC4REF_RISING_OC6REF_RISING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2)
1045#define TIM_TRGO2_OC4REF_RISING_OC6REF_FALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 | TIM_CR2_MMS2_0)
1046#define TIM_TRGO2_OC5REF_RISING_OC6REF_RISING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 |TIM_CR2_MMS2_1)
1047#define TIM_TRGO2_OC5REF_RISING_OC6REF_FALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1056#define TIM_MASTERSLAVEMODE_ENABLE TIM_SMCR_MSM
1057#define TIM_MASTERSLAVEMODE_DISABLE 0x00000000U
1066#define TIM_SLAVEMODE_DISABLE 0x00000000U
1067#define TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2
1068#define TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0)
1069#define TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1)
1070#define TIM_SLAVEMODE_EXTERNAL1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0)
1071#define TIM_SLAVEMODE_COMBINED_RESETTRIGGER TIM_SMCR_SMS_3
1080#define TIM_OCMODE_TIMING 0x00000000U
1081#define TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0
1082#define TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1
1083#define TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0)
1084#define TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1)
1085#define TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0)
1086#define TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0)
1087#define TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2
1088#define TIM_OCMODE_RETRIGERRABLE_OPM1 TIM_CCMR1_OC1M_3
1089#define TIM_OCMODE_RETRIGERRABLE_OPM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0)
1090#define TIM_OCMODE_COMBINED_PWM1 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_2)
1091#define TIM_OCMODE_COMBINED_PWM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0 | TIM_CCMR1_OC1M_2)
1092#define TIM_OCMODE_ASSYMETRIC_PWM1 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2)
1093#define TIM_OCMODE_ASSYMETRIC_PWM2 TIM_CCMR1_OC1M
1102#define TIM_TS_ITR0 0x00000000U
1103#define TIM_TS_ITR1 TIM_SMCR_TS_0
1104#define TIM_TS_ITR2 TIM_SMCR_TS_1
1105#define TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1)
1106#define TIM_TS_ITR4 (TIM_SMCR_TS_3)
1107#define TIM_TS_ITR5 (TIM_SMCR_TS_0 | TIM_SMCR_TS_3)
1108#define TIM_TS_ITR6 (TIM_SMCR_TS_1 | TIM_SMCR_TS_3)
1109#define TIM_TS_ITR7 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_3)
1110#define TIM_TS_ITR8 (TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1111#define TIM_TS_ITR9 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1112#define TIM_TS_ITR10 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1113#define TIM_TS_ITR11 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1114#define TIM_TS_ITR12 (TIM_SMCR_TS_4)
1115#define TIM_TS_ITR13 (TIM_SMCR_TS_0 | TIM_SMCR_TS_4)
1116#define TIM_TS_TI1F_ED TIM_SMCR_TS_2
1117#define TIM_TS_TI1FP1 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2)
1118#define TIM_TS_TI2FP2 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2)
1119#define TIM_TS_ETRF (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2)
1120#define TIM_TS_NONE 0x0000FFFFU
1129#define TIM_TRIGGERPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED
1130#define TIM_TRIGGERPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED
1131#define TIM_TRIGGERPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
1132#define TIM_TRIGGERPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
1133#define TIM_TRIGGERPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
1142#define TIM_TRIGGERPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1
1143#define TIM_TRIGGERPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2
1144#define TIM_TRIGGERPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4
1145#define TIM_TRIGGERPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8
1154#define TIM_TI1SELECTION_CH1 0x00000000U
1155#define TIM_TI1SELECTION_XORCOMBINATION TIM_CR2_TI1S
1164#define TIM_DMABURSTLENGTH_1TRANSFER 0x00000000U
1165#define TIM_DMABURSTLENGTH_2TRANSFERS 0x00000100U
1166#define TIM_DMABURSTLENGTH_3TRANSFERS 0x00000200U
1167#define TIM_DMABURSTLENGTH_4TRANSFERS 0x00000300U
1168#define TIM_DMABURSTLENGTH_5TRANSFERS 0x00000400U
1169#define TIM_DMABURSTLENGTH_6TRANSFERS 0x00000500U
1170#define TIM_DMABURSTLENGTH_7TRANSFERS 0x00000600U
1171#define TIM_DMABURSTLENGTH_8TRANSFERS 0x00000700U
1172#define TIM_DMABURSTLENGTH_9TRANSFERS 0x00000800U
1173#define TIM_DMABURSTLENGTH_10TRANSFERS 0x00000900U
1174#define TIM_DMABURSTLENGTH_11TRANSFERS 0x00000A00U
1175#define TIM_DMABURSTLENGTH_12TRANSFERS 0x00000B00U
1176#define TIM_DMABURSTLENGTH_13TRANSFERS 0x00000C00U
1177#define TIM_DMABURSTLENGTH_14TRANSFERS 0x00000D00U
1178#define TIM_DMABURSTLENGTH_15TRANSFERS 0x00000E00U
1179#define TIM_DMABURSTLENGTH_16TRANSFERS 0x00000F00U
1180#define TIM_DMABURSTLENGTH_17TRANSFERS 0x00001000U
1181#define TIM_DMABURSTLENGTH_18TRANSFERS 0x00001100U
1190#define TIM_DMA_ID_UPDATE ((uint16_t) 0x0000)
1191#define TIM_DMA_ID_CC1 ((uint16_t) 0x0001)
1192#define TIM_DMA_ID_CC2 ((uint16_t) 0x0002)
1193#define TIM_DMA_ID_CC3 ((uint16_t) 0x0003)
1194#define TIM_DMA_ID_CC4 ((uint16_t) 0x0004)
1195#define TIM_DMA_ID_COMMUTATION ((uint16_t) 0x0005)
1196#define TIM_DMA_ID_TRIGGER ((uint16_t) 0x0006)
1205#define TIM_CCx_ENABLE 0x00000001U
1206#define TIM_CCx_DISABLE 0x00000000U
1207#define TIM_CCxN_ENABLE 0x00000004U
1208#define TIM_CCxN_DISABLE 0x00000000U
1217#define TIM_BREAK_SYSTEM_ECC SYSCFG_CFGR2_ECCL
1218#define TIM_BREAK_SYSTEM_PVD SYSCFG_CFGR2_PVDL
1219#define TIM_BREAK_SYSTEM_SRAM_PARITY_ERROR SYSCFG_CFGR2_SPL
1220#define TIM_BREAK_SYSTEM_LOCKUP SYSCFG_CFGR2_CLL
1228/* End of exported constants -------------------------------------------------*/
1229
1230/* Exported macros -----------------------------------------------------------*/
1240#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1241#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \
1242 (__HANDLE__)->State = HAL_TIM_STATE_RESET; \
1243 (__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1244 (__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1245 (__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1246 (__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1247 (__HANDLE__)->ChannelState[4] = HAL_TIM_CHANNEL_STATE_RESET; \
1248 (__HANDLE__)->ChannelState[5] = HAL_TIM_CHANNEL_STATE_RESET; \
1249 (__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1250 (__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1251 (__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1252 (__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1253 (__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \
1254 (__HANDLE__)->Base_MspInitCallback = NULL; \
1255 (__HANDLE__)->Base_MspDeInitCallback = NULL; \
1256 (__HANDLE__)->IC_MspInitCallback = NULL; \
1257 (__HANDLE__)->IC_MspDeInitCallback = NULL; \
1258 (__HANDLE__)->OC_MspInitCallback = NULL; \
1259 (__HANDLE__)->OC_MspDeInitCallback = NULL; \
1260 (__HANDLE__)->PWM_MspInitCallback = NULL; \
1261 (__HANDLE__)->PWM_MspDeInitCallback = NULL; \
1262 (__HANDLE__)->OnePulse_MspInitCallback = NULL; \
1263 (__HANDLE__)->OnePulse_MspDeInitCallback = NULL; \
1264 (__HANDLE__)->Encoder_MspInitCallback = NULL; \
1265 (__HANDLE__)->Encoder_MspDeInitCallback = NULL; \
1266 (__HANDLE__)->HallSensor_MspInitCallback = NULL; \
1267 (__HANDLE__)->HallSensor_MspDeInitCallback = NULL; \
1268 } while(0)
1269#else
1270#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \
1271 (__HANDLE__)->State = HAL_TIM_STATE_RESET; \
1272 (__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1273 (__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1274 (__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1275 (__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1276 (__HANDLE__)->ChannelState[4] = HAL_TIM_CHANNEL_STATE_RESET; \
1277 (__HANDLE__)->ChannelState[5] = HAL_TIM_CHANNEL_STATE_RESET; \
1278 (__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1279 (__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1280 (__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1281 (__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1282 (__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \
1283 } while(0)
1284#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1285
1291#define __HAL_TIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN))
1292
1298#define __HAL_TIM_MOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE))
1299
1305#define __HAL_TIM_DISABLE(__HANDLE__) \
1306 do { \
1307 if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \
1308 { \
1309 if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \
1310 { \
1311 (__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \
1312 } \
1313 } \
1314 } while(0)
1315
1323#define __HAL_TIM_MOE_DISABLE(__HANDLE__) \
1324 do { \
1325 if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \
1326 { \
1327 if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \
1328 { \
1329 (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE); \
1330 } \
1331 } \
1332 } while(0)
1333
1340#define __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY(__HANDLE__) (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE)
1341
1356#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))
1357
1372#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__))
1373
1387#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER |= (__DMA__))
1388
1402#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER &= ~(__DMA__))
1403
1426#define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__))
1427
1450#define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
1451
1467#define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->DIER & (__INTERRUPT__)) \
1468 == (__INTERRUPT__)) ? SET : RESET)
1469
1484#define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__))
1485
1494#define __HAL_TIM_UIFREMAP_ENABLE(__HANDLE__) (((__HANDLE__)->Instance->CR1 |= TIM_CR1_UIFREMAP))
1495
1502#define __HAL_TIM_UIFREMAP_DISABLE(__HANDLE__) (((__HANDLE__)->Instance->CR1 &= ~TIM_CR1_UIFREMAP))
1503
1510#define __HAL_TIM_GET_UIFCPY(__COUNTER__) (((__COUNTER__) & (TIM_CNT_UIFCPY)) == (TIM_CNT_UIFCPY))
1511
1519#define __HAL_TIM_IS_TIM_COUNTING_DOWN(__HANDLE__) (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR))
1520
1527#define __HAL_TIM_SET_PRESCALER(__HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))
1528
1538#define __HAL_TIM_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CNT = (__COUNTER__))
1539
1545#define __HAL_TIM_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNT)
1546
1553#define __HAL_TIM_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__) \
1554 do{ \
1555 (__HANDLE__)->Instance->ARR = (__AUTORELOAD__); \
1556 (__HANDLE__)->Init.Period = (__AUTORELOAD__); \
1557 } while(0)
1558
1564#define __HAL_TIM_GET_AUTORELOAD(__HANDLE__) ((__HANDLE__)->Instance->ARR)
1565
1576#define __HAL_TIM_SET_CLOCKDIVISION(__HANDLE__, __CKD__) \
1577 do{ \
1578 (__HANDLE__)->Instance->CR1 &= (~TIM_CR1_CKD); \
1579 (__HANDLE__)->Instance->CR1 |= (__CKD__); \
1580 (__HANDLE__)->Init.ClockDivision = (__CKD__); \
1581 } while(0)
1582
1591#define __HAL_TIM_GET_CLOCKDIVISION(__HANDLE__) ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD)
1592
1611#define __HAL_TIM_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__) \
1612 do{ \
1613 TIM_RESET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__)); \
1614 TIM_SET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__), (__ICPSC__)); \
1615 } while(0)
1616
1632#define __HAL_TIM_GET_ICPRESCALER(__HANDLE__, __CHANNEL__) \
1633 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC1PSC) :\
1634 ((__CHANNEL__) == TIM_CHANNEL_2) ? (((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC2PSC) >> 8U) :\
1635 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC3PSC) :\
1636 (((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC4PSC)) >> 8U)
1637
1652#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__) \
1653 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1 = (__COMPARE__)) :\
1654 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2 = (__COMPARE__)) :\
1655 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3 = (__COMPARE__)) :\
1656 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCR4 = (__COMPARE__)) :\
1657 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCR5 = (__COMPARE__)) :\
1658 ((__HANDLE__)->Instance->CCR6 = (__COMPARE__)))
1659
1673#define __HAL_TIM_GET_COMPARE(__HANDLE__, __CHANNEL__) \
1674 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1) :\
1675 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2) :\
1676 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3) :\
1677 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCR4) :\
1678 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCR5) :\
1679 ((__HANDLE__)->Instance->CCR6))
1680
1694#define __HAL_TIM_ENABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \
1695 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1PE) :\
1696 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2PE) :\
1697 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3PE) :\
1698 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4PE) :\
1699 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC5PE) :\
1700 ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC6PE))
1701
1715#define __HAL_TIM_DISABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \
1716 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1PE) :\
1717 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2PE) :\
1718 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3PE) :\
1719 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4PE) :\
1720 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC5PE) :\
1721 ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC6PE))
1722
1740#define __HAL_TIM_ENABLE_OCxFAST(__HANDLE__, __CHANNEL__) \
1741 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1FE) :\
1742 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2FE) :\
1743 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3FE) :\
1744 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4FE) :\
1745 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC5FE) :\
1746 ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC6FE))
1747
1765#define __HAL_TIM_DISABLE_OCxFAST(__HANDLE__, __CHANNEL__) \
1766 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE) :\
1767 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE) :\
1768 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE) :\
1769 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE) :\
1770 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC5FE) :\
1771 ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC6FE))
1772
1781#define __HAL_TIM_URS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|= TIM_CR1_URS)
1782
1794#define __HAL_TIM_URS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1&=~TIM_CR1_URS)
1795
1811#define __HAL_TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \
1812 do{ \
1813 TIM_RESET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__)); \
1814 TIM_SET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__), (__POLARITY__)); \
1815 }while(0)
1816
1825#define __HAL_TIM_SELECT_CCDMAREQUEST(__HANDLE__, __CCDMA__) \
1826 MODIFY_REG((__HANDLE__)->Instance->CR2, TIM_CR2_CCDS, (__CCDMA__))
1827
1831/* End of exported macros ----------------------------------------------------*/
1832
1833/* Private constants ---------------------------------------------------------*/
1838/* The counter of a timer instance is disabled only if all the CCx and CCxN
1839 channels have been disabled */
1840#define TIM_CCER_CCxE_MASK ((uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E))
1841#define TIM_CCER_CCxNE_MASK ((uint32_t)(TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE))
1845/* End of private constants --------------------------------------------------*/
1846
1847/* Private macros ------------------------------------------------------------*/
1852#define IS_TIM_CLEARINPUT_SOURCE(__MODE__) (((__MODE__) == TIM_CLEARINPUTSOURCE_NONE) || \
1853 ((__MODE__) == TIM_CLEARINPUTSOURCE_ETR))
1854
1855#define IS_TIM_DMA_BASE(__BASE__) (((__BASE__) == TIM_DMABASE_CR1) || \
1856 ((__BASE__) == TIM_DMABASE_CR2) || \
1857 ((__BASE__) == TIM_DMABASE_SMCR) || \
1858 ((__BASE__) == TIM_DMABASE_DIER) || \
1859 ((__BASE__) == TIM_DMABASE_SR) || \
1860 ((__BASE__) == TIM_DMABASE_EGR) || \
1861 ((__BASE__) == TIM_DMABASE_CCMR1) || \
1862 ((__BASE__) == TIM_DMABASE_CCMR2) || \
1863 ((__BASE__) == TIM_DMABASE_CCER) || \
1864 ((__BASE__) == TIM_DMABASE_CNT) || \
1865 ((__BASE__) == TIM_DMABASE_PSC) || \
1866 ((__BASE__) == TIM_DMABASE_ARR) || \
1867 ((__BASE__) == TIM_DMABASE_RCR) || \
1868 ((__BASE__) == TIM_DMABASE_CCR1) || \
1869 ((__BASE__) == TIM_DMABASE_CCR2) || \
1870 ((__BASE__) == TIM_DMABASE_CCR3) || \
1871 ((__BASE__) == TIM_DMABASE_CCR4) || \
1872 ((__BASE__) == TIM_DMABASE_BDTR) || \
1873 ((__BASE__) == TIM_DMABASE_CCMR3) || \
1874 ((__BASE__) == TIM_DMABASE_CCR5) || \
1875 ((__BASE__) == TIM_DMABASE_CCR6) || \
1876 ((__BASE__) == TIM_DMABASE_AF1) || \
1877 ((__BASE__) == TIM_DMABASE_AF2) || \
1878 ((__BASE__) == TIM_DMABASE_TISEL))
1879
1880
1881#define IS_TIM_EVENT_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFFFE00U) == 0x00000000U) && ((__SOURCE__) != 0x00000000U))
1882
1883#define IS_TIM_COUNTER_MODE(__MODE__) (((__MODE__) == TIM_COUNTERMODE_UP) || \
1884 ((__MODE__) == TIM_COUNTERMODE_DOWN) || \
1885 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED1) || \
1886 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED2) || \
1887 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED3))
1888
1889#define IS_TIM_UIFREMAP_MODE(__MODE__) (((__MODE__) == TIM_UIFREMAP_DISABLE) || \
1890 ((__MODE__) == TIM_UIFREMAP_ENABLE))
1891
1892#define IS_TIM_CLOCKDIVISION_DIV(__DIV__) (((__DIV__) == TIM_CLOCKDIVISION_DIV1) || \
1893 ((__DIV__) == TIM_CLOCKDIVISION_DIV2) || \
1894 ((__DIV__) == TIM_CLOCKDIVISION_DIV4))
1895
1896#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD) (((PRELOAD) == TIM_AUTORELOAD_PRELOAD_DISABLE) || \
1897 ((PRELOAD) == TIM_AUTORELOAD_PRELOAD_ENABLE))
1898
1899#define IS_TIM_FAST_STATE(__STATE__) (((__STATE__) == TIM_OCFAST_DISABLE) || \
1900 ((__STATE__) == TIM_OCFAST_ENABLE))
1901
1902#define IS_TIM_OC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCPOLARITY_HIGH) || \
1903 ((__POLARITY__) == TIM_OCPOLARITY_LOW))
1904
1905#define IS_TIM_OCN_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCNPOLARITY_HIGH) || \
1906 ((__POLARITY__) == TIM_OCNPOLARITY_LOW))
1907
1908#define IS_TIM_OCIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCIDLESTATE_SET) || \
1909 ((__STATE__) == TIM_OCIDLESTATE_RESET))
1910
1911#define IS_TIM_OCNIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCNIDLESTATE_SET) || \
1912 ((__STATE__) == TIM_OCNIDLESTATE_RESET))
1913
1914#define IS_TIM_ENCODERINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_RISING) || \
1915 ((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_FALLING))
1916
1917#define IS_TIM_IC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ICPOLARITY_RISING) || \
1918 ((__POLARITY__) == TIM_ICPOLARITY_FALLING) || \
1919 ((__POLARITY__) == TIM_ICPOLARITY_BOTHEDGE))
1920
1921#define IS_TIM_IC_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_ICSELECTION_DIRECTTI) || \
1922 ((__SELECTION__) == TIM_ICSELECTION_INDIRECTTI) || \
1923 ((__SELECTION__) == TIM_ICSELECTION_TRC))
1924
1925#define IS_TIM_IC_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_ICPSC_DIV1) || \
1926 ((__PRESCALER__) == TIM_ICPSC_DIV2) || \
1927 ((__PRESCALER__) == TIM_ICPSC_DIV4) || \
1928 ((__PRESCALER__) == TIM_ICPSC_DIV8))
1929
1930#define IS_TIM_OPM_MODE(__MODE__) (((__MODE__) == TIM_OPMODE_SINGLE) || \
1931 ((__MODE__) == TIM_OPMODE_REPETITIVE))
1932
1933#define IS_TIM_ENCODER_MODE(__MODE__) (((__MODE__) == TIM_ENCODERMODE_TI1) || \
1934 ((__MODE__) == TIM_ENCODERMODE_TI2) || \
1935 ((__MODE__) == TIM_ENCODERMODE_TI12))
1936
1937#define IS_TIM_DMA_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFF80FFU) == 0x00000000U) && ((__SOURCE__) != 0x00000000U))
1938
1939#define IS_TIM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \
1940 ((__CHANNEL__) == TIM_CHANNEL_2) || \
1941 ((__CHANNEL__) == TIM_CHANNEL_3) || \
1942 ((__CHANNEL__) == TIM_CHANNEL_4) || \
1943 ((__CHANNEL__) == TIM_CHANNEL_5) || \
1944 ((__CHANNEL__) == TIM_CHANNEL_6) || \
1945 ((__CHANNEL__) == TIM_CHANNEL_ALL))
1946
1947#define IS_TIM_OPM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \
1948 ((__CHANNEL__) == TIM_CHANNEL_2))
1949
1950#define IS_TIM_PERIOD(__HANDLE__, __PERIOD__) \
1951 ((IS_TIM_32B_COUNTER_INSTANCE(((__HANDLE__)->Instance)) == 0U) ? (((__PERIOD__) > 0U) && ((__PERIOD__) <= 0x0000FFFFU)) : ((__PERIOD__) > 0U))
1952
1953#define IS_TIM_COMPLEMENTARY_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \
1954 ((__CHANNEL__) == TIM_CHANNEL_2) || \
1955 ((__CHANNEL__) == TIM_CHANNEL_3))
1956
1957#define IS_TIM_CLOCKSOURCE(__CLOCK__) (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \
1958 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \
1959 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \
1960 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \
1961 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \
1962 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \
1963 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \
1964 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \
1965 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \
1966 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR3))
1967
1968#define IS_TIM_CLOCKPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLOCKPOLARITY_INVERTED) || \
1969 ((__POLARITY__) == TIM_CLOCKPOLARITY_NONINVERTED) || \
1970 ((__POLARITY__) == TIM_CLOCKPOLARITY_RISING) || \
1971 ((__POLARITY__) == TIM_CLOCKPOLARITY_FALLING) || \
1972 ((__POLARITY__) == TIM_CLOCKPOLARITY_BOTHEDGE))
1973
1974#define IS_TIM_CLOCKPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV1) || \
1975 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV2) || \
1976 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV4) || \
1977 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV8))
1978
1979#define IS_TIM_CLOCKFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
1980
1981#define IS_TIM_CLEARINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLEARINPUTPOLARITY_INVERTED) || \
1982 ((__POLARITY__) == TIM_CLEARINPUTPOLARITY_NONINVERTED))
1983
1984#define IS_TIM_CLEARINPUT_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV1) || \
1985 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV2) || \
1986 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV4) || \
1987 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV8))
1988
1989#define IS_TIM_CLEARINPUT_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
1990
1991#define IS_TIM_OSSR_STATE(__STATE__) (((__STATE__) == TIM_OSSR_ENABLE) || \
1992 ((__STATE__) == TIM_OSSR_DISABLE))
1993
1994#define IS_TIM_OSSI_STATE(__STATE__) (((__STATE__) == TIM_OSSI_ENABLE) || \
1995 ((__STATE__) == TIM_OSSI_DISABLE))
1996
1997#define IS_TIM_LOCK_LEVEL(__LEVEL__) (((__LEVEL__) == TIM_LOCKLEVEL_OFF) || \
1998 ((__LEVEL__) == TIM_LOCKLEVEL_1) || \
1999 ((__LEVEL__) == TIM_LOCKLEVEL_2) || \
2000 ((__LEVEL__) == TIM_LOCKLEVEL_3))
2001
2002#define IS_TIM_BREAK_FILTER(__BRKFILTER__) ((__BRKFILTER__) <= 0xFUL)
2003
2004
2005#define IS_TIM_BREAK_STATE(__STATE__) (((__STATE__) == TIM_BREAK_ENABLE) || \
2006 ((__STATE__) == TIM_BREAK_DISABLE))
2007
2008#define IS_TIM_BREAK_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKPOLARITY_LOW) || \
2009 ((__POLARITY__) == TIM_BREAKPOLARITY_HIGH))
2010#if defined(TIM_BDTR_BKBID)
2011
2012#define IS_TIM_BREAK_AFMODE(__AFMODE__) (((__AFMODE__) == TIM_BREAK_AFMODE_INPUT) || \
2013 ((__AFMODE__) == TIM_BREAK_AFMODE_BIDIRECTIONAL))
2014
2015#endif /* TIM_BDTR_BKBID */
2016
2017#define IS_TIM_BREAK2_STATE(__STATE__) (((__STATE__) == TIM_BREAK2_ENABLE) || \
2018 ((__STATE__) == TIM_BREAK2_DISABLE))
2019
2020#define IS_TIM_BREAK2_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAK2POLARITY_LOW) || \
2021 ((__POLARITY__) == TIM_BREAK2POLARITY_HIGH))
2022#if defined(TIM_BDTR_BKBID)
2023
2024#define IS_TIM_BREAK2_AFMODE(__AFMODE__) (((__AFMODE__) == TIM_BREAK2_AFMODE_INPUT) || \
2025 ((__AFMODE__) == TIM_BREAK2_AFMODE_BIDIRECTIONAL))
2026
2027#endif /* TIM_BDTR_BKBID */
2028
2029#define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__) (((__STATE__) == TIM_AUTOMATICOUTPUT_ENABLE) || \
2030 ((__STATE__) == TIM_AUTOMATICOUTPUT_DISABLE))
2031
2032#define IS_TIM_GROUPCH5(__OCREF__) ((((__OCREF__) & 0x1FFFFFFFU) == 0x00000000U))
2033
2034#define IS_TIM_TRGO_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO_RESET) || \
2035 ((__SOURCE__) == TIM_TRGO_ENABLE) || \
2036 ((__SOURCE__) == TIM_TRGO_UPDATE) || \
2037 ((__SOURCE__) == TIM_TRGO_OC1) || \
2038 ((__SOURCE__) == TIM_TRGO_OC1REF) || \
2039 ((__SOURCE__) == TIM_TRGO_OC2REF) || \
2040 ((__SOURCE__) == TIM_TRGO_OC3REF) || \
2041 ((__SOURCE__) == TIM_TRGO_OC4REF))
2042
2043#define IS_TIM_TRGO2_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO2_RESET) || \
2044 ((__SOURCE__) == TIM_TRGO2_ENABLE) || \
2045 ((__SOURCE__) == TIM_TRGO2_UPDATE) || \
2046 ((__SOURCE__) == TIM_TRGO2_OC1) || \
2047 ((__SOURCE__) == TIM_TRGO2_OC1REF) || \
2048 ((__SOURCE__) == TIM_TRGO2_OC2REF) || \
2049 ((__SOURCE__) == TIM_TRGO2_OC3REF) || \
2050 ((__SOURCE__) == TIM_TRGO2_OC3REF) || \
2051 ((__SOURCE__) == TIM_TRGO2_OC4REF) || \
2052 ((__SOURCE__) == TIM_TRGO2_OC5REF) || \
2053 ((__SOURCE__) == TIM_TRGO2_OC6REF) || \
2054 ((__SOURCE__) == TIM_TRGO2_OC4REF_RISINGFALLING) || \
2055 ((__SOURCE__) == TIM_TRGO2_OC6REF_RISINGFALLING) || \
2056 ((__SOURCE__) == TIM_TRGO2_OC4REF_RISING_OC6REF_RISING) || \
2057 ((__SOURCE__) == TIM_TRGO2_OC4REF_RISING_OC6REF_FALLING) || \
2058 ((__SOURCE__) == TIM_TRGO2_OC5REF_RISING_OC6REF_RISING) || \
2059 ((__SOURCE__) == TIM_TRGO2_OC5REF_RISING_OC6REF_FALLING))
2060
2061#define IS_TIM_MSM_STATE(__STATE__) (((__STATE__) == TIM_MASTERSLAVEMODE_ENABLE) || \
2062 ((__STATE__) == TIM_MASTERSLAVEMODE_DISABLE))
2063
2064#define IS_TIM_SLAVE_MODE(__MODE__) (((__MODE__) == TIM_SLAVEMODE_DISABLE) || \
2065 ((__MODE__) == TIM_SLAVEMODE_RESET) || \
2066 ((__MODE__) == TIM_SLAVEMODE_GATED) || \
2067 ((__MODE__) == TIM_SLAVEMODE_TRIGGER) || \
2068 ((__MODE__) == TIM_SLAVEMODE_EXTERNAL1) || \
2069 ((__MODE__) == TIM_SLAVEMODE_COMBINED_RESETTRIGGER))
2070
2071#define IS_TIM_PWM_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_PWM1) || \
2072 ((__MODE__) == TIM_OCMODE_PWM2) || \
2073 ((__MODE__) == TIM_OCMODE_COMBINED_PWM1) || \
2074 ((__MODE__) == TIM_OCMODE_COMBINED_PWM2) || \
2075 ((__MODE__) == TIM_OCMODE_ASSYMETRIC_PWM1) || \
2076 ((__MODE__) == TIM_OCMODE_ASSYMETRIC_PWM2))
2077
2078#define IS_TIM_OC_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_TIMING) || \
2079 ((__MODE__) == TIM_OCMODE_ACTIVE) || \
2080 ((__MODE__) == TIM_OCMODE_INACTIVE) || \
2081 ((__MODE__) == TIM_OCMODE_TOGGLE) || \
2082 ((__MODE__) == TIM_OCMODE_FORCED_ACTIVE) || \
2083 ((__MODE__) == TIM_OCMODE_FORCED_INACTIVE) || \
2084 ((__MODE__) == TIM_OCMODE_RETRIGERRABLE_OPM1) || \
2085 ((__MODE__) == TIM_OCMODE_RETRIGERRABLE_OPM2))
2086
2087#define IS_TIM_TRIGGER_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \
2088 ((__SELECTION__) == TIM_TS_ITR1) || \
2089 ((__SELECTION__) == TIM_TS_ITR2) || \
2090 ((__SELECTION__) == TIM_TS_ITR3) || \
2091 ((__SELECTION__) == TIM_TS_ITR4) || \
2092 ((__SELECTION__) == TIM_TS_ITR5) || \
2093 ((__SELECTION__) == TIM_TS_ITR6) || \
2094 ((__SELECTION__) == TIM_TS_ITR7) || \
2095 ((__SELECTION__) == TIM_TS_ITR8) || \
2096 ((__SELECTION__) == TIM_TS_ITR12) || \
2097 ((__SELECTION__) == TIM_TS_ITR13) || \
2098 ((__SELECTION__) == TIM_TS_TI1F_ED) || \
2099 ((__SELECTION__) == TIM_TS_TI1FP1) || \
2100 ((__SELECTION__) == TIM_TS_TI2FP2) || \
2101 ((__SELECTION__) == TIM_TS_ETRF))
2102
2103#define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \
2104 ((__SELECTION__) == TIM_TS_ITR1) || \
2105 ((__SELECTION__) == TIM_TS_ITR2) || \
2106 ((__SELECTION__) == TIM_TS_ITR3) || \
2107 ((__SELECTION__) == TIM_TS_ITR4) || \
2108 ((__SELECTION__) == TIM_TS_ITR5) || \
2109 ((__SELECTION__) == TIM_TS_ITR6) || \
2110 ((__SELECTION__) == TIM_TS_ITR7) || \
2111 ((__SELECTION__) == TIM_TS_ITR8) || \
2112 ((__SELECTION__) == TIM_TS_ITR12) || \
2113 ((__SELECTION__) == TIM_TS_ITR13) || \
2114 ((__SELECTION__) == TIM_TS_NONE))
2115
2116#define IS_TIM_TRIGGERPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_TRIGGERPOLARITY_INVERTED ) || \
2117 ((__POLARITY__) == TIM_TRIGGERPOLARITY_NONINVERTED) || \
2118 ((__POLARITY__) == TIM_TRIGGERPOLARITY_RISING ) || \
2119 ((__POLARITY__) == TIM_TRIGGERPOLARITY_FALLING ) || \
2120 ((__POLARITY__) == TIM_TRIGGERPOLARITY_BOTHEDGE ))
2121
2122#define IS_TIM_TRIGGERPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV1) || \
2123 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV2) || \
2124 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV4) || \
2125 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV8))
2126
2127#define IS_TIM_TRIGGERFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
2128
2129#define IS_TIM_TI1SELECTION(__TI1SELECTION__) (((__TI1SELECTION__) == TIM_TI1SELECTION_CH1) || \
2130 ((__TI1SELECTION__) == TIM_TI1SELECTION_XORCOMBINATION))
2131
2132#define IS_TIM_DMA_LENGTH(__LENGTH__) (((__LENGTH__) == TIM_DMABURSTLENGTH_1TRANSFER) || \
2133 ((__LENGTH__) == TIM_DMABURSTLENGTH_2TRANSFERS) || \
2134 ((__LENGTH__) == TIM_DMABURSTLENGTH_3TRANSFERS) || \
2135 ((__LENGTH__) == TIM_DMABURSTLENGTH_4TRANSFERS) || \
2136 ((__LENGTH__) == TIM_DMABURSTLENGTH_5TRANSFERS) || \
2137 ((__LENGTH__) == TIM_DMABURSTLENGTH_6TRANSFERS) || \
2138 ((__LENGTH__) == TIM_DMABURSTLENGTH_7TRANSFERS) || \
2139 ((__LENGTH__) == TIM_DMABURSTLENGTH_8TRANSFERS) || \
2140 ((__LENGTH__) == TIM_DMABURSTLENGTH_9TRANSFERS) || \
2141 ((__LENGTH__) == TIM_DMABURSTLENGTH_10TRANSFERS) || \
2142 ((__LENGTH__) == TIM_DMABURSTLENGTH_11TRANSFERS) || \
2143 ((__LENGTH__) == TIM_DMABURSTLENGTH_12TRANSFERS) || \
2144 ((__LENGTH__) == TIM_DMABURSTLENGTH_13TRANSFERS) || \
2145 ((__LENGTH__) == TIM_DMABURSTLENGTH_14TRANSFERS) || \
2146 ((__LENGTH__) == TIM_DMABURSTLENGTH_15TRANSFERS) || \
2147 ((__LENGTH__) == TIM_DMABURSTLENGTH_16TRANSFERS) || \
2148 ((__LENGTH__) == TIM_DMABURSTLENGTH_17TRANSFERS) || \
2149 ((__LENGTH__) == TIM_DMABURSTLENGTH_18TRANSFERS))
2150
2151#define IS_TIM_DMA_DATA_LENGTH(LENGTH) (((LENGTH) >= 0x1U) && ((LENGTH) < 0x10000U))
2152
2153#define IS_TIM_IC_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
2154
2155#define IS_TIM_DEADTIME(__DEADTIME__) ((__DEADTIME__) <= 0xFFU)
2156
2157#define IS_TIM_BREAK_SYSTEM(__CONFIG__) (((__CONFIG__) == TIM_BREAK_SYSTEM_ECC) || \
2158 ((__CONFIG__) == TIM_BREAK_SYSTEM_PVD) || \
2159 ((__CONFIG__) == TIM_BREAK_SYSTEM_SRAM_PARITY_ERROR) || \
2160 ((__CONFIG__) == TIM_BREAK_SYSTEM_LOCKUP))
2161
2162#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__) (((__TRIGGER__) == TIM_SLAVEMODE_TRIGGER) || \
2163 ((__TRIGGER__) == TIM_SLAVEMODE_COMBINED_RESETTRIGGER))
2164
2165#define TIM_SET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__, __ICPSC__) \
2166 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= (__ICPSC__)) :\
2167 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= ((__ICPSC__) << 8U)) :\
2168 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= (__ICPSC__)) :\
2169 ((__HANDLE__)->Instance->CCMR2 |= ((__ICPSC__) << 8U)))
2170
2171#define TIM_RESET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__) \
2172 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC) :\
2173 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC) :\
2174 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC) :\
2175 ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC))
2176
2177#define TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \
2178 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER |= (__POLARITY__)) :\
2179 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 4U)) :\
2180 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 8U)) :\
2181 ((__HANDLE__)->Instance->CCER |= (((__POLARITY__) << 12U))))
2182
2183#define TIM_RESET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__) \
2184 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP)) :\
2185 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP)) :\
2186 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC3P | TIM_CCER_CC3NP)) :\
2187 ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC4P | TIM_CCER_CC4NP)))
2188
2189#define TIM_CHANNEL_STATE_GET(__HANDLE__, __CHANNEL__)\
2190 (((__CHANNEL__) == TIM_CHANNEL_1) ? (__HANDLE__)->ChannelState[0] :\
2191 ((__CHANNEL__) == TIM_CHANNEL_2) ? (__HANDLE__)->ChannelState[1] :\
2192 ((__CHANNEL__) == TIM_CHANNEL_3) ? (__HANDLE__)->ChannelState[2] :\
2193 ((__CHANNEL__) == TIM_CHANNEL_4) ? (__HANDLE__)->ChannelState[3] :\
2194 ((__CHANNEL__) == TIM_CHANNEL_5) ? (__HANDLE__)->ChannelState[4] :\
2195 (__HANDLE__)->ChannelState[5])
2196
2197#define TIM_CHANNEL_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__) \
2198 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->ChannelState[0] = (__CHANNEL_STATE__)) :\
2199 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->ChannelState[1] = (__CHANNEL_STATE__)) :\
2200 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->ChannelState[2] = (__CHANNEL_STATE__)) :\
2201 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->ChannelState[3] = (__CHANNEL_STATE__)) :\
2202 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->ChannelState[4] = (__CHANNEL_STATE__)) :\
2203 ((__HANDLE__)->ChannelState[5] = (__CHANNEL_STATE__)))
2204
2205#define TIM_CHANNEL_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__) do { \
2206 (__HANDLE__)->ChannelState[0] = \
2207 (__CHANNEL_STATE__); \
2208 (__HANDLE__)->ChannelState[1] = \
2209 (__CHANNEL_STATE__); \
2210 (__HANDLE__)->ChannelState[2] = \
2211 (__CHANNEL_STATE__); \
2212 (__HANDLE__)->ChannelState[3] = \
2213 (__CHANNEL_STATE__); \
2214 (__HANDLE__)->ChannelState[4] = \
2215 (__CHANNEL_STATE__); \
2216 (__HANDLE__)->ChannelState[5] = \
2217 (__CHANNEL_STATE__); \
2218 } while(0)
2219
2220#define TIM_CHANNEL_N_STATE_GET(__HANDLE__, __CHANNEL__)\
2221 (((__CHANNEL__) == TIM_CHANNEL_1) ? (__HANDLE__)->ChannelNState[0] :\
2222 ((__CHANNEL__) == TIM_CHANNEL_2) ? (__HANDLE__)->ChannelNState[1] :\
2223 ((__CHANNEL__) == TIM_CHANNEL_3) ? (__HANDLE__)->ChannelNState[2] :\
2224 (__HANDLE__)->ChannelNState[3])
2225
2226#define TIM_CHANNEL_N_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__) \
2227 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->ChannelNState[0] = (__CHANNEL_STATE__)) :\
2228 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->ChannelNState[1] = (__CHANNEL_STATE__)) :\
2229 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->ChannelNState[2] = (__CHANNEL_STATE__)) :\
2230 ((__HANDLE__)->ChannelNState[3] = (__CHANNEL_STATE__)))
2231
2232#define TIM_CHANNEL_N_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__) do { \
2233 (__HANDLE__)->ChannelNState[0] = \
2234 (__CHANNEL_STATE__); \
2235 (__HANDLE__)->ChannelNState[1] = \
2236 (__CHANNEL_STATE__); \
2237 (__HANDLE__)->ChannelNState[2] = \
2238 (__CHANNEL_STATE__); \
2239 (__HANDLE__)->ChannelNState[3] = \
2240 (__CHANNEL_STATE__); \
2241 } while(0)
2242
2246/* End of private macros -----------------------------------------------------*/
2247
2248/* Include TIM HAL Extended module */
2249#include "stm32h7xx_hal_tim_ex.h"
2250
2251/* Exported functions --------------------------------------------------------*/
2260/* Time Base functions ********************************************************/
2261HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim);
2262HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim);
2263void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim);
2264void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim);
2265/* Blocking mode: Polling */
2266HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim);
2267HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim);
2268/* Non-Blocking mode: Interrupt */
2269HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim);
2270HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim);
2271/* Non-Blocking mode: DMA */
2272HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, const uint32_t *pData, uint16_t Length);
2273HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim);
2282/* Timer Output Compare functions *********************************************/
2283HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim);
2284HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim);
2285void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim);
2286void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim);
2287/* Blocking mode: Polling */
2288HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2289HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2290/* Non-Blocking mode: Interrupt */
2291HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2292HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2293/* Non-Blocking mode: DMA */
2294HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
2295 uint16_t Length);
2296HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2305/* Timer PWM functions ********************************************************/
2306HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim);
2307HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim);
2308void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim);
2309void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim);
2310/* Blocking mode: Polling */
2311HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2312HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2313/* Non-Blocking mode: Interrupt */
2314HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2315HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2316/* Non-Blocking mode: DMA */
2317HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
2318 uint16_t Length);
2319HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2328/* Timer Input Capture functions **********************************************/
2329HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim);
2330HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim);
2331void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim);
2332void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim);
2333/* Blocking mode: Polling */
2334HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2335HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2336/* Non-Blocking mode: Interrupt */
2337HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2338HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2339/* Non-Blocking mode: DMA */
2340HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
2341HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2350/* Timer One Pulse functions **************************************************/
2351HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode);
2352HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim);
2353void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim);
2354void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim);
2355/* Blocking mode: Polling */
2356HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2357HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2358/* Non-Blocking mode: Interrupt */
2359HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2360HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2369/* Timer Encoder functions ****************************************************/
2370HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, TIM_Encoder_InitTypeDef *sConfig);
2371HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim);
2372void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim);
2373void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim);
2374/* Blocking mode: Polling */
2375HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2376HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2377/* Non-Blocking mode: Interrupt */
2378HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2379HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2380/* Non-Blocking mode: DMA */
2381HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1,
2382 uint32_t *pData2, uint16_t Length);
2383HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2392/* Interrupt Handler functions ***********************************************/
2393void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim);
2403/* Control functions *********************************************************/
2404HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, const TIM_OC_InitTypeDef *sConfig,
2405 uint32_t Channel);
2406HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, const TIM_OC_InitTypeDef *sConfig,
2407 uint32_t Channel);
2408HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, const TIM_IC_InitTypeDef *sConfig,
2409 uint32_t Channel);
2410HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig,
2411 uint32_t OutputChannel, uint32_t InputChannel);
2412HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim,
2413 const TIM_ClearInputConfigTypeDef *sClearInputConfig,
2414 uint32_t Channel);
2415HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, const TIM_ClockConfigTypeDef *sClockSourceConfig);
2416HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection);
2417HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, const TIM_SlaveConfigTypeDef *sSlaveConfig);
2418HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, const TIM_SlaveConfigTypeDef *sSlaveConfig);
2419HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2420 uint32_t BurstRequestSrc, const uint32_t *BurstBuffer, uint32_t BurstLength);
2421HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2422 uint32_t BurstRequestSrc, const uint32_t *BurstBuffer,
2423 uint32_t BurstLength, uint32_t DataLength);
2424HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc);
2425HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2426 uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength);
2427HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2428 uint32_t BurstRequestSrc, uint32_t *BurstBuffer,
2429 uint32_t BurstLength, uint32_t DataLength);
2430HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc);
2431HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource);
2432uint32_t HAL_TIM_ReadCapturedValue(const TIM_HandleTypeDef *htim, uint32_t Channel);
2442/* Callback in non blocking modes (Interrupt and DMA) *************************/
2444void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim);
2445void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim);
2446void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim);
2447void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim);
2448void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim);
2449void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim);
2450void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim);
2451void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim);
2452void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim);
2453
2454/* Callbacks Register/UnRegister functions ***********************************/
2455#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2456HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID,
2457 pTIM_CallbackTypeDef pCallback);
2458HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID);
2459#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2460
2470/* Peripheral State functions ************************************************/
2471HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(const TIM_HandleTypeDef *htim);
2472HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(const TIM_HandleTypeDef *htim);
2473HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(const TIM_HandleTypeDef *htim);
2474HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(const TIM_HandleTypeDef *htim);
2475HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(const TIM_HandleTypeDef *htim);
2476HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(const TIM_HandleTypeDef *htim);
2477
2478/* Peripheral Channel state functions ************************************************/
2479HAL_TIM_ActiveChannel HAL_TIM_GetActiveChannel(const TIM_HandleTypeDef *htim);
2480HAL_TIM_ChannelStateTypeDef HAL_TIM_GetChannelState(const TIM_HandleTypeDef *htim, uint32_t Channel);
2481HAL_TIM_DMABurstStateTypeDef HAL_TIM_DMABurstState(const TIM_HandleTypeDef *htim);
2489/* End of exported functions -------------------------------------------------*/
2490
2491/* Private functions----------------------------------------------------------*/
2496void TIM_Base_SetConfig(TIM_TypeDef *TIMx, const TIM_Base_InitTypeDef *Structure);
2497void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter);
2498void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, const TIM_OC_InitTypeDef *OC_Config);
2499void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler,
2500 uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter);
2501
2502void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma);
2503void TIM_DMAError(DMA_HandleTypeDef *hdma);
2504void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma);
2505void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma);
2506void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState);
2507
2508#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2509void TIM_ResetCallback(TIM_HandleTypeDef *htim);
2510#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2511
2515/* End of private functions --------------------------------------------------*/
2516
2525#ifdef __cplusplus
2526}
2527#endif
2528
2529#endif /* STM32H7xx_HAL_TIM_H */
#define __IO
Definition: core_cm4.h:239
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
Period elapsed callback in non blocking mode.
Definition: stm32h7xx_hal_timebase_tim_template.c:160
HAL_TIM_ChannelStateTypeDef
TIM Channel States definition.
Definition: stm32h7xx_hal_tim.h:322
HAL_TIM_DMABurstStateTypeDef
DMA Burst States definition.
Definition: stm32h7xx_hal_tim.h:332
HAL_TIM_ActiveChannel
HAL Active channel structures definition.
Definition: stm32h7xx_hal_tim.h:342
HAL_TIM_StateTypeDef
HAL State structures definition.
Definition: stm32h7xx_hal_tim.h:310
@ HAL_TIM_CHANNEL_STATE_READY
Definition: stm32h7xx_hal_tim.h:324
@ HAL_TIM_CHANNEL_STATE_RESET
Definition: stm32h7xx_hal_tim.h:323
@ HAL_TIM_CHANNEL_STATE_BUSY
Definition: stm32h7xx_hal_tim.h:325
@ HAL_DMA_BURST_STATE_BUSY
Definition: stm32h7xx_hal_tim.h:335
@ HAL_DMA_BURST_STATE_READY
Definition: stm32h7xx_hal_tim.h:334
@ HAL_DMA_BURST_STATE_RESET
Definition: stm32h7xx_hal_tim.h:333
@ HAL_TIM_ACTIVE_CHANNEL_1
Definition: stm32h7xx_hal_tim.h:343
@ HAL_TIM_ACTIVE_CHANNEL_6
Definition: stm32h7xx_hal_tim.h:348
@ HAL_TIM_ACTIVE_CHANNEL_5
Definition: stm32h7xx_hal_tim.h:347
@ HAL_TIM_ACTIVE_CHANNEL_CLEARED
Definition: stm32h7xx_hal_tim.h:349
@ HAL_TIM_ACTIVE_CHANNEL_4
Definition: stm32h7xx_hal_tim.h:346
@ HAL_TIM_ACTIVE_CHANNEL_3
Definition: stm32h7xx_hal_tim.h:345
@ HAL_TIM_ACTIVE_CHANNEL_2
Definition: stm32h7xx_hal_tim.h:344
@ HAL_TIM_STATE_TIMEOUT
Definition: stm32h7xx_hal_tim.h:314
@ HAL_TIM_STATE_BUSY
Definition: stm32h7xx_hal_tim.h:313
@ HAL_TIM_STATE_RESET
Definition: stm32h7xx_hal_tim.h:311
@ HAL_TIM_STATE_ERROR
Definition: stm32h7xx_hal_tim.h:315
@ HAL_TIM_STATE_READY
Definition: stm32h7xx_hal_tim.h:312
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of TIM HAL Extended module.
TIM Time base Configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:48
uint32_t CounterMode
Definition: stm32h7xx_hal_tim.h:52
uint32_t AutoReloadPreload
Definition: stm32h7xx_hal_tim.h:73
uint32_t Period
Definition: stm32h7xx_hal_tim.h:55
uint32_t RepetitionCounter
Definition: stm32h7xx_hal_tim.h:62
uint32_t ClockDivision
Definition: stm32h7xx_hal_tim.h:59
uint32_t Prescaler
Definition: stm32h7xx_hal_tim.h:49
TIM Break input(s) and Dead time configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:273
uint32_t Break2Filter
Definition: stm32h7xx_hal_tim.h:296
uint32_t OffStateIDLEMode
Definition: stm32h7xx_hal_tim.h:276
uint32_t DeadTime
Definition: stm32h7xx_hal_tim.h:280
uint32_t OffStateRunMode
Definition: stm32h7xx_hal_tim.h:274
uint32_t BreakState
Definition: stm32h7xx_hal_tim.h:282
uint32_t BreakFilter
Definition: stm32h7xx_hal_tim.h:286
uint32_t LockLevel
Definition: stm32h7xx_hal_tim.h:278
uint32_t Break2State
Definition: stm32h7xx_hal_tim.h:292
uint32_t BreakPolarity
Definition: stm32h7xx_hal_tim.h:284
uint32_t AutomaticOutput
Definition: stm32h7xx_hal_tim.h:302
uint32_t Break2Polarity
Definition: stm32h7xx_hal_tim.h:294
TIM Clear Input Configuration Handle Structure definition.
Definition: stm32h7xx_hal_tim.h:215
uint32_t ClearInputState
Definition: stm32h7xx_hal_tim.h:216
uint32_t ClearInputPolarity
Definition: stm32h7xx_hal_tim.h:220
uint32_t ClearInputPrescaler
Definition: stm32h7xx_hal_tim.h:222
uint32_t ClearInputFilter
Definition: stm32h7xx_hal_tim.h:225
uint32_t ClearInputSource
Definition: stm32h7xx_hal_tim.h:218
Clock Configuration Handle Structure definition.
Definition: stm32h7xx_hal_tim.h:200
uint32_t ClockSource
Definition: stm32h7xx_hal_tim.h:201
uint32_t ClockPolarity
Definition: stm32h7xx_hal_tim.h:203
uint32_t ClockFilter
Definition: stm32h7xx_hal_tim.h:207
uint32_t ClockPrescaler
Definition: stm32h7xx_hal_tim.h:205
TIM Encoder Configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:167
uint32_t IC2Filter
Definition: stm32h7xx_hal_tim.h:192
uint32_t IC1Polarity
Definition: stm32h7xx_hal_tim.h:171
uint32_t IC1Filter
Definition: stm32h7xx_hal_tim.h:180
uint32_t IC1Prescaler
Definition: stm32h7xx_hal_tim.h:177
uint32_t IC2Selection
Definition: stm32h7xx_hal_tim.h:186
uint32_t IC1Selection
Definition: stm32h7xx_hal_tim.h:174
uint32_t EncoderMode
Definition: stm32h7xx_hal_tim.h:168
uint32_t IC2Polarity
Definition: stm32h7xx_hal_tim.h:183
uint32_t IC2Prescaler
Definition: stm32h7xx_hal_tim.h:189
TIM Time Base Handle Structure definition.
Definition: stm32h7xx_hal_tim.h:360
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_tim.h:366
__IO HAL_TIM_StateTypeDef State
Definition: stm32h7xx_hal_tim.h:367
TIM_Base_InitTypeDef Init
Definition: stm32h7xx_hal_tim.h:362
__IO HAL_TIM_DMABurstStateTypeDef DMABurstState
Definition: stm32h7xx_hal_tim.h:370
TIM_TypeDef * Instance
Definition: stm32h7xx_hal_tim.h:361
HAL_TIM_ActiveChannel Channel
Definition: stm32h7xx_hal_tim.h:363
TIM Input Capture Configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:149
uint32_t ICPrescaler
Definition: stm32h7xx_hal_tim.h:156
uint32_t ICSelection
Definition: stm32h7xx_hal_tim.h:153
uint32_t ICPolarity
Definition: stm32h7xx_hal_tim.h:150
uint32_t ICFilter
Definition: stm32h7xx_hal_tim.h:159
TIM Master configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:235
uint32_t MasterSlaveMode
Definition: stm32h7xx_hal_tim.h:240
uint32_t MasterOutputTrigger2
Definition: stm32h7xx_hal_tim.h:238
uint32_t MasterOutputTrigger
Definition: stm32h7xx_hal_tim.h:236
TIM Output Compare Configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:81
uint32_t OCNIdleState
Definition: stm32h7xx_hal_tim.h:104
uint32_t OCNPolarity
Definition: stm32h7xx_hal_tim.h:91
uint32_t OCFastMode
Definition: stm32h7xx_hal_tim.h:95
uint32_t OCPolarity
Definition: stm32h7xx_hal_tim.h:88
uint32_t Pulse
Definition: stm32h7xx_hal_tim.h:85
uint32_t OCIdleState
Definition: stm32h7xx_hal_tim.h:100
uint32_t OCMode
Definition: stm32h7xx_hal_tim.h:82
TIM One Pulse Mode Configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:113
uint32_t OCNPolarity
Definition: stm32h7xx_hal_tim.h:123
uint32_t OCPolarity
Definition: stm32h7xx_hal_tim.h:120
uint32_t OCNIdleState
Definition: stm32h7xx_hal_tim.h:131
uint32_t Pulse
Definition: stm32h7xx_hal_tim.h:117
uint32_t ICPolarity
Definition: stm32h7xx_hal_tim.h:135
uint32_t ICFilter
Definition: stm32h7xx_hal_tim.h:141
uint32_t ICSelection
Definition: stm32h7xx_hal_tim.h:138
uint32_t OCIdleState
Definition: stm32h7xx_hal_tim.h:127
uint32_t OCMode
Definition: stm32h7xx_hal_tim.h:114
TIM Slave configuration Structure definition.
Definition: stm32h7xx_hal_tim.h:253
uint32_t TriggerFilter
Definition: stm32h7xx_hal_tim.h:262
uint32_t SlaveMode
Definition: stm32h7xx_hal_tim.h:254
uint32_t TriggerPrescaler
Definition: stm32h7xx_hal_tim.h:260
uint32_t InputTrigger
Definition: stm32h7xx_hal_tim.h:256
uint32_t TriggerPolarity
Definition: stm32h7xx_hal_tim.h:258
TIM.
Definition: stm32h723xx.h:1525
DMA handle Structure definition.
Definition: stm32h7xx_hal_dma.h:138