RTEMS 6.1-rc5
Loading...
Searching...
No Matches
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
428 , HAL_TIM_IC_CAPTURE_CB_ID = 0x12U
429 , HAL_TIM_IC_CAPTURE_HALF_CB_ID = 0x13U
430 , HAL_TIM_OC_DELAY_ELAPSED_CB_ID = 0x14U
431 , HAL_TIM_PWM_PULSE_FINISHED_CB_ID = 0x15U
432 , HAL_TIM_PWM_PULSE_FINISHED_HALF_CB_ID = 0x16U
433 , HAL_TIM_ERROR_CB_ID = 0x17U
434 , HAL_TIM_COMMUTATION_CB_ID = 0x18U
435 , HAL_TIM_COMMUTATION_HALF_CB_ID = 0x19U
436 , HAL_TIM_BREAK_CB_ID = 0x1AU
437 , HAL_TIM_BREAK2_CB_ID = 0x1BU
438} HAL_TIM_CallbackIDTypeDef;
439
443typedef void (*pTIM_CallbackTypeDef)(TIM_HandleTypeDef *htim);
445#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
446
450/* End of exported types -----------------------------------------------------*/
451
452/* Exported constants --------------------------------------------------------*/
462#define TIM_CLEARINPUTSOURCE_NONE 0x00000000U
463#define TIM_CLEARINPUTSOURCE_ETR 0x00000001U
472#define TIM_DMABASE_CR1 0x00000000U
473#define TIM_DMABASE_CR2 0x00000001U
474#define TIM_DMABASE_SMCR 0x00000002U
475#define TIM_DMABASE_DIER 0x00000003U
476#define TIM_DMABASE_SR 0x00000004U
477#define TIM_DMABASE_EGR 0x00000005U
478#define TIM_DMABASE_CCMR1 0x00000006U
479#define TIM_DMABASE_CCMR2 0x00000007U
480#define TIM_DMABASE_CCER 0x00000008U
481#define TIM_DMABASE_CNT 0x00000009U
482#define TIM_DMABASE_PSC 0x0000000AU
483#define TIM_DMABASE_ARR 0x0000000BU
484#define TIM_DMABASE_RCR 0x0000000CU
485#define TIM_DMABASE_CCR1 0x0000000DU
486#define TIM_DMABASE_CCR2 0x0000000EU
487#define TIM_DMABASE_CCR3 0x0000000FU
488#define TIM_DMABASE_CCR4 0x00000010U
489#define TIM_DMABASE_BDTR 0x00000011U
490#define TIM_DMABASE_DCR 0x00000012U
491#define TIM_DMABASE_DMAR 0x00000013U
492#define TIM_DMABASE_CCMR3 0x00000015U
493#define TIM_DMABASE_CCR5 0x00000016U
494#define TIM_DMABASE_CCR6 0x00000017U
495#if defined(TIM_BREAK_INPUT_SUPPORT)
496#define TIM_DMABASE_AF1 0x00000018U
497#define TIM_DMABASE_AF2 0x00000019U
498#endif /* TIM_BREAK_INPUT_SUPPORT */
499#define TIM_DMABASE_TISEL 0x0000001AU
508#define TIM_EVENTSOURCE_UPDATE TIM_EGR_UG
509#define TIM_EVENTSOURCE_CC1 TIM_EGR_CC1G
510#define TIM_EVENTSOURCE_CC2 TIM_EGR_CC2G
511#define TIM_EVENTSOURCE_CC3 TIM_EGR_CC3G
512#define TIM_EVENTSOURCE_CC4 TIM_EGR_CC4G
513#define TIM_EVENTSOURCE_COM TIM_EGR_COMG
514#define TIM_EVENTSOURCE_TRIGGER TIM_EGR_TG
515#define TIM_EVENTSOURCE_BREAK TIM_EGR_BG
516#define TIM_EVENTSOURCE_BREAK2 TIM_EGR_B2G
525#define TIM_INPUTCHANNELPOLARITY_RISING 0x00000000U
526#define TIM_INPUTCHANNELPOLARITY_FALLING TIM_CCER_CC1P
527#define TIM_INPUTCHANNELPOLARITY_BOTHEDGE (TIM_CCER_CC1P | TIM_CCER_CC1NP)
536#define TIM_ETRPOLARITY_INVERTED TIM_SMCR_ETP
537#define TIM_ETRPOLARITY_NONINVERTED 0x00000000U
546#define TIM_ETRPRESCALER_DIV1 0x00000000U
547#define TIM_ETRPRESCALER_DIV2 TIM_SMCR_ETPS_0
548#define TIM_ETRPRESCALER_DIV4 TIM_SMCR_ETPS_1
549#define TIM_ETRPRESCALER_DIV8 TIM_SMCR_ETPS
558#define TIM_COUNTERMODE_UP 0x00000000U
559#define TIM_COUNTERMODE_DOWN TIM_CR1_DIR
560#define TIM_COUNTERMODE_CENTERALIGNED1 TIM_CR1_CMS_0
561#define TIM_COUNTERMODE_CENTERALIGNED2 TIM_CR1_CMS_1
562#define TIM_COUNTERMODE_CENTERALIGNED3 TIM_CR1_CMS
571#define TIM_UIFREMAP_DISABLE 0x00000000U
572#define TIM_UIFREMAP_ENABLE TIM_CR1_UIFREMAP
581#define TIM_CLOCKDIVISION_DIV1 0x00000000U
582#define TIM_CLOCKDIVISION_DIV2 TIM_CR1_CKD_0
583#define TIM_CLOCKDIVISION_DIV4 TIM_CR1_CKD_1
592#define TIM_OUTPUTSTATE_DISABLE 0x00000000U
593#define TIM_OUTPUTSTATE_ENABLE TIM_CCER_CC1E
602#define TIM_AUTORELOAD_PRELOAD_DISABLE 0x00000000U
603#define TIM_AUTORELOAD_PRELOAD_ENABLE TIM_CR1_ARPE
613#define TIM_OCFAST_DISABLE 0x00000000U
614#define TIM_OCFAST_ENABLE TIM_CCMR1_OC1FE
623#define TIM_OUTPUTNSTATE_DISABLE 0x00000000U
624#define TIM_OUTPUTNSTATE_ENABLE TIM_CCER_CC1NE
633#define TIM_OCPOLARITY_HIGH 0x00000000U
634#define TIM_OCPOLARITY_LOW TIM_CCER_CC1P
643#define TIM_OCNPOLARITY_HIGH 0x00000000U
644#define TIM_OCNPOLARITY_LOW TIM_CCER_CC1NP
653#define TIM_OCIDLESTATE_SET TIM_CR2_OIS1
654#define TIM_OCIDLESTATE_RESET 0x00000000U
663#define TIM_OCNIDLESTATE_SET TIM_CR2_OIS1N
664#define TIM_OCNIDLESTATE_RESET 0x00000000U
673#define TIM_ICPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
674#define TIM_ICPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
675#define TIM_ICPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
684#define TIM_ENCODERINPUTPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
685#define TIM_ENCODERINPUTPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
694#define TIM_ICSELECTION_DIRECTTI TIM_CCMR1_CC1S_0
695#define TIM_ICSELECTION_INDIRECTTI TIM_CCMR1_CC1S_1
696#define TIM_ICSELECTION_TRC TIM_CCMR1_CC1S
705#define TIM_ICPSC_DIV1 0x00000000U
706#define TIM_ICPSC_DIV2 TIM_CCMR1_IC1PSC_0
707#define TIM_ICPSC_DIV4 TIM_CCMR1_IC1PSC_1
708#define TIM_ICPSC_DIV8 TIM_CCMR1_IC1PSC
717#define TIM_OPMODE_SINGLE TIM_CR1_OPM
718#define TIM_OPMODE_REPETITIVE 0x00000000U
727#define TIM_ENCODERMODE_TI1 TIM_SMCR_SMS_0
728#define TIM_ENCODERMODE_TI2 TIM_SMCR_SMS_1
729#define TIM_ENCODERMODE_TI12 (TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0)
738#define TIM_IT_UPDATE TIM_DIER_UIE
739#define TIM_IT_CC1 TIM_DIER_CC1IE
740#define TIM_IT_CC2 TIM_DIER_CC2IE
741#define TIM_IT_CC3 TIM_DIER_CC3IE
742#define TIM_IT_CC4 TIM_DIER_CC4IE
743#define TIM_IT_COM TIM_DIER_COMIE
744#define TIM_IT_TRIGGER TIM_DIER_TIE
745#define TIM_IT_BREAK TIM_DIER_BIE
754#define TIM_COMMUTATION_TRGI TIM_CR2_CCUS
755#define TIM_COMMUTATION_SOFTWARE 0x00000000U
764#define TIM_DMA_UPDATE TIM_DIER_UDE
765#define TIM_DMA_CC1 TIM_DIER_CC1DE
766#define TIM_DMA_CC2 TIM_DIER_CC2DE
767#define TIM_DMA_CC3 TIM_DIER_CC3DE
768#define TIM_DMA_CC4 TIM_DIER_CC4DE
769#define TIM_DMA_COM TIM_DIER_COMDE
770#define TIM_DMA_TRIGGER TIM_DIER_TDE
779#define TIM_CCDMAREQUEST_CC 0x00000000U
780#define TIM_CCDMAREQUEST_UPDATE TIM_CR2_CCDS
789#define TIM_FLAG_UPDATE TIM_SR_UIF
790#define TIM_FLAG_CC1 TIM_SR_CC1IF
791#define TIM_FLAG_CC2 TIM_SR_CC2IF
792#define TIM_FLAG_CC3 TIM_SR_CC3IF
793#define TIM_FLAG_CC4 TIM_SR_CC4IF
794#define TIM_FLAG_CC5 TIM_SR_CC5IF
795#define TIM_FLAG_CC6 TIM_SR_CC6IF
796#define TIM_FLAG_COM TIM_SR_COMIF
797#define TIM_FLAG_TRIGGER TIM_SR_TIF
798#define TIM_FLAG_BREAK TIM_SR_BIF
799#define TIM_FLAG_BREAK2 TIM_SR_B2IF
800#define TIM_FLAG_SYSTEM_BREAK TIM_SR_SBIF
801#define TIM_FLAG_CC1OF TIM_SR_CC1OF
802#define TIM_FLAG_CC2OF TIM_SR_CC2OF
803#define TIM_FLAG_CC3OF TIM_SR_CC3OF
804#define TIM_FLAG_CC4OF TIM_SR_CC4OF
813#define TIM_CHANNEL_1 0x00000000U
814#define TIM_CHANNEL_2 0x00000004U
815#define TIM_CHANNEL_3 0x00000008U
816#define TIM_CHANNEL_4 0x0000000CU
817#define TIM_CHANNEL_5 0x00000010U
818#define TIM_CHANNEL_6 0x00000014U
819#define TIM_CHANNEL_ALL 0x0000003CU
828#define TIM_CLOCKSOURCE_INTERNAL TIM_SMCR_ETPS_0
829#define TIM_CLOCKSOURCE_ETRMODE1 TIM_TS_ETRF
830#define TIM_CLOCKSOURCE_ETRMODE2 TIM_SMCR_ETPS_1
831#define TIM_CLOCKSOURCE_TI1ED TIM_TS_TI1F_ED
832#define TIM_CLOCKSOURCE_TI1 TIM_TS_TI1FP1
833#define TIM_CLOCKSOURCE_TI2 TIM_TS_TI2FP2
834#define TIM_CLOCKSOURCE_ITR0 TIM_TS_ITR0
835#define TIM_CLOCKSOURCE_ITR1 TIM_TS_ITR1
836#define TIM_CLOCKSOURCE_ITR2 TIM_TS_ITR2
837#define TIM_CLOCKSOURCE_ITR3 TIM_TS_ITR3
838#define TIM_CLOCKSOURCE_ITR4 TIM_TS_ITR4
839#define TIM_CLOCKSOURCE_ITR5 TIM_TS_ITR5
840#define TIM_CLOCKSOURCE_ITR6 TIM_TS_ITR6
841#define TIM_CLOCKSOURCE_ITR7 TIM_TS_ITR7
842#define TIM_CLOCKSOURCE_ITR8 TIM_TS_ITR8
851#define TIM_CLOCKPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED
852#define TIM_CLOCKPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED
853#define TIM_CLOCKPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
854#define TIM_CLOCKPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
855#define TIM_CLOCKPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
864#define TIM_CLOCKPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1
865#define TIM_CLOCKPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2
866#define TIM_CLOCKPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4
867#define TIM_CLOCKPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8
876#define TIM_CLEARINPUTPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED
877#define TIM_CLEARINPUTPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED
886#define TIM_CLEARINPUTPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1
887#define TIM_CLEARINPUTPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2
888#define TIM_CLEARINPUTPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4
889#define TIM_CLEARINPUTPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8
898#define TIM_OSSR_ENABLE TIM_BDTR_OSSR
899#define TIM_OSSR_DISABLE 0x00000000U
908#define TIM_OSSI_ENABLE TIM_BDTR_OSSI
909#define TIM_OSSI_DISABLE 0x00000000U
917#define TIM_LOCKLEVEL_OFF 0x00000000U
918#define TIM_LOCKLEVEL_1 TIM_BDTR_LOCK_0
919#define TIM_LOCKLEVEL_2 TIM_BDTR_LOCK_1
920#define TIM_LOCKLEVEL_3 TIM_BDTR_LOCK
929#define TIM_BREAK_ENABLE TIM_BDTR_BKE
930#define TIM_BREAK_DISABLE 0x00000000U
939#define TIM_BREAKPOLARITY_LOW 0x00000000U
940#define TIM_BREAKPOLARITY_HIGH TIM_BDTR_BKP
944#if defined(TIM_BDTR_BKBID)
945
950#define TIM_BREAK_AFMODE_INPUT 0x00000000U
951#define TIM_BREAK_AFMODE_BIDIRECTIONAL TIM_BDTR_BKBID
955#endif /*TIM_BDTR_BKBID */
956
961#define TIM_BREAK2_DISABLE 0x00000000U
962#define TIM_BREAK2_ENABLE TIM_BDTR_BK2E
971#define TIM_BREAK2POLARITY_LOW 0x00000000U
972#define TIM_BREAK2POLARITY_HIGH TIM_BDTR_BK2P
976#if defined(TIM_BDTR_BKBID)
977
982#define TIM_BREAK2_AFMODE_INPUT 0x00000000U
983#define TIM_BREAK2_AFMODE_BIDIRECTIONAL TIM_BDTR_BK2BID
987#endif /* TIM_BDTR_BKBID */
988
993#define TIM_AUTOMATICOUTPUT_DISABLE 0x00000000U
994#define TIM_AUTOMATICOUTPUT_ENABLE TIM_BDTR_AOE
1003#define TIM_GROUPCH5_NONE 0x00000000U
1004#define TIM_GROUPCH5_OC1REFC TIM_CCR5_GC5C1
1005#define TIM_GROUPCH5_OC2REFC TIM_CCR5_GC5C2
1006#define TIM_GROUPCH5_OC3REFC TIM_CCR5_GC5C3
1015#define TIM_TRGO_RESET 0x00000000U
1016#define TIM_TRGO_ENABLE TIM_CR2_MMS_0
1017#define TIM_TRGO_UPDATE TIM_CR2_MMS_1
1018#define TIM_TRGO_OC1 (TIM_CR2_MMS_1 | TIM_CR2_MMS_0)
1019#define TIM_TRGO_OC1REF TIM_CR2_MMS_2
1020#define TIM_TRGO_OC2REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_0)
1021#define TIM_TRGO_OC3REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1)
1022#define TIM_TRGO_OC4REF (TIM_CR2_MMS_2 | TIM_CR2_MMS_1 | TIM_CR2_MMS_0)
1031#define TIM_TRGO2_RESET 0x00000000U
1032#define TIM_TRGO2_ENABLE TIM_CR2_MMS2_0
1033#define TIM_TRGO2_UPDATE TIM_CR2_MMS2_1
1034#define TIM_TRGO2_OC1 (TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1035#define TIM_TRGO2_OC1REF TIM_CR2_MMS2_2
1036#define TIM_TRGO2_OC2REF (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_0)
1037#define TIM_TRGO2_OC3REF (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1)
1038#define TIM_TRGO2_OC4REF (TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1039#define TIM_TRGO2_OC5REF TIM_CR2_MMS2_3
1040#define TIM_TRGO2_OC6REF (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_0)
1041#define TIM_TRGO2_OC4REF_RISINGFALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_1)
1042#define TIM_TRGO2_OC6REF_RISINGFALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1043#define TIM_TRGO2_OC4REF_RISING_OC6REF_RISING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2)
1044#define TIM_TRGO2_OC4REF_RISING_OC6REF_FALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 | TIM_CR2_MMS2_0)
1045#define TIM_TRGO2_OC5REF_RISING_OC6REF_RISING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 |TIM_CR2_MMS2_1)
1046#define TIM_TRGO2_OC5REF_RISING_OC6REF_FALLING (TIM_CR2_MMS2_3 | TIM_CR2_MMS2_2 | TIM_CR2_MMS2_1 | TIM_CR2_MMS2_0)
1055#define TIM_MASTERSLAVEMODE_ENABLE TIM_SMCR_MSM
1056#define TIM_MASTERSLAVEMODE_DISABLE 0x00000000U
1065#define TIM_SLAVEMODE_DISABLE 0x00000000U
1066#define TIM_SLAVEMODE_RESET TIM_SMCR_SMS_2
1067#define TIM_SLAVEMODE_GATED (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_0)
1068#define TIM_SLAVEMODE_TRIGGER (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1)
1069#define TIM_SLAVEMODE_EXTERNAL1 (TIM_SMCR_SMS_2 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_0)
1070#define TIM_SLAVEMODE_COMBINED_RESETTRIGGER TIM_SMCR_SMS_3
1079#define TIM_OCMODE_TIMING 0x00000000U
1080#define TIM_OCMODE_ACTIVE TIM_CCMR1_OC1M_0
1081#define TIM_OCMODE_INACTIVE TIM_CCMR1_OC1M_1
1082#define TIM_OCMODE_TOGGLE (TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0)
1083#define TIM_OCMODE_PWM1 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1)
1084#define TIM_OCMODE_PWM2 (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_0)
1085#define TIM_OCMODE_FORCED_ACTIVE (TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC1M_0)
1086#define TIM_OCMODE_FORCED_INACTIVE TIM_CCMR1_OC1M_2
1087#define TIM_OCMODE_RETRIGERRABLE_OPM1 TIM_CCMR1_OC1M_3
1088#define TIM_OCMODE_RETRIGERRABLE_OPM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0)
1089#define TIM_OCMODE_COMBINED_PWM1 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_2)
1090#define TIM_OCMODE_COMBINED_PWM2 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_0 | TIM_CCMR1_OC1M_2)
1091#define TIM_OCMODE_ASYMMETRIC_PWM1 (TIM_CCMR1_OC1M_3 | TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2)
1092#define TIM_OCMODE_ASYMMETRIC_PWM2 TIM_CCMR1_OC1M
1101#define TIM_TS_ITR0 0x00000000U
1102#define TIM_TS_ITR1 TIM_SMCR_TS_0
1103#define TIM_TS_ITR2 TIM_SMCR_TS_1
1104#define TIM_TS_ITR3 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1)
1105#define TIM_TS_ITR4 (TIM_SMCR_TS_3)
1106#define TIM_TS_ITR5 (TIM_SMCR_TS_0 | TIM_SMCR_TS_3)
1107#define TIM_TS_ITR6 (TIM_SMCR_TS_1 | TIM_SMCR_TS_3)
1108#define TIM_TS_ITR7 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_3)
1109#define TIM_TS_ITR8 (TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1110#define TIM_TS_ITR9 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1111#define TIM_TS_ITR10 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1112#define TIM_TS_ITR11 (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2 | TIM_SMCR_TS_3)
1113#define TIM_TS_ITR12 (TIM_SMCR_TS_4)
1114#define TIM_TS_ITR13 (TIM_SMCR_TS_0 | TIM_SMCR_TS_4)
1115#define TIM_TS_TI1F_ED TIM_SMCR_TS_2
1116#define TIM_TS_TI1FP1 (TIM_SMCR_TS_0 | TIM_SMCR_TS_2)
1117#define TIM_TS_TI2FP2 (TIM_SMCR_TS_1 | TIM_SMCR_TS_2)
1118#define TIM_TS_ETRF (TIM_SMCR_TS_0 | TIM_SMCR_TS_1 | TIM_SMCR_TS_2)
1119#define TIM_TS_NONE 0x0000FFFFU
1128#define TIM_TRIGGERPOLARITY_INVERTED TIM_ETRPOLARITY_INVERTED
1129#define TIM_TRIGGERPOLARITY_NONINVERTED TIM_ETRPOLARITY_NONINVERTED
1130#define TIM_TRIGGERPOLARITY_RISING TIM_INPUTCHANNELPOLARITY_RISING
1131#define TIM_TRIGGERPOLARITY_FALLING TIM_INPUTCHANNELPOLARITY_FALLING
1132#define TIM_TRIGGERPOLARITY_BOTHEDGE TIM_INPUTCHANNELPOLARITY_BOTHEDGE
1141#define TIM_TRIGGERPRESCALER_DIV1 TIM_ETRPRESCALER_DIV1
1142#define TIM_TRIGGERPRESCALER_DIV2 TIM_ETRPRESCALER_DIV2
1143#define TIM_TRIGGERPRESCALER_DIV4 TIM_ETRPRESCALER_DIV4
1144#define TIM_TRIGGERPRESCALER_DIV8 TIM_ETRPRESCALER_DIV8
1153#define TIM_TI1SELECTION_CH1 0x00000000U
1154#define TIM_TI1SELECTION_XORCOMBINATION TIM_CR2_TI1S
1163#define TIM_DMABURSTLENGTH_1TRANSFER 0x00000000U
1164#define TIM_DMABURSTLENGTH_2TRANSFERS 0x00000100U
1165#define TIM_DMABURSTLENGTH_3TRANSFERS 0x00000200U
1166#define TIM_DMABURSTLENGTH_4TRANSFERS 0x00000300U
1167#define TIM_DMABURSTLENGTH_5TRANSFERS 0x00000400U
1168#define TIM_DMABURSTLENGTH_6TRANSFERS 0x00000500U
1169#define TIM_DMABURSTLENGTH_7TRANSFERS 0x00000600U
1170#define TIM_DMABURSTLENGTH_8TRANSFERS 0x00000700U
1171#define TIM_DMABURSTLENGTH_9TRANSFERS 0x00000800U
1172#define TIM_DMABURSTLENGTH_10TRANSFERS 0x00000900U
1173#define TIM_DMABURSTLENGTH_11TRANSFERS 0x00000A00U
1174#define TIM_DMABURSTLENGTH_12TRANSFERS 0x00000B00U
1175#define TIM_DMABURSTLENGTH_13TRANSFERS 0x00000C00U
1176#define TIM_DMABURSTLENGTH_14TRANSFERS 0x00000D00U
1177#define TIM_DMABURSTLENGTH_15TRANSFERS 0x00000E00U
1178#define TIM_DMABURSTLENGTH_16TRANSFERS 0x00000F00U
1179#define TIM_DMABURSTLENGTH_17TRANSFERS 0x00001000U
1180#define TIM_DMABURSTLENGTH_18TRANSFERS 0x00001100U
1189#define TIM_DMA_ID_UPDATE ((uint16_t) 0x0000)
1190#define TIM_DMA_ID_CC1 ((uint16_t) 0x0001)
1191#define TIM_DMA_ID_CC2 ((uint16_t) 0x0002)
1192#define TIM_DMA_ID_CC3 ((uint16_t) 0x0003)
1193#define TIM_DMA_ID_CC4 ((uint16_t) 0x0004)
1194#define TIM_DMA_ID_COMMUTATION ((uint16_t) 0x0005)
1195#define TIM_DMA_ID_TRIGGER ((uint16_t) 0x0006)
1204#define TIM_CCx_ENABLE 0x00000001U
1205#define TIM_CCx_DISABLE 0x00000000U
1206#define TIM_CCxN_ENABLE 0x00000004U
1207#define TIM_CCxN_DISABLE 0x00000000U
1216#define TIM_BREAK_SYSTEM_ECC SYSCFG_CFGR2_ECCL
1217#define TIM_BREAK_SYSTEM_PVD SYSCFG_CFGR2_PVDL
1218#define TIM_BREAK_SYSTEM_SRAM_PARITY_ERROR SYSCFG_CFGR2_SPL
1219#define TIM_BREAK_SYSTEM_LOCKUP SYSCFG_CFGR2_CLL
1227/* End of exported constants -------------------------------------------------*/
1228
1229/* Exported macros -----------------------------------------------------------*/
1239#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
1240#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \
1241 (__HANDLE__)->State = HAL_TIM_STATE_RESET; \
1242 (__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1243 (__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1244 (__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1245 (__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1246 (__HANDLE__)->ChannelState[4] = HAL_TIM_CHANNEL_STATE_RESET; \
1247 (__HANDLE__)->ChannelState[5] = HAL_TIM_CHANNEL_STATE_RESET; \
1248 (__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1249 (__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1250 (__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1251 (__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1252 (__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \
1253 (__HANDLE__)->Base_MspInitCallback = NULL; \
1254 (__HANDLE__)->Base_MspDeInitCallback = NULL; \
1255 (__HANDLE__)->IC_MspInitCallback = NULL; \
1256 (__HANDLE__)->IC_MspDeInitCallback = NULL; \
1257 (__HANDLE__)->OC_MspInitCallback = NULL; \
1258 (__HANDLE__)->OC_MspDeInitCallback = NULL; \
1259 (__HANDLE__)->PWM_MspInitCallback = NULL; \
1260 (__HANDLE__)->PWM_MspDeInitCallback = NULL; \
1261 (__HANDLE__)->OnePulse_MspInitCallback = NULL; \
1262 (__HANDLE__)->OnePulse_MspDeInitCallback = NULL; \
1263 (__HANDLE__)->Encoder_MspInitCallback = NULL; \
1264 (__HANDLE__)->Encoder_MspDeInitCallback = NULL; \
1265 (__HANDLE__)->HallSensor_MspInitCallback = NULL; \
1266 (__HANDLE__)->HallSensor_MspDeInitCallback = NULL; \
1267 } while(0)
1268#else
1269#define __HAL_TIM_RESET_HANDLE_STATE(__HANDLE__) do { \
1270 (__HANDLE__)->State = HAL_TIM_STATE_RESET; \
1271 (__HANDLE__)->ChannelState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1272 (__HANDLE__)->ChannelState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1273 (__HANDLE__)->ChannelState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1274 (__HANDLE__)->ChannelState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1275 (__HANDLE__)->ChannelState[4] = HAL_TIM_CHANNEL_STATE_RESET; \
1276 (__HANDLE__)->ChannelState[5] = HAL_TIM_CHANNEL_STATE_RESET; \
1277 (__HANDLE__)->ChannelNState[0] = HAL_TIM_CHANNEL_STATE_RESET; \
1278 (__HANDLE__)->ChannelNState[1] = HAL_TIM_CHANNEL_STATE_RESET; \
1279 (__HANDLE__)->ChannelNState[2] = HAL_TIM_CHANNEL_STATE_RESET; \
1280 (__HANDLE__)->ChannelNState[3] = HAL_TIM_CHANNEL_STATE_RESET; \
1281 (__HANDLE__)->DMABurstState = HAL_DMA_BURST_STATE_RESET; \
1282 } while(0)
1283#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
1284
1290#define __HAL_TIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|=(TIM_CR1_CEN))
1291
1297#define __HAL_TIM_MOE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->BDTR|=(TIM_BDTR_MOE))
1298
1304#define __HAL_TIM_DISABLE(__HANDLE__) \
1305 do { \
1306 if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \
1307 { \
1308 if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \
1309 { \
1310 (__HANDLE__)->Instance->CR1 &= ~(TIM_CR1_CEN); \
1311 } \
1312 } \
1313 } while(0)
1314
1322#define __HAL_TIM_MOE_DISABLE(__HANDLE__) \
1323 do { \
1324 if (((__HANDLE__)->Instance->CCER & TIM_CCER_CCxE_MASK) == 0UL) \
1325 { \
1326 if(((__HANDLE__)->Instance->CCER & TIM_CCER_CCxNE_MASK) == 0UL) \
1327 { \
1328 (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE); \
1329 } \
1330 } \
1331 } while(0)
1332
1339#define __HAL_TIM_MOE_DISABLE_UNCONDITIONALLY(__HANDLE__) (__HANDLE__)->Instance->BDTR &= ~(TIM_BDTR_MOE)
1340
1355#define __HAL_TIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER |= (__INTERRUPT__))
1356
1371#define __HAL_TIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DIER &= ~(__INTERRUPT__))
1372
1386#define __HAL_TIM_ENABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER |= (__DMA__))
1387
1401#define __HAL_TIM_DISABLE_DMA(__HANDLE__, __DMA__) ((__HANDLE__)->Instance->DIER &= ~(__DMA__))
1402
1425#define __HAL_TIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__))
1426
1449#define __HAL_TIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR = ~(__FLAG__))
1450
1466#define __HAL_TIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->DIER & (__INTERRUPT__)) \
1467 == (__INTERRUPT__)) ? SET : RESET)
1468
1483#define __HAL_TIM_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->SR = ~(__INTERRUPT__))
1484
1493#define __HAL_TIM_UIFREMAP_ENABLE(__HANDLE__) (((__HANDLE__)->Instance->CR1 |= TIM_CR1_UIFREMAP))
1494
1501#define __HAL_TIM_UIFREMAP_DISABLE(__HANDLE__) (((__HANDLE__)->Instance->CR1 &= ~TIM_CR1_UIFREMAP))
1502
1509#define __HAL_TIM_GET_UIFCPY(__COUNTER__) (((__COUNTER__) & (TIM_CNT_UIFCPY)) == (TIM_CNT_UIFCPY))
1510
1518#define __HAL_TIM_IS_TIM_COUNTING_DOWN(__HANDLE__) (((__HANDLE__)->Instance->CR1 &(TIM_CR1_DIR)) == (TIM_CR1_DIR))
1519
1526#define __HAL_TIM_SET_PRESCALER(__HANDLE__, __PRESC__) ((__HANDLE__)->Instance->PSC = (__PRESC__))
1527
1537#define __HAL_TIM_SET_COUNTER(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CNT = (__COUNTER__))
1538
1544#define __HAL_TIM_GET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CNT)
1545
1552#define __HAL_TIM_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__) \
1553 do{ \
1554 (__HANDLE__)->Instance->ARR = (__AUTORELOAD__); \
1555 (__HANDLE__)->Init.Period = (__AUTORELOAD__); \
1556 } while(0)
1557
1563#define __HAL_TIM_GET_AUTORELOAD(__HANDLE__) ((__HANDLE__)->Instance->ARR)
1564
1575#define __HAL_TIM_SET_CLOCKDIVISION(__HANDLE__, __CKD__) \
1576 do{ \
1577 (__HANDLE__)->Instance->CR1 &= (~TIM_CR1_CKD); \
1578 (__HANDLE__)->Instance->CR1 |= (__CKD__); \
1579 (__HANDLE__)->Init.ClockDivision = (__CKD__); \
1580 } while(0)
1581
1590#define __HAL_TIM_GET_CLOCKDIVISION(__HANDLE__) ((__HANDLE__)->Instance->CR1 & TIM_CR1_CKD)
1591
1610#define __HAL_TIM_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__) \
1611 do{ \
1612 TIM_RESET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__)); \
1613 TIM_SET_ICPRESCALERVALUE((__HANDLE__), (__CHANNEL__), (__ICPSC__)); \
1614 } while(0)
1615
1631#define __HAL_TIM_GET_ICPRESCALER(__HANDLE__, __CHANNEL__) \
1632 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC1PSC) :\
1633 ((__CHANNEL__) == TIM_CHANNEL_2) ? (((__HANDLE__)->Instance->CCMR1 & TIM_CCMR1_IC2PSC) >> 8U) :\
1634 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC3PSC) :\
1635 (((__HANDLE__)->Instance->CCMR2 & TIM_CCMR2_IC4PSC)) >> 8U)
1636
1651#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__) \
1652 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1 = (__COMPARE__)) :\
1653 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2 = (__COMPARE__)) :\
1654 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3 = (__COMPARE__)) :\
1655 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCR4 = (__COMPARE__)) :\
1656 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCR5 = (__COMPARE__)) :\
1657 ((__HANDLE__)->Instance->CCR6 = (__COMPARE__)))
1658
1672#define __HAL_TIM_GET_COMPARE(__HANDLE__, __CHANNEL__) \
1673 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1) :\
1674 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2) :\
1675 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3) :\
1676 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCR4) :\
1677 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCR5) :\
1678 ((__HANDLE__)->Instance->CCR6))
1679
1693#define __HAL_TIM_ENABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \
1694 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1PE) :\
1695 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2PE) :\
1696 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3PE) :\
1697 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4PE) :\
1698 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC5PE) :\
1699 ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC6PE))
1700
1714#define __HAL_TIM_DISABLE_OCxPRELOAD(__HANDLE__, __CHANNEL__) \
1715 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1PE) :\
1716 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2PE) :\
1717 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3PE) :\
1718 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4PE) :\
1719 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC5PE) :\
1720 ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC6PE))
1721
1739#define __HAL_TIM_ENABLE_OCxFAST(__HANDLE__, __CHANNEL__) \
1740 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC1FE) :\
1741 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= TIM_CCMR1_OC2FE) :\
1742 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC3FE) :\
1743 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 |= TIM_CCMR2_OC4FE) :\
1744 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC5FE) :\
1745 ((__HANDLE__)->Instance->CCMR3 |= TIM_CCMR3_OC6FE))
1746
1764#define __HAL_TIM_DISABLE_OCxFAST(__HANDLE__, __CHANNEL__) \
1765 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC1FE) :\
1766 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_OC2FE) :\
1767 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC3FE) :\
1768 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_OC4FE) :\
1769 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC5FE) :\
1770 ((__HANDLE__)->Instance->CCMR3 &= ~TIM_CCMR3_OC6FE))
1771
1780#define __HAL_TIM_URS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1|= TIM_CR1_URS)
1781
1793#define __HAL_TIM_URS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1&=~TIM_CR1_URS)
1794
1810#define __HAL_TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \
1811 do{ \
1812 TIM_RESET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__)); \
1813 TIM_SET_CAPTUREPOLARITY((__HANDLE__), (__CHANNEL__), (__POLARITY__)); \
1814 }while(0)
1815
1824#define __HAL_TIM_SELECT_CCDMAREQUEST(__HANDLE__, __CCDMA__) \
1825 MODIFY_REG((__HANDLE__)->Instance->CR2, TIM_CR2_CCDS, (__CCDMA__))
1826
1830/* End of exported macros ----------------------------------------------------*/
1831
1832/* Private constants ---------------------------------------------------------*/
1837/* The counter of a timer instance is disabled only if all the CCx and CCxN
1838 channels have been disabled */
1839#define TIM_CCER_CCxE_MASK ((uint32_t)(TIM_CCER_CC1E | TIM_CCER_CC2E | TIM_CCER_CC3E | TIM_CCER_CC4E))
1840#define TIM_CCER_CCxNE_MASK ((uint32_t)(TIM_CCER_CC1NE | TIM_CCER_CC2NE | TIM_CCER_CC3NE))
1844/* End of private constants --------------------------------------------------*/
1845
1846/* Private macros ------------------------------------------------------------*/
1851#define IS_TIM_CLEARINPUT_SOURCE(__MODE__) (((__MODE__) == TIM_CLEARINPUTSOURCE_NONE) || \
1852 ((__MODE__) == TIM_CLEARINPUTSOURCE_ETR))
1853
1854#define IS_TIM_DMA_BASE(__BASE__) (((__BASE__) == TIM_DMABASE_CR1) || \
1855 ((__BASE__) == TIM_DMABASE_CR2) || \
1856 ((__BASE__) == TIM_DMABASE_SMCR) || \
1857 ((__BASE__) == TIM_DMABASE_DIER) || \
1858 ((__BASE__) == TIM_DMABASE_SR) || \
1859 ((__BASE__) == TIM_DMABASE_EGR) || \
1860 ((__BASE__) == TIM_DMABASE_CCMR1) || \
1861 ((__BASE__) == TIM_DMABASE_CCMR2) || \
1862 ((__BASE__) == TIM_DMABASE_CCER) || \
1863 ((__BASE__) == TIM_DMABASE_CNT) || \
1864 ((__BASE__) == TIM_DMABASE_PSC) || \
1865 ((__BASE__) == TIM_DMABASE_ARR) || \
1866 ((__BASE__) == TIM_DMABASE_RCR) || \
1867 ((__BASE__) == TIM_DMABASE_CCR1) || \
1868 ((__BASE__) == TIM_DMABASE_CCR2) || \
1869 ((__BASE__) == TIM_DMABASE_CCR3) || \
1870 ((__BASE__) == TIM_DMABASE_CCR4) || \
1871 ((__BASE__) == TIM_DMABASE_BDTR) || \
1872 ((__BASE__) == TIM_DMABASE_CCMR3) || \
1873 ((__BASE__) == TIM_DMABASE_CCR5) || \
1874 ((__BASE__) == TIM_DMABASE_CCR6) || \
1875 ((__BASE__) == TIM_DMABASE_AF1) || \
1876 ((__BASE__) == TIM_DMABASE_AF2) || \
1877 ((__BASE__) == TIM_DMABASE_TISEL))
1878
1879
1880#define IS_TIM_EVENT_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFFFE00U) == 0x00000000U) && ((__SOURCE__) != 0x00000000U))
1881
1882#define IS_TIM_COUNTER_MODE(__MODE__) (((__MODE__) == TIM_COUNTERMODE_UP) || \
1883 ((__MODE__) == TIM_COUNTERMODE_DOWN) || \
1884 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED1) || \
1885 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED2) || \
1886 ((__MODE__) == TIM_COUNTERMODE_CENTERALIGNED3))
1887
1888#define IS_TIM_UIFREMAP_MODE(__MODE__) (((__MODE__) == TIM_UIFREMAP_DISABLE) || \
1889 ((__MODE__) == TIM_UIFREMAP_ENABLE))
1890
1891#define IS_TIM_CLOCKDIVISION_DIV(__DIV__) (((__DIV__) == TIM_CLOCKDIVISION_DIV1) || \
1892 ((__DIV__) == TIM_CLOCKDIVISION_DIV2) || \
1893 ((__DIV__) == TIM_CLOCKDIVISION_DIV4))
1894
1895#define IS_TIM_AUTORELOAD_PRELOAD(PRELOAD) (((PRELOAD) == TIM_AUTORELOAD_PRELOAD_DISABLE) || \
1896 ((PRELOAD) == TIM_AUTORELOAD_PRELOAD_ENABLE))
1897
1898#define IS_TIM_FAST_STATE(__STATE__) (((__STATE__) == TIM_OCFAST_DISABLE) || \
1899 ((__STATE__) == TIM_OCFAST_ENABLE))
1900
1901#define IS_TIM_OC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCPOLARITY_HIGH) || \
1902 ((__POLARITY__) == TIM_OCPOLARITY_LOW))
1903
1904#define IS_TIM_OCN_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_OCNPOLARITY_HIGH) || \
1905 ((__POLARITY__) == TIM_OCNPOLARITY_LOW))
1906
1907#define IS_TIM_OCIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCIDLESTATE_SET) || \
1908 ((__STATE__) == TIM_OCIDLESTATE_RESET))
1909
1910#define IS_TIM_OCNIDLE_STATE(__STATE__) (((__STATE__) == TIM_OCNIDLESTATE_SET) || \
1911 ((__STATE__) == TIM_OCNIDLESTATE_RESET))
1912
1913#define IS_TIM_ENCODERINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_RISING) || \
1914 ((__POLARITY__) == TIM_ENCODERINPUTPOLARITY_FALLING))
1915
1916#define IS_TIM_IC_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_ICPOLARITY_RISING) || \
1917 ((__POLARITY__) == TIM_ICPOLARITY_FALLING) || \
1918 ((__POLARITY__) == TIM_ICPOLARITY_BOTHEDGE))
1919
1920#define IS_TIM_IC_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_ICSELECTION_DIRECTTI) || \
1921 ((__SELECTION__) == TIM_ICSELECTION_INDIRECTTI) || \
1922 ((__SELECTION__) == TIM_ICSELECTION_TRC))
1923
1924#define IS_TIM_IC_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_ICPSC_DIV1) || \
1925 ((__PRESCALER__) == TIM_ICPSC_DIV2) || \
1926 ((__PRESCALER__) == TIM_ICPSC_DIV4) || \
1927 ((__PRESCALER__) == TIM_ICPSC_DIV8))
1928
1929#define IS_TIM_CCX_CHANNEL(__INSTANCE__, __CHANNEL__) (IS_TIM_CCX_INSTANCE(__INSTANCE__, __CHANNEL__) && \
1930 ((__CHANNEL__) != (TIM_CHANNEL_5)) && \
1931 ((__CHANNEL__) != (TIM_CHANNEL_6)))
1932
1933#define IS_TIM_OPM_MODE(__MODE__) (((__MODE__) == TIM_OPMODE_SINGLE) || \
1934 ((__MODE__) == TIM_OPMODE_REPETITIVE))
1935
1936#define IS_TIM_ENCODER_MODE(__MODE__) (((__MODE__) == TIM_ENCODERMODE_TI1) || \
1937 ((__MODE__) == TIM_ENCODERMODE_TI2) || \
1938 ((__MODE__) == TIM_ENCODERMODE_TI12))
1939
1940#define IS_TIM_DMA_SOURCE(__SOURCE__) ((((__SOURCE__) & 0xFFFF80FFU) == 0x00000000U) && ((__SOURCE__) != 0x00000000U))
1941
1942#define IS_TIM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \
1943 ((__CHANNEL__) == TIM_CHANNEL_2) || \
1944 ((__CHANNEL__) == TIM_CHANNEL_3) || \
1945 ((__CHANNEL__) == TIM_CHANNEL_4) || \
1946 ((__CHANNEL__) == TIM_CHANNEL_5) || \
1947 ((__CHANNEL__) == TIM_CHANNEL_6) || \
1948 ((__CHANNEL__) == TIM_CHANNEL_ALL))
1949
1950#define IS_TIM_OPM_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \
1951 ((__CHANNEL__) == TIM_CHANNEL_2))
1952
1953#define IS_TIM_PERIOD(__HANDLE__, __PERIOD__) ((IS_TIM_32B_COUNTER_INSTANCE(((__HANDLE__)->Instance)) == 0U) ? \
1954 (((__PERIOD__) > 0U) && ((__PERIOD__) <= 0x0000FFFFU)) : \
1955 ((__PERIOD__) > 0U))
1956
1957#define IS_TIM_COMPLEMENTARY_CHANNELS(__CHANNEL__) (((__CHANNEL__) == TIM_CHANNEL_1) || \
1958 ((__CHANNEL__) == TIM_CHANNEL_2) || \
1959 ((__CHANNEL__) == TIM_CHANNEL_3))
1960
1961#define IS_TIM_CLOCKSOURCE(__CLOCK__) (((__CLOCK__) == TIM_CLOCKSOURCE_INTERNAL) || \
1962 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE1) || \
1963 ((__CLOCK__) == TIM_CLOCKSOURCE_ETRMODE2) || \
1964 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1ED) || \
1965 ((__CLOCK__) == TIM_CLOCKSOURCE_TI1) || \
1966 ((__CLOCK__) == TIM_CLOCKSOURCE_TI2) || \
1967 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR0) || \
1968 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR1) || \
1969 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR2) || \
1970 ((__CLOCK__) == TIM_CLOCKSOURCE_ITR3))
1971
1972#define IS_TIM_CLOCKPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLOCKPOLARITY_INVERTED) || \
1973 ((__POLARITY__) == TIM_CLOCKPOLARITY_NONINVERTED) || \
1974 ((__POLARITY__) == TIM_CLOCKPOLARITY_RISING) || \
1975 ((__POLARITY__) == TIM_CLOCKPOLARITY_FALLING) || \
1976 ((__POLARITY__) == TIM_CLOCKPOLARITY_BOTHEDGE))
1977
1978#define IS_TIM_CLOCKPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV1) || \
1979 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV2) || \
1980 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV4) || \
1981 ((__PRESCALER__) == TIM_CLOCKPRESCALER_DIV8))
1982
1983#define IS_TIM_CLOCKFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
1984
1985#define IS_TIM_CLEARINPUT_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_CLEARINPUTPOLARITY_INVERTED) || \
1986 ((__POLARITY__) == TIM_CLEARINPUTPOLARITY_NONINVERTED))
1987
1988#define IS_TIM_CLEARINPUT_PRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV1) || \
1989 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV2) || \
1990 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV4) || \
1991 ((__PRESCALER__) == TIM_CLEARINPUTPRESCALER_DIV8))
1992
1993#define IS_TIM_CLEARINPUT_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
1994
1995#define IS_TIM_OSSR_STATE(__STATE__) (((__STATE__) == TIM_OSSR_ENABLE) || \
1996 ((__STATE__) == TIM_OSSR_DISABLE))
1997
1998#define IS_TIM_OSSI_STATE(__STATE__) (((__STATE__) == TIM_OSSI_ENABLE) || \
1999 ((__STATE__) == TIM_OSSI_DISABLE))
2000
2001#define IS_TIM_LOCK_LEVEL(__LEVEL__) (((__LEVEL__) == TIM_LOCKLEVEL_OFF) || \
2002 ((__LEVEL__) == TIM_LOCKLEVEL_1) || \
2003 ((__LEVEL__) == TIM_LOCKLEVEL_2) || \
2004 ((__LEVEL__) == TIM_LOCKLEVEL_3))
2005
2006#define IS_TIM_BREAK_FILTER(__BRKFILTER__) ((__BRKFILTER__) <= 0xFUL)
2007
2008#define IS_TIM_BREAK_STATE(__STATE__) (((__STATE__) == TIM_BREAK_ENABLE) || \
2009 ((__STATE__) == TIM_BREAK_DISABLE))
2010
2011#define IS_TIM_BREAK_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAKPOLARITY_LOW) || \
2012 ((__POLARITY__) == TIM_BREAKPOLARITY_HIGH))
2013#if defined(TIM_BDTR_BKBID)
2014
2015#define IS_TIM_BREAK_AFMODE(__AFMODE__) (((__AFMODE__) == TIM_BREAK_AFMODE_INPUT) || \
2016 ((__AFMODE__) == TIM_BREAK_AFMODE_BIDIRECTIONAL))
2017
2018#endif /* TIM_BDTR_BKBID */
2019
2020#define IS_TIM_BREAK2_STATE(__STATE__) (((__STATE__) == TIM_BREAK2_ENABLE) || \
2021 ((__STATE__) == TIM_BREAK2_DISABLE))
2022
2023#define IS_TIM_BREAK2_POLARITY(__POLARITY__) (((__POLARITY__) == TIM_BREAK2POLARITY_LOW) || \
2024 ((__POLARITY__) == TIM_BREAK2POLARITY_HIGH))
2025#if defined(TIM_BDTR_BKBID)
2026
2027#define IS_TIM_BREAK2_AFMODE(__AFMODE__) (((__AFMODE__) == TIM_BREAK2_AFMODE_INPUT) || \
2028 ((__AFMODE__) == TIM_BREAK2_AFMODE_BIDIRECTIONAL))
2029
2030#endif /* TIM_BDTR_BKBID */
2031
2032#define IS_TIM_AUTOMATIC_OUTPUT_STATE(__STATE__) (((__STATE__) == TIM_AUTOMATICOUTPUT_ENABLE) || \
2033 ((__STATE__) == TIM_AUTOMATICOUTPUT_DISABLE))
2034
2035#define IS_TIM_GROUPCH5(__OCREF__) ((((__OCREF__) & 0x1FFFFFFFU) == 0x00000000U))
2036
2037#define IS_TIM_TRGO_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO_RESET) || \
2038 ((__SOURCE__) == TIM_TRGO_ENABLE) || \
2039 ((__SOURCE__) == TIM_TRGO_UPDATE) || \
2040 ((__SOURCE__) == TIM_TRGO_OC1) || \
2041 ((__SOURCE__) == TIM_TRGO_OC1REF) || \
2042 ((__SOURCE__) == TIM_TRGO_OC2REF) || \
2043 ((__SOURCE__) == TIM_TRGO_OC3REF) || \
2044 ((__SOURCE__) == TIM_TRGO_OC4REF))
2045
2046#define IS_TIM_TRGO2_SOURCE(__SOURCE__) (((__SOURCE__) == TIM_TRGO2_RESET) || \
2047 ((__SOURCE__) == TIM_TRGO2_ENABLE) || \
2048 ((__SOURCE__) == TIM_TRGO2_UPDATE) || \
2049 ((__SOURCE__) == TIM_TRGO2_OC1) || \
2050 ((__SOURCE__) == TIM_TRGO2_OC1REF) || \
2051 ((__SOURCE__) == TIM_TRGO2_OC2REF) || \
2052 ((__SOURCE__) == TIM_TRGO2_OC3REF) || \
2053 ((__SOURCE__) == TIM_TRGO2_OC3REF) || \
2054 ((__SOURCE__) == TIM_TRGO2_OC4REF) || \
2055 ((__SOURCE__) == TIM_TRGO2_OC5REF) || \
2056 ((__SOURCE__) == TIM_TRGO2_OC6REF) || \
2057 ((__SOURCE__) == TIM_TRGO2_OC4REF_RISINGFALLING) || \
2058 ((__SOURCE__) == TIM_TRGO2_OC6REF_RISINGFALLING) || \
2059 ((__SOURCE__) == TIM_TRGO2_OC4REF_RISING_OC6REF_RISING) || \
2060 ((__SOURCE__) == TIM_TRGO2_OC4REF_RISING_OC6REF_FALLING) || \
2061 ((__SOURCE__) == TIM_TRGO2_OC5REF_RISING_OC6REF_RISING) || \
2062 ((__SOURCE__) == TIM_TRGO2_OC5REF_RISING_OC6REF_FALLING))
2063
2064#define IS_TIM_MSM_STATE(__STATE__) (((__STATE__) == TIM_MASTERSLAVEMODE_ENABLE) || \
2065 ((__STATE__) == TIM_MASTERSLAVEMODE_DISABLE))
2066
2067#define IS_TIM_SLAVE_MODE(__MODE__) (((__MODE__) == TIM_SLAVEMODE_DISABLE) || \
2068 ((__MODE__) == TIM_SLAVEMODE_RESET) || \
2069 ((__MODE__) == TIM_SLAVEMODE_GATED) || \
2070 ((__MODE__) == TIM_SLAVEMODE_TRIGGER) || \
2071 ((__MODE__) == TIM_SLAVEMODE_EXTERNAL1) || \
2072 ((__MODE__) == TIM_SLAVEMODE_COMBINED_RESETTRIGGER))
2073
2074#define IS_TIM_PWM_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_PWM1) || \
2075 ((__MODE__) == TIM_OCMODE_PWM2) || \
2076 ((__MODE__) == TIM_OCMODE_COMBINED_PWM1) || \
2077 ((__MODE__) == TIM_OCMODE_COMBINED_PWM2) || \
2078 ((__MODE__) == TIM_OCMODE_ASYMMETRIC_PWM1) || \
2079 ((__MODE__) == TIM_OCMODE_ASYMMETRIC_PWM2))
2080
2081#define IS_TIM_OC_MODE(__MODE__) (((__MODE__) == TIM_OCMODE_TIMING) || \
2082 ((__MODE__) == TIM_OCMODE_ACTIVE) || \
2083 ((__MODE__) == TIM_OCMODE_INACTIVE) || \
2084 ((__MODE__) == TIM_OCMODE_TOGGLE) || \
2085 ((__MODE__) == TIM_OCMODE_FORCED_ACTIVE) || \
2086 ((__MODE__) == TIM_OCMODE_FORCED_INACTIVE) || \
2087 ((__MODE__) == TIM_OCMODE_RETRIGERRABLE_OPM1) || \
2088 ((__MODE__) == TIM_OCMODE_RETRIGERRABLE_OPM2))
2089
2090#define IS_TIM_TRIGGER_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \
2091 ((__SELECTION__) == TIM_TS_ITR1) || \
2092 ((__SELECTION__) == TIM_TS_ITR2) || \
2093 ((__SELECTION__) == TIM_TS_ITR3) || \
2094 ((__SELECTION__) == TIM_TS_ITR4) || \
2095 ((__SELECTION__) == TIM_TS_ITR5) || \
2096 ((__SELECTION__) == TIM_TS_ITR6) || \
2097 ((__SELECTION__) == TIM_TS_ITR7) || \
2098 ((__SELECTION__) == TIM_TS_ITR8) || \
2099 ((__SELECTION__) == TIM_TS_ITR12) || \
2100 ((__SELECTION__) == TIM_TS_ITR13) || \
2101 ((__SELECTION__) == TIM_TS_TI1F_ED) || \
2102 ((__SELECTION__) == TIM_TS_TI1FP1) || \
2103 ((__SELECTION__) == TIM_TS_TI2FP2) || \
2104 ((__SELECTION__) == TIM_TS_ETRF))
2105
2106#define IS_TIM_INTERNAL_TRIGGEREVENT_SELECTION(__SELECTION__) (((__SELECTION__) == TIM_TS_ITR0) || \
2107 ((__SELECTION__) == TIM_TS_ITR1) || \
2108 ((__SELECTION__) == TIM_TS_ITR2) || \
2109 ((__SELECTION__) == TIM_TS_ITR3) || \
2110 ((__SELECTION__) == TIM_TS_ITR4) || \
2111 ((__SELECTION__) == TIM_TS_ITR5) || \
2112 ((__SELECTION__) == TIM_TS_ITR6) || \
2113 ((__SELECTION__) == TIM_TS_ITR7) || \
2114 ((__SELECTION__) == TIM_TS_ITR8) || \
2115 ((__SELECTION__) == TIM_TS_ITR12) || \
2116 ((__SELECTION__) == TIM_TS_ITR13) || \
2117 ((__SELECTION__) == TIM_TS_NONE))
2118
2119#define IS_TIM_TRIGGERPOLARITY(__POLARITY__) (((__POLARITY__) == TIM_TRIGGERPOLARITY_INVERTED ) || \
2120 ((__POLARITY__) == TIM_TRIGGERPOLARITY_NONINVERTED) || \
2121 ((__POLARITY__) == TIM_TRIGGERPOLARITY_RISING ) || \
2122 ((__POLARITY__) == TIM_TRIGGERPOLARITY_FALLING ) || \
2123 ((__POLARITY__) == TIM_TRIGGERPOLARITY_BOTHEDGE ))
2124
2125#define IS_TIM_TRIGGERPRESCALER(__PRESCALER__) (((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV1) || \
2126 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV2) || \
2127 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV4) || \
2128 ((__PRESCALER__) == TIM_TRIGGERPRESCALER_DIV8))
2129
2130#define IS_TIM_TRIGGERFILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
2131
2132#define IS_TIM_TI1SELECTION(__TI1SELECTION__) (((__TI1SELECTION__) == TIM_TI1SELECTION_CH1) || \
2133 ((__TI1SELECTION__) == TIM_TI1SELECTION_XORCOMBINATION))
2134
2135#define IS_TIM_DMA_LENGTH(__LENGTH__) (((__LENGTH__) == TIM_DMABURSTLENGTH_1TRANSFER) || \
2136 ((__LENGTH__) == TIM_DMABURSTLENGTH_2TRANSFERS) || \
2137 ((__LENGTH__) == TIM_DMABURSTLENGTH_3TRANSFERS) || \
2138 ((__LENGTH__) == TIM_DMABURSTLENGTH_4TRANSFERS) || \
2139 ((__LENGTH__) == TIM_DMABURSTLENGTH_5TRANSFERS) || \
2140 ((__LENGTH__) == TIM_DMABURSTLENGTH_6TRANSFERS) || \
2141 ((__LENGTH__) == TIM_DMABURSTLENGTH_7TRANSFERS) || \
2142 ((__LENGTH__) == TIM_DMABURSTLENGTH_8TRANSFERS) || \
2143 ((__LENGTH__) == TIM_DMABURSTLENGTH_9TRANSFERS) || \
2144 ((__LENGTH__) == TIM_DMABURSTLENGTH_10TRANSFERS) || \
2145 ((__LENGTH__) == TIM_DMABURSTLENGTH_11TRANSFERS) || \
2146 ((__LENGTH__) == TIM_DMABURSTLENGTH_12TRANSFERS) || \
2147 ((__LENGTH__) == TIM_DMABURSTLENGTH_13TRANSFERS) || \
2148 ((__LENGTH__) == TIM_DMABURSTLENGTH_14TRANSFERS) || \
2149 ((__LENGTH__) == TIM_DMABURSTLENGTH_15TRANSFERS) || \
2150 ((__LENGTH__) == TIM_DMABURSTLENGTH_16TRANSFERS) || \
2151 ((__LENGTH__) == TIM_DMABURSTLENGTH_17TRANSFERS) || \
2152 ((__LENGTH__) == TIM_DMABURSTLENGTH_18TRANSFERS))
2153
2154#define IS_TIM_DMA_DATA_LENGTH(LENGTH) (((LENGTH) >= 0x1U) && ((LENGTH) < 0x10000U))
2155
2156#define IS_TIM_IC_FILTER(__ICFILTER__) ((__ICFILTER__) <= 0xFU)
2157
2158#define IS_TIM_DEADTIME(__DEADTIME__) ((__DEADTIME__) <= 0xFFU)
2159
2160#define IS_TIM_BREAK_SYSTEM(__CONFIG__) (((__CONFIG__) == TIM_BREAK_SYSTEM_ECC) || \
2161 ((__CONFIG__) == TIM_BREAK_SYSTEM_PVD) || \
2162 ((__CONFIG__) == TIM_BREAK_SYSTEM_SRAM_PARITY_ERROR) || \
2163 ((__CONFIG__) == TIM_BREAK_SYSTEM_LOCKUP))
2164
2165#define IS_TIM_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__) (((__TRIGGER__) == TIM_SLAVEMODE_TRIGGER) || \
2166 ((__TRIGGER__) == TIM_SLAVEMODE_COMBINED_RESETTRIGGER))
2167
2168#define TIM_SET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__, __ICPSC__) \
2169 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 |= (__ICPSC__)) :\
2170 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 |= ((__ICPSC__) << 8U)) :\
2171 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 |= (__ICPSC__)) :\
2172 ((__HANDLE__)->Instance->CCMR2 |= ((__ICPSC__) << 8U)))
2173
2174#define TIM_RESET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__) \
2175 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC1PSC) :\
2176 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCMR1 &= ~TIM_CCMR1_IC2PSC) :\
2177 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC3PSC) :\
2178 ((__HANDLE__)->Instance->CCMR2 &= ~TIM_CCMR2_IC4PSC))
2179
2180#define TIM_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__) \
2181 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER |= (__POLARITY__)) :\
2182 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 4U)) :\
2183 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER |= ((__POLARITY__) << 8U)) :\
2184 ((__HANDLE__)->Instance->CCER |= (((__POLARITY__) << 12U))))
2185
2186#define TIM_RESET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__) \
2187 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC1P | TIM_CCER_CC1NP)) :\
2188 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC2P | TIM_CCER_CC2NP)) :\
2189 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC3P | TIM_CCER_CC3NP)) :\
2190 ((__HANDLE__)->Instance->CCER &= ~(TIM_CCER_CC4P | TIM_CCER_CC4NP)))
2191
2192#define TIM_CHANNEL_STATE_GET(__HANDLE__, __CHANNEL__)\
2193 (((__CHANNEL__) == TIM_CHANNEL_1) ? (__HANDLE__)->ChannelState[0] :\
2194 ((__CHANNEL__) == TIM_CHANNEL_2) ? (__HANDLE__)->ChannelState[1] :\
2195 ((__CHANNEL__) == TIM_CHANNEL_3) ? (__HANDLE__)->ChannelState[2] :\
2196 ((__CHANNEL__) == TIM_CHANNEL_4) ? (__HANDLE__)->ChannelState[3] :\
2197 ((__CHANNEL__) == TIM_CHANNEL_5) ? (__HANDLE__)->ChannelState[4] :\
2198 (__HANDLE__)->ChannelState[5])
2199
2200#define TIM_CHANNEL_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__) \
2201 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->ChannelState[0] = (__CHANNEL_STATE__)) :\
2202 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->ChannelState[1] = (__CHANNEL_STATE__)) :\
2203 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->ChannelState[2] = (__CHANNEL_STATE__)) :\
2204 ((__CHANNEL__) == TIM_CHANNEL_4) ? ((__HANDLE__)->ChannelState[3] = (__CHANNEL_STATE__)) :\
2205 ((__CHANNEL__) == TIM_CHANNEL_5) ? ((__HANDLE__)->ChannelState[4] = (__CHANNEL_STATE__)) :\
2206 ((__HANDLE__)->ChannelState[5] = (__CHANNEL_STATE__)))
2207
2208#define TIM_CHANNEL_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__) do { \
2209 (__HANDLE__)->ChannelState[0] = \
2210 (__CHANNEL_STATE__); \
2211 (__HANDLE__)->ChannelState[1] = \
2212 (__CHANNEL_STATE__); \
2213 (__HANDLE__)->ChannelState[2] = \
2214 (__CHANNEL_STATE__); \
2215 (__HANDLE__)->ChannelState[3] = \
2216 (__CHANNEL_STATE__); \
2217 (__HANDLE__)->ChannelState[4] = \
2218 (__CHANNEL_STATE__); \
2219 (__HANDLE__)->ChannelState[5] = \
2220 (__CHANNEL_STATE__); \
2221 } while(0)
2222
2223#define TIM_CHANNEL_N_STATE_GET(__HANDLE__, __CHANNEL__)\
2224 (((__CHANNEL__) == TIM_CHANNEL_1) ? (__HANDLE__)->ChannelNState[0] :\
2225 ((__CHANNEL__) == TIM_CHANNEL_2) ? (__HANDLE__)->ChannelNState[1] :\
2226 ((__CHANNEL__) == TIM_CHANNEL_3) ? (__HANDLE__)->ChannelNState[2] :\
2227 (__HANDLE__)->ChannelNState[3])
2228
2229#define TIM_CHANNEL_N_STATE_SET(__HANDLE__, __CHANNEL__, __CHANNEL_STATE__) \
2230 (((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->ChannelNState[0] = (__CHANNEL_STATE__)) :\
2231 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->ChannelNState[1] = (__CHANNEL_STATE__)) :\
2232 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->ChannelNState[2] = (__CHANNEL_STATE__)) :\
2233 ((__HANDLE__)->ChannelNState[3] = (__CHANNEL_STATE__)))
2234
2235#define TIM_CHANNEL_N_STATE_SET_ALL(__HANDLE__, __CHANNEL_STATE__) do { \
2236 (__HANDLE__)->ChannelNState[0] = \
2237 (__CHANNEL_STATE__); \
2238 (__HANDLE__)->ChannelNState[1] = \
2239 (__CHANNEL_STATE__); \
2240 (__HANDLE__)->ChannelNState[2] = \
2241 (__CHANNEL_STATE__); \
2242 (__HANDLE__)->ChannelNState[3] = \
2243 (__CHANNEL_STATE__); \
2244 } while(0)
2245
2249/* End of private macros -----------------------------------------------------*/
2250
2251/* Include TIM HAL Extended module */
2252#include "stm32h7xx_hal_tim_ex.h"
2253
2254/* Exported functions --------------------------------------------------------*/
2263/* Time Base functions ********************************************************/
2264HAL_StatusTypeDef HAL_TIM_Base_Init(TIM_HandleTypeDef *htim);
2265HAL_StatusTypeDef HAL_TIM_Base_DeInit(TIM_HandleTypeDef *htim);
2266void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim);
2267void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim);
2268/* Blocking mode: Polling */
2269HAL_StatusTypeDef HAL_TIM_Base_Start(TIM_HandleTypeDef *htim);
2270HAL_StatusTypeDef HAL_TIM_Base_Stop(TIM_HandleTypeDef *htim);
2271/* Non-Blocking mode: Interrupt */
2272HAL_StatusTypeDef HAL_TIM_Base_Start_IT(TIM_HandleTypeDef *htim);
2273HAL_StatusTypeDef HAL_TIM_Base_Stop_IT(TIM_HandleTypeDef *htim);
2274/* Non-Blocking mode: DMA */
2275HAL_StatusTypeDef HAL_TIM_Base_Start_DMA(TIM_HandleTypeDef *htim, const uint32_t *pData, uint16_t Length);
2276HAL_StatusTypeDef HAL_TIM_Base_Stop_DMA(TIM_HandleTypeDef *htim);
2285/* Timer Output Compare functions *********************************************/
2286HAL_StatusTypeDef HAL_TIM_OC_Init(TIM_HandleTypeDef *htim);
2287HAL_StatusTypeDef HAL_TIM_OC_DeInit(TIM_HandleTypeDef *htim);
2288void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim);
2289void HAL_TIM_OC_MspDeInit(TIM_HandleTypeDef *htim);
2290/* Blocking mode: Polling */
2291HAL_StatusTypeDef HAL_TIM_OC_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2292HAL_StatusTypeDef HAL_TIM_OC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2293/* Non-Blocking mode: Interrupt */
2294HAL_StatusTypeDef HAL_TIM_OC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2295HAL_StatusTypeDef HAL_TIM_OC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2296/* Non-Blocking mode: DMA */
2297HAL_StatusTypeDef HAL_TIM_OC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
2298 uint16_t Length);
2299HAL_StatusTypeDef HAL_TIM_OC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2308/* Timer PWM functions ********************************************************/
2309HAL_StatusTypeDef HAL_TIM_PWM_Init(TIM_HandleTypeDef *htim);
2310HAL_StatusTypeDef HAL_TIM_PWM_DeInit(TIM_HandleTypeDef *htim);
2311void HAL_TIM_PWM_MspInit(TIM_HandleTypeDef *htim);
2312void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim);
2313/* Blocking mode: Polling */
2314HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2315HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2316/* Non-Blocking mode: Interrupt */
2317HAL_StatusTypeDef HAL_TIM_PWM_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2318HAL_StatusTypeDef HAL_TIM_PWM_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2319/* Non-Blocking mode: DMA */
2320HAL_StatusTypeDef HAL_TIM_PWM_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, const uint32_t *pData,
2321 uint16_t Length);
2322HAL_StatusTypeDef HAL_TIM_PWM_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2331/* Timer Input Capture functions **********************************************/
2332HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim);
2333HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim);
2334void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim);
2335void HAL_TIM_IC_MspDeInit(TIM_HandleTypeDef *htim);
2336/* Blocking mode: Polling */
2337HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2338HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2339/* Non-Blocking mode: Interrupt */
2340HAL_StatusTypeDef HAL_TIM_IC_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2341HAL_StatusTypeDef HAL_TIM_IC_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2342/* Non-Blocking mode: DMA */
2343HAL_StatusTypeDef HAL_TIM_IC_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length);
2344HAL_StatusTypeDef HAL_TIM_IC_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2353/* Timer One Pulse functions **************************************************/
2354HAL_StatusTypeDef HAL_TIM_OnePulse_Init(TIM_HandleTypeDef *htim, uint32_t OnePulseMode);
2355HAL_StatusTypeDef HAL_TIM_OnePulse_DeInit(TIM_HandleTypeDef *htim);
2356void HAL_TIM_OnePulse_MspInit(TIM_HandleTypeDef *htim);
2357void HAL_TIM_OnePulse_MspDeInit(TIM_HandleTypeDef *htim);
2358/* Blocking mode: Polling */
2359HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2360HAL_StatusTypeDef HAL_TIM_OnePulse_Stop(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2361/* Non-Blocking mode: Interrupt */
2362HAL_StatusTypeDef HAL_TIM_OnePulse_Start_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2363HAL_StatusTypeDef HAL_TIM_OnePulse_Stop_IT(TIM_HandleTypeDef *htim, uint32_t OutputChannel);
2372/* Timer Encoder functions ****************************************************/
2373HAL_StatusTypeDef HAL_TIM_Encoder_Init(TIM_HandleTypeDef *htim, const TIM_Encoder_InitTypeDef *sConfig);
2374HAL_StatusTypeDef HAL_TIM_Encoder_DeInit(TIM_HandleTypeDef *htim);
2375void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim);
2376void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef *htim);
2377/* Blocking mode: Polling */
2378HAL_StatusTypeDef HAL_TIM_Encoder_Start(TIM_HandleTypeDef *htim, uint32_t Channel);
2379HAL_StatusTypeDef HAL_TIM_Encoder_Stop(TIM_HandleTypeDef *htim, uint32_t Channel);
2380/* Non-Blocking mode: Interrupt */
2381HAL_StatusTypeDef HAL_TIM_Encoder_Start_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2382HAL_StatusTypeDef HAL_TIM_Encoder_Stop_IT(TIM_HandleTypeDef *htim, uint32_t Channel);
2383/* Non-Blocking mode: DMA */
2384HAL_StatusTypeDef HAL_TIM_Encoder_Start_DMA(TIM_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1,
2385 uint32_t *pData2, uint16_t Length);
2386HAL_StatusTypeDef HAL_TIM_Encoder_Stop_DMA(TIM_HandleTypeDef *htim, uint32_t Channel);
2395/* Interrupt Handler functions ***********************************************/
2396void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim);
2406/* Control functions *********************************************************/
2407HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel(TIM_HandleTypeDef *htim, const TIM_OC_InitTypeDef *sConfig,
2408 uint32_t Channel);
2409HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, const TIM_OC_InitTypeDef *sConfig,
2410 uint32_t Channel);
2411HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, const TIM_IC_InitTypeDef *sConfig,
2412 uint32_t Channel);
2413HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig,
2414 uint32_t OutputChannel, uint32_t InputChannel);
2415HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear(TIM_HandleTypeDef *htim,
2416 const TIM_ClearInputConfigTypeDef *sClearInputConfig,
2417 uint32_t Channel);
2418HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, const TIM_ClockConfigTypeDef *sClockSourceConfig);
2419HAL_StatusTypeDef HAL_TIM_ConfigTI1Input(TIM_HandleTypeDef *htim, uint32_t TI1_Selection);
2420HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro(TIM_HandleTypeDef *htim, const TIM_SlaveConfigTypeDef *sSlaveConfig);
2421HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT(TIM_HandleTypeDef *htim, const TIM_SlaveConfigTypeDef *sSlaveConfig);
2422HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2423 uint32_t BurstRequestSrc, const uint32_t *BurstBuffer,
2424 uint32_t BurstLength);
2425HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2426 uint32_t BurstRequestSrc, const uint32_t *BurstBuffer,
2427 uint32_t BurstLength, uint32_t DataLength);
2428HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc);
2429HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2430 uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength);
2431HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart(TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress,
2432 uint32_t BurstRequestSrc, uint32_t *BurstBuffer,
2433 uint32_t BurstLength, uint32_t DataLength);
2434HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop(TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc);
2435HAL_StatusTypeDef HAL_TIM_GenerateEvent(TIM_HandleTypeDef *htim, uint32_t EventSource);
2436uint32_t HAL_TIM_ReadCapturedValue(const TIM_HandleTypeDef *htim, uint32_t Channel);
2446/* Callback in non blocking modes (Interrupt and DMA) *************************/
2448void HAL_TIM_PeriodElapsedHalfCpltCallback(TIM_HandleTypeDef *htim);
2449void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim);
2450void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim);
2451void HAL_TIM_IC_CaptureHalfCpltCallback(TIM_HandleTypeDef *htim);
2452void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim);
2453void HAL_TIM_PWM_PulseFinishedHalfCpltCallback(TIM_HandleTypeDef *htim);
2454void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim);
2455void HAL_TIM_TriggerHalfCpltCallback(TIM_HandleTypeDef *htim);
2456void HAL_TIM_ErrorCallback(TIM_HandleTypeDef *htim);
2457
2458/* Callbacks Register/UnRegister functions ***********************************/
2459#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2460HAL_StatusTypeDef HAL_TIM_RegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID,
2461 pTIM_CallbackTypeDef pCallback);
2462HAL_StatusTypeDef HAL_TIM_UnRegisterCallback(TIM_HandleTypeDef *htim, HAL_TIM_CallbackIDTypeDef CallbackID);
2463#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2464
2474/* Peripheral State functions ************************************************/
2475HAL_TIM_StateTypeDef HAL_TIM_Base_GetState(const TIM_HandleTypeDef *htim);
2476HAL_TIM_StateTypeDef HAL_TIM_OC_GetState(const TIM_HandleTypeDef *htim);
2477HAL_TIM_StateTypeDef HAL_TIM_PWM_GetState(const TIM_HandleTypeDef *htim);
2478HAL_TIM_StateTypeDef HAL_TIM_IC_GetState(const TIM_HandleTypeDef *htim);
2479HAL_TIM_StateTypeDef HAL_TIM_OnePulse_GetState(const TIM_HandleTypeDef *htim);
2480HAL_TIM_StateTypeDef HAL_TIM_Encoder_GetState(const TIM_HandleTypeDef *htim);
2481
2482/* Peripheral Channel state functions ************************************************/
2483HAL_TIM_ActiveChannel HAL_TIM_GetActiveChannel(const TIM_HandleTypeDef *htim);
2484HAL_TIM_ChannelStateTypeDef HAL_TIM_GetChannelState(const TIM_HandleTypeDef *htim, uint32_t Channel);
2485HAL_TIM_DMABurstStateTypeDef HAL_TIM_DMABurstState(const TIM_HandleTypeDef *htim);
2493/* End of exported functions -------------------------------------------------*/
2494
2495/* Private functions----------------------------------------------------------*/
2500void TIM_Base_SetConfig(TIM_TypeDef *TIMx, const TIM_Base_InitTypeDef *Structure);
2501void TIM_TI1_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ICPolarity, uint32_t TIM_ICSelection, uint32_t TIM_ICFilter);
2502void TIM_OC2_SetConfig(TIM_TypeDef *TIMx, const TIM_OC_InitTypeDef *OC_Config);
2503void TIM_ETR_SetConfig(TIM_TypeDef *TIMx, uint32_t TIM_ExtTRGPrescaler,
2504 uint32_t TIM_ExtTRGPolarity, uint32_t ExtTRGFilter);
2505
2506void TIM_DMADelayPulseHalfCplt(DMA_HandleTypeDef *hdma);
2507void TIM_DMAError(DMA_HandleTypeDef *hdma);
2508void TIM_DMACaptureCplt(DMA_HandleTypeDef *hdma);
2509void TIM_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma);
2510void TIM_CCxChannelCmd(TIM_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState);
2511
2512#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
2513void TIM_ResetCallback(TIM_HandleTypeDef *htim);
2514#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
2515
2519/* End of private functions --------------------------------------------------*/
2520
2529#ifdef __cplusplus
2530}
2531#endif
2532
2533#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