RTEMS 6.1-rc5
Loading...
Searching...
No Matches
stm32h7xx_hal_lptim.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_LPTIM_H
21#define STM32H7xx_HAL_LPTIM_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
34#if defined (LPTIM1) || defined (LPTIM2) || defined (LPTIM3) || defined (LPTIM4) || defined (LPTIM5)
35
40/* Exported types ------------------------------------------------------------*/
49typedef struct
50{
51 uint32_t Source;
54 uint32_t Prescaler;
57} LPTIM_ClockConfigTypeDef;
58
62typedef struct
63{
64 uint32_t Polarity;
71 uint32_t SampleTime;
75} LPTIM_ULPClockConfigTypeDef;
76
80typedef struct
81{
82 uint32_t Source;
85 uint32_t ActiveEdge;
89 uint32_t SampleTime;
92} LPTIM_TriggerConfigTypeDef;
93
97typedef struct
98{
99 LPTIM_ClockConfigTypeDef Clock;
101 LPTIM_ULPClockConfigTypeDef UltraLowPowerClock;
103 LPTIM_TriggerConfigTypeDef Trigger;
105 uint32_t OutputPolarity;
108 uint32_t UpdateMode;
112 uint32_t CounterSource;
116 uint32_t Input1Source;
119 uint32_t Input2Source;
123} LPTIM_InitTypeDef;
124
128typedef enum
129{
130 HAL_LPTIM_STATE_RESET = 0x00U,
131 HAL_LPTIM_STATE_READY = 0x01U,
132 HAL_LPTIM_STATE_BUSY = 0x02U,
133 HAL_LPTIM_STATE_TIMEOUT = 0x03U,
134 HAL_LPTIM_STATE_ERROR = 0x04U
135} HAL_LPTIM_StateTypeDef;
136
140#if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
141typedef struct __LPTIM_HandleTypeDef
142#else
143typedef struct
144#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
145{
146 LPTIM_TypeDef *Instance;
148 LPTIM_InitTypeDef Init;
150 HAL_StatusTypeDef Status;
152 HAL_LockTypeDef Lock;
154 __IO HAL_LPTIM_StateTypeDef State;
156#if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
157 void (* MspInitCallback)(struct __LPTIM_HandleTypeDef *hlptim);
158 void (* MspDeInitCallback)(struct __LPTIM_HandleTypeDef *hlptim);
159 void (* CompareMatchCallback)(struct __LPTIM_HandleTypeDef *hlptim);
160 void (* AutoReloadMatchCallback)(struct __LPTIM_HandleTypeDef *hlptim);
161 void (* TriggerCallback)(struct __LPTIM_HandleTypeDef *hlptim);
162 void (* CompareWriteCallback)(struct __LPTIM_HandleTypeDef *hlptim);
163 void (* AutoReloadWriteCallback)(struct __LPTIM_HandleTypeDef *hlptim);
164 void (* DirectionUpCallback)(struct __LPTIM_HandleTypeDef *hlptim);
165 void (* DirectionDownCallback)(struct __LPTIM_HandleTypeDef *hlptim);
166#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
167} LPTIM_HandleTypeDef;
168
169#if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
173typedef enum
174{
175 HAL_LPTIM_MSPINIT_CB_ID = 0x00U,
176 HAL_LPTIM_MSPDEINIT_CB_ID = 0x01U,
177 HAL_LPTIM_COMPARE_MATCH_CB_ID = 0x02U,
178 HAL_LPTIM_AUTORELOAD_MATCH_CB_ID = 0x03U,
179 HAL_LPTIM_TRIGGER_CB_ID = 0x04U,
180 HAL_LPTIM_COMPARE_WRITE_CB_ID = 0x05U,
181 HAL_LPTIM_AUTORELOAD_WRITE_CB_ID = 0x06U,
182 HAL_LPTIM_DIRECTION_UP_CB_ID = 0x07U,
183 HAL_LPTIM_DIRECTION_DOWN_CB_ID = 0x08U,
184} HAL_LPTIM_CallbackIDTypeDef;
185
189typedef void (*pLPTIM_CallbackTypeDef)(LPTIM_HandleTypeDef *hlptim);
191#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
196/* Exported constants --------------------------------------------------------*/
206#define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC 0x00000000U
207#define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL
216#define LPTIM_PRESCALER_DIV1 0x00000000U
217#define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0
218#define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1
219#define LPTIM_PRESCALER_DIV8 (LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1)
220#define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2
221#define LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2)
222#define LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2)
223#define LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC
233#define LPTIM_OUTPUTPOLARITY_HIGH 0x00000000U
234#define LPTIM_OUTPUTPOLARITY_LOW LPTIM_CFGR_WAVPOL
243#define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION 0x00000000U
244#define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0
245#define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1
246#define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT
255#define LPTIM_CLOCKPOLARITY_RISING 0x00000000U
256#define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0
257#define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1
266#define LPTIM_TRIGSOURCE_SOFTWARE 0x0000FFFFU
267#define LPTIM_TRIGSOURCE_0 0x00000000U
268#define LPTIM_TRIGSOURCE_1 LPTIM_CFGR_TRIGSEL_0
269#define LPTIM_TRIGSOURCE_2 LPTIM_CFGR_TRIGSEL_1
270#define LPTIM_TRIGSOURCE_3 (LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_1)
271#define LPTIM_TRIGSOURCE_4 LPTIM_CFGR_TRIGSEL_2
272#define LPTIM_TRIGSOURCE_5 (LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_2)
273#define LPTIM_TRIGSOURCE_6 (LPTIM_CFGR_TRIGSEL_1 | LPTIM_CFGR_TRIGSEL_2)
274#define LPTIM_TRIGSOURCE_7 LPTIM_CFGR_TRIGSEL
283#define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0
284#define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1
285#define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN
294#define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION 0x00000000U
295#define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0
296#define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1
297#define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT
307#define LPTIM_UPDATE_IMMEDIATE 0x00000000U
308#define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD
318#define LPTIM_COUNTERSOURCE_INTERNAL 0x00000000U
319#define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE
329#define LPTIM_INPUT1SOURCE_GPIO 0x00000000U
330#define LPTIM_INPUT1SOURCE_COMP1 LPTIM_CFGR2_IN1SEL_0
331#define LPTIM_INPUT1SOURCE_COMP2 LPTIM_CFGR2_IN1SEL_1
332#define LPTIM_INPUT1SOURCE_COMP1_COMP2 (LPTIM_CFGR2_IN1SEL_1 | LPTIM_CFGR2_IN1SEL_0)
333#define LPTIM_INPUT1SOURCE_NOT_CONNECTED 0x00000000U
334#define LPTIM_INPUT1SOURCE_SAI4_FSA LPTIM_CFGR2_IN1SEL_0
335#define LPTIM_INPUT1SOURCE_SAI4_FSB LPTIM_CFGR2_IN1SEL_1
345#define LPTIM_INPUT2SOURCE_GPIO 0x00000000U
346#define LPTIM_INPUT2SOURCE_COMP2 LPTIM_CFGR2_IN2SEL_0
356#define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN
357#define LPTIM_FLAG_UP LPTIM_ISR_UP
358#define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK
359#define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK
360#define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG
361#define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM
362#define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM
371#define LPTIM_IT_DOWN LPTIM_IER_DOWNIE
372#define LPTIM_IT_UP LPTIM_IER_UPIE
373#define LPTIM_IT_ARROK LPTIM_IER_ARROKIE
374#define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE
375#define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE
376#define LPTIM_IT_ARRM LPTIM_IER_ARRMIE
377#define LPTIM_IT_CMPM LPTIM_IER_CMPMIE
386/* Exported macros -----------------------------------------------------------*/
396#if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
397#define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) do { \
398 (__HANDLE__)->State = HAL_LPTIM_STATE_RESET; \
399 (__HANDLE__)->MspInitCallback = NULL; \
400 (__HANDLE__)->MspDeInitCallback = NULL; \
401 } while(0)
402#else
403#define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET)
404#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
405
411#define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE))
412
423#define __HAL_LPTIM_DISABLE(__HANDLE__) LPTIM_Disable(__HANDLE__)
424
430#define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT)
436#define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT)
437
443#define __HAL_LPTIM_RESET_COUNTER(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_COUNTRST)
444
450#define __HAL_LPTIM_RESET_COUNTER_AFTERREAD(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_RSTARE)
451
460#define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__))
461
469#define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__))
470
485#define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__))
486
501#define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
502
518#define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
519
535#define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
536
552#define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER\
553 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
554
559/* Exported functions --------------------------------------------------------*/
569/* Initialization/de-initialization functions ********************************/
570HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim);
571HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim);
572
573/* MSP functions *************************************************************/
574void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim);
575void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim);
584/* Start/Stop operation functions *********************************************/
585/* ################################# PWM Mode ################################*/
586/* Blocking mode: Polling */
587HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
588HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim);
589/* Non-Blocking mode: Interrupt */
590HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
591HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim);
592
593/* ############################# One Pulse Mode ##############################*/
594/* Blocking mode: Polling */
595HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
596HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim);
597/* Non-Blocking mode: Interrupt */
598HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
599HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim);
600
601/* ############################## Set once Mode ##############################*/
602/* Blocking mode: Polling */
603HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
604HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim);
605/* Non-Blocking mode: Interrupt */
606HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
607HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim);
608
609/* ############################### Encoder Mode ##############################*/
610/* Blocking mode: Polling */
611HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
612HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim);
613/* Non-Blocking mode: Interrupt */
614HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
615HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim);
616
617/* ############################# Time out Mode ##############################*/
618/* Blocking mode: Polling */
619HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
620HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim);
621/* Non-Blocking mode: Interrupt */
622HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
623HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim);
624
625/* ############################## Counter Mode ###############################*/
626/* Blocking mode: Polling */
627HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
628HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim);
629/* Non-Blocking mode: Interrupt */
630HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
631HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim);
640/* Reading operation functions ************************************************/
641uint32_t HAL_LPTIM_ReadCounter(const LPTIM_HandleTypeDef *hlptim);
642uint32_t HAL_LPTIM_ReadAutoReload(const LPTIM_HandleTypeDef *hlptim);
643uint32_t HAL_LPTIM_ReadCompare(const LPTIM_HandleTypeDef *hlptim);
652/* LPTIM IRQ functions *******************************************************/
653void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim);
654
655/* CallBack functions ********************************************************/
656void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim);
657void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim);
658void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim);
659void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim);
660void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim);
661void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim);
662void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim);
663
664/* Callbacks Register/UnRegister functions ***********************************/
665#if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
666HAL_StatusTypeDef HAL_LPTIM_RegisterCallback(LPTIM_HandleTypeDef *lphtim, HAL_LPTIM_CallbackIDTypeDef CallbackID,
667 pLPTIM_CallbackTypeDef pCallback);
668HAL_StatusTypeDef HAL_LPTIM_UnRegisterCallback(LPTIM_HandleTypeDef *lphtim, HAL_LPTIM_CallbackIDTypeDef CallbackID);
669#endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
678/* Peripheral State functions ************************************************/
679HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(const LPTIM_HandleTypeDef *hlptim);
688/* Private types -------------------------------------------------------------*/
698/* Private variables ---------------------------------------------------------*/
708/* Private constants ---------------------------------------------------------*/
718/* Private macros ------------------------------------------------------------*/
724#define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \
725 ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC))
726
727
728#define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \
729 ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \
730 ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \
731 ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \
732 ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \
733 ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \
734 ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \
735 ((__PRESCALER__) == LPTIM_PRESCALER_DIV128))
736
737#define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1)
738
739#define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \
740 ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH))
741
742#define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \
743 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \
744 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \
745 ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS))
746
747#define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \
748 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \
749 ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING))
750
751#define IS_LPTIM_TRG_SOURCE(__TRIG__) (((__TRIG__) == LPTIM_TRIGSOURCE_SOFTWARE) || \
752 ((__TRIG__) == LPTIM_TRIGSOURCE_0) || \
753 ((__TRIG__) == LPTIM_TRIGSOURCE_1) || \
754 ((__TRIG__) == LPTIM_TRIGSOURCE_2) || \
755 ((__TRIG__) == LPTIM_TRIGSOURCE_3) || \
756 ((__TRIG__) == LPTIM_TRIGSOURCE_4) || \
757 ((__TRIG__) == LPTIM_TRIGSOURCE_5) || \
758 ((__TRIG__) == LPTIM_TRIGSOURCE_6) || \
759 ((__TRIG__) == LPTIM_TRIGSOURCE_7))
760
761#define IS_LPTIM_EXT_TRG_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_ACTIVEEDGE_RISING ) || \
762 ((__POLARITY__) == LPTIM_ACTIVEEDGE_FALLING ) || \
763 ((__POLARITY__) == LPTIM_ACTIVEEDGE_RISING_FALLING ))
764
765#define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION) || \
766 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \
767 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \
768 ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS ))
769
770#define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \
771 ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD))
772
773#define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \
774 ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL))
775
776#define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFFUL)
777
778#define IS_LPTIM_PERIOD(__PERIOD__) ((0x00000001UL <= (__PERIOD__)) &&\
779 ((__PERIOD__) <= 0x0000FFFFUL))
780
781#define IS_LPTIM_PULSE(__PULSE__) ((__PULSE__) <= 0x0000FFFFUL)
782
783#define IS_LPTIM_INPUT1_SOURCE(__INSTANCE__, __SOURCE__) \
784 ((((__INSTANCE__) == LPTIM1) && \
785 (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \
786 ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1))) \
787 || \
788 (((__INSTANCE__) == LPTIM2) && \
789 (((__SOURCE__) == LPTIM_INPUT1SOURCE_GPIO) || \
790 ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1) || \
791 ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP2) || \
792 ((__SOURCE__) == LPTIM_INPUT1SOURCE_COMP1_COMP2))) \
793 || \
794 (((__INSTANCE__) == LPTIM3) && \
795 (((__SOURCE__) == LPTIM_INPUT1SOURCE_NOT_CONNECTED) || \
796 ((__SOURCE__) == LPTIM_INPUT1SOURCE_SAI4_FSA) || \
797 ((__SOURCE__) == LPTIM_INPUT1SOURCE_SAI4_FSB))))
798
799#define IS_LPTIM_INPUT2_SOURCE(__INSTANCE__, __SOURCE__) \
800 ((((__INSTANCE__) == LPTIM1) || \
801 ((__INSTANCE__) == LPTIM2)) && \
802 (((__SOURCE__) == LPTIM_INPUT2SOURCE_GPIO) || \
803 ((__SOURCE__) == LPTIM_INPUT2SOURCE_COMP2)))
804
809/* Private functions ---------------------------------------------------------*/
814void LPTIM_Disable(LPTIM_HandleTypeDef *hlptim);
823#endif /* LPTIM1 || LPTIM2 || LPTIM3 || LPTIM4 || LPTIM5 */
828#ifdef __cplusplus
829}
830#endif
831
832#endif /* STM32H7xx_HAL_LPTIM_H */
#define __IO
Definition: core_cm4.h:239
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
LPTIMIMER.
Definition: stm32h723xx.h:1559