20#ifndef __STM32H7xx_HAL_DTS_H
21#define __STM32H7xx_HAL_DTS_H
51 uint32_t QuickMeasure;
57 uint32_t TriggerInput;
60 uint32_t SamplingTime;
66 uint32_t HighThreshold;
68 uint32_t LowThreshold;
77 HAL_DTS_STATE_RESET = 0x00UL,
78 HAL_DTS_STATE_READY = 0x01UL,
79 HAL_DTS_STATE_BUSY = 0x02UL,
80 HAL_DTS_STATE_TIMEOUT = 0x03UL,
81 HAL_DTS_STATE_ERROR = 0x04UL
82} HAL_DTS_StateTypeDef;
87#if (USE_HAL_DTS_REGISTER_CALLBACKS == 1)
88typedef struct __DTS_HandleTypeDef
96 __IO HAL_DTS_StateTypeDef State;
97#if (USE_HAL_DTS_REGISTER_CALLBACKS == 1)
98 void (* MspInitCallback)(
struct __DTS_HandleTypeDef *hdts);
99 void (* MspDeInitCallback)(
struct __DTS_HandleTypeDef *hdts);
100 void (* EndCallback)(
struct __DTS_HandleTypeDef *hdts);
101 void (* LowCallback)(
struct __DTS_HandleTypeDef *hdts);
102 void (* HighCallback)(
struct __DTS_HandleTypeDef *hdts);
103 void (* AsyncEndCallback)(
struct __DTS_HandleTypeDef *hdts);
104 void (* AsyncLowCallback)(
struct __DTS_HandleTypeDef *hdts);
105 void (* AsyncHighCallback)(
struct __DTS_HandleTypeDef *hdts);
109#if (USE_HAL_DTS_REGISTER_CALLBACKS == 1)
115 HAL_DTS_MEAS_COMPLETE_CB_ID = 0x00U,
116 HAL_DTS_ASYNC_MEAS_COMPLETE_CB_ID = 0x01U,
117 HAL_DTS_LOW_THRESHOLD_CB_ID = 0x02U,
118 HAL_DTS_ASYNC_LOW_THRESHOLD_CB_ID = 0x03U,
119 HAL_DTS_HIGH_THRESHOLD_CB_ID = 0x04U,
120 HAL_DTS_ASYNC_HIGH_THRESHOLD_CB_ID = 0x05U,
121 HAL_DTS_MSPINIT_CB_ID = 0x06U,
122 HAL_DTS_MSPDEINIT_CB_ID = 0x07U
123} HAL_DTS_CallbackIDTypeDef;
128typedef void (*pDTS_CallbackTypeDef)(DTS_HandleTypeDef *hdts);
146#define DTS_TRIGGER_HW_NONE (0UL)
149#define DTS_TRIGGER_LPTIMER1 DTS_CFGR1_TS1_INTRIG_SEL_0
152#define DTS_TRIGGER_LPTIMER2 DTS_CFGR1_TS1_INTRIG_SEL_1
155#define DTS_TRIGGER_LPTIMER3 (DTS_CFGR1_TS1_INTRIG_SEL_0 | DTS_CFGR1_TS1_INTRIG_SEL_1)
158#define DTS_TRIGGER_EXTI13 DTS_CFGR1_TS1_INTRIG_SEL_2
167#define DTS_QUICKMEAS_ENABLE DTS_CFGR1_Q_MEAS_OPT
168#define DTS_QUICKMEAS_DISABLE (0x0UL)
177#define DTS_REFCLKSEL_LSE DTS_CFGR1_REFCLK_SEL
178#define DTS_REFCLKSEL_PCLK (0UL)
187#define DTS_SMP_TIME_1_CYCLE DTS_CFGR1_TS1_SMP_TIME_0
188#define DTS_SMP_TIME_2_CYCLE DTS_CFGR1_TS1_SMP_TIME_1
189#define DTS_SMP_TIME_3_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_1)
190#define DTS_SMP_TIME_4_CYCLE (DTS_CFGR1_TS1_SMP_TIME_2)
191#define DTS_SMP_TIME_5_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_2)
192#define DTS_SMP_TIME_6_CYCLE (DTS_CFGR1_TS1_SMP_TIME_1 | DTS_CFGR1_TS1_SMP_TIME_2)
193#define DTS_SMP_TIME_7_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_1 | DTS_CFGR1_TS1_SMP_TIME_2)
194#define DTS_SMP_TIME_8_CYCLE (DTS_CFGR1_TS1_SMP_TIME_3)
195#define DTS_SMP_TIME_9_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_3)
196#define DTS_SMP_TIME_10_CYCLE (DTS_CFGR1_TS1_SMP_TIME_1 | DTS_CFGR1_TS1_SMP_TIME_3)
197#define DTS_SMP_TIME_11_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_1 | DTS_CFGR1_TS1_SMP_TIME_3)
198#define DTS_SMP_TIME_12_CYCLE (DTS_CFGR1_TS1_SMP_TIME_2 | DTS_CFGR1_TS1_SMP_TIME_3)
199#define DTS_SMP_TIME_13_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_2 | DTS_CFGR1_TS1_SMP_TIME_3)
200#define DTS_SMP_TIME_14_CYCLE (DTS_CFGR1_TS1_SMP_TIME_1 | DTS_CFGR1_TS1_SMP_TIME_2 | DTS_CFGR1_TS1_SMP_TIME_3)
201#define DTS_SMP_TIME_15_CYCLE (DTS_CFGR1_TS1_SMP_TIME_0 | DTS_CFGR1_TS1_SMP_TIME_1 | DTS_CFGR1_TS1_SMP_TIME_2 | DTS_CFGR1_TS1_SMP_TIME_3)
209#define DTS_FLAG_TS1_ITE DTS_SR_TS1_ITEF
210#define DTS_FLAG_TS1_ITL DTS_SR_TS1_ITLF
211#define DTS_FLAG_TS1_ITH DTS_SR_TS1_ITHF
212#define DTS_FLAG_TS1_AITE DTS_SR_TS1_AITEF
213#define DTS_FLAG_TS1_AITL DTS_SR_TS1_AITLF
214#define DTS_FLAG_TS1_AITH DTS_SR_TS1_AITHF
215#define DTS_FLAG_TS1_RDY DTS_SR_TS1_RDY
224#define DTS_IT_TS1_ITE DTS_ITENR_TS1_ITEEN
225#define DTS_IT_TS1_ITL DTS_ITENR_TS1_ITLEN
226#define DTS_IT_TS1_ITH DTS_ITENR_TS1_ITHEN
227#define DTS_IT_TS1_AITE DTS_ITENR_TS1_AITEEN
228#define DTS_IT_TS1_AITL DTS_ITENR_TS1_AITLEN
229#define DTS_IT_TS1_AITH DTS_ITENR_TS1_AITHEN
247#if (USE_HAL_DTS_REGISTER_CALLBACKS == 1)
248#define __HAL_DTS_RESET_HANDLE_STATE(__HANDLE__) do{ \
249 (__HANDLE__)->State = HAL_DTS_STATE_RESET; \
250 (__HANDLE__)->MspInitCallback = NULL; \
251 (__HANDLE__)->MspDeInitCallback = NULL; \
254#define __HAL_DTS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DTS_STATE_RESET)
262#define __HAL_DTS_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CFGR1, DTS_CFGR1_TS1_EN)
269#define __HAL_DTS_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR1, DTS_CFGR1_TS1_EN)
275#define __HAL_DTS_EXTI_WAKEUP_ENABLE_IT() SET_BIT(EXTI->IMR3, DTS_EXTI_LINE_DTS1)
281#define __HAL_DTS_EXTI_WAKEUP_DISABLE_IT() CLEAR_BIT(EXTI->IMR3, DTS_EXTI_LINE_DTS1)
287#define __HAL_DTS_EXTI_WAKEUP_ENABLE_EVENT() SET_BIT(EXTI->EMR3, DTS_EXTI_LINE_DTS1)
293#define __HAL_DTS_EXTI_WAKEUP_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR3, DTS_EXTI_LINE_DTS1)
308#define __HAL_DTS_GET_FLAG(__HANDLE__, __FLAG__) \
309 (((((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__)))? SET : RESET)
324#define __HAL_DTS_CLEAR_FLAG(__HANDLE__, __FLAG__) \
325 ((__HANDLE__)->Instance->ICIFR = (__FLAG__))
340#define __HAL_DTS_ENABLE_IT(__HANDLE__, __INTERRUPT__) \
341 SET_BIT((__HANDLE__)->Instance->ITENR, __INTERRUPT__)
356#define __HAL_DTS_DISABLE_IT(__HANDLE__,__INTERRUPT__) \
357 CLEAR_BIT((__HANDLE__)->Instance->ITENR, __INTERRUPT__)
372#define __HAL_DTS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
373 (( ((__HANDLE__)->Instance->ITENR & (__INTERRUPT__)) == (__INTERRUPT__) \
385#define __HAL_DTS_GET_REFCLK(__HANDLE__, __REFCLK__) ((((__HANDLE__)->Instance->CFGR1 & (__REFCLK__)) == (__REFCLK__))? SET : RESET)
396#define __HAL_DTS_GET_TRIGGER(__HANDLE__) ((__HANDLE__)->Instance->CFGR1 & (DTS_CFGR1_TS1_INTRIG_SEL))
412void HAL_DTS_MspInit(DTS_HandleTypeDef *hdts);
413void HAL_DTS_MspDeInit(DTS_HandleTypeDef *hdts);
414#if (USE_HAL_DTS_REGISTER_CALLBACKS == 1)
416 HAL_DTS_CallbackIDTypeDef CallbackID,
417 pDTS_CallbackTypeDef pCallback);
419 HAL_DTS_CallbackIDTypeDef CallbackID);
431HAL_StatusTypeDef HAL_DTS_GetTemperature(DTS_HandleTypeDef *hdts, int32_t *Temperature);
434void HAL_DTS_IRQHandler(DTS_HandleTypeDef *hdts);
435HAL_DTS_StateTypeDef HAL_DTS_GetState(DTS_HandleTypeDef *hdts);
437void HAL_DTS_EndCallback(DTS_HandleTypeDef *hdts);
438void HAL_DTS_LowCallback(DTS_HandleTypeDef *hdts);
439void HAL_DTS_HighCallback(DTS_HandleTypeDef *hdts);
440void HAL_DTS_AsyncEndCallback(DTS_HandleTypeDef *hdts);
441void HAL_DTS_AsyncLowCallback(DTS_HandleTypeDef *hdts);
442void HAL_DTS_AsyncHighCallback(DTS_HandleTypeDef *hdts);
460#define DTS_EXTI_LINE_DTS1 (EXTI_IMR3_IM88)
478#define IS_DTS_QUICKMEAS(__SEL__) (((__SEL__) == DTS_QUICKMEAS_DISABLE) || \
479 ((__SEL__) == DTS_QUICKMEAS_ENABLE))
481#define IS_DTS_REFCLK(__SEL__) (((__SEL__) == DTS_REFCLKSEL_LSE) || \
482 ((__SEL__) == DTS_REFCLKSEL_PCLK))
484#define IS_DTS_TRIGGERINPUT(__INPUT__) (((__INPUT__) == DTS_TRIGGER_HW_NONE) || \
485 ((__INPUT__) == DTS_TRIGGER_LPTIMER1) || \
486 ((__INPUT__) == DTS_TRIGGER_LPTIMER2) || \
487 ((__INPUT__) == DTS_TRIGGER_LPTIMER3) || \
488 ((__INPUT__) == DTS_TRIGGER_EXTI13))
490#define IS_DTS_THRESHOLD(__THRESHOLD__) ((__THRESHOLD__) <= 0xFFFFUL)
492#define IS_DTS_DIVIDER_RATIO_NUMBER(__NUMBER__) ((__NUMBER__) <= 127UL)
494#define IS_DTS_SAMPLINGTIME(__CYCLE__) (((__CYCLE__) == DTS_SMP_TIME_1_CYCLE) || \
495 ((__CYCLE__) == DTS_SMP_TIME_2_CYCLE) || \
496 ((__CYCLE__) == DTS_SMP_TIME_3_CYCLE) || \
497 ((__CYCLE__) == DTS_SMP_TIME_4_CYCLE) || \
498 ((__CYCLE__) == DTS_SMP_TIME_5_CYCLE) || \
499 ((__CYCLE__) == DTS_SMP_TIME_6_CYCLE) || \
500 ((__CYCLE__) == DTS_SMP_TIME_7_CYCLE) || \
501 ((__CYCLE__) == DTS_SMP_TIME_8_CYCLE) || \
502 ((__CYCLE__) == DTS_SMP_TIME_9_CYCLE) || \
503 ((__CYCLE__) == DTS_SMP_TIME_10_CYCLE) || \
504 ((__CYCLE__) == DTS_SMP_TIME_11_CYCLE) || \
505 ((__CYCLE__) == DTS_SMP_TIME_12_CYCLE) || \
506 ((__CYCLE__) == DTS_SMP_TIME_13_CYCLE) || \
507 ((__CYCLE__) == DTS_SMP_TIME_14_CYCLE) || \
508 ((__CYCLE__) == DTS_SMP_TIME_15_CYCLE))
#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
DTS.
Definition: stm32h723xx.h:1504