1 /**
2   **********************************************************************************************************************
3   * @file    stm32h5xx_hal_dts.h
4   * @author  MCD Application Team
5   * @brief   Header file of DTS HAL module.
6   **********************************************************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2022 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   **********************************************************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/
20 #ifndef __STM32H5xx_HAL_DTS_H
21 #define __STM32H5xx_HAL_DTS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #if defined(DTS)
28 /* Includes ----------------------------------------------------------------------------------------------------------*/
29 #include "stm32h5xx_hal_def.h"
30 
31 /** @addtogroup STM32H5xx_HAL_Driver
32   * @{
33   */
34 
35 /** @addtogroup DTS
36   * @{
37   */
38 
39 /* Exported types ----------------------------------------------------------------------------------------------------*/
40 /** @defgroup DTS_Exported_Types DTS Exported Types
41   * @{
42   */
43 
44 /**
45   * @brief  DTS Init structure definition
46   */
47 typedef struct
48 {
49   uint32_t QuickMeasure;  /*!< Specifies the quick measure option selection of the DTS sensor.
50                                This parameter can be a value of @ref DTS_Quick_Measurement         */
51 
52   uint32_t RefClock;      /*!< Specifies the reference clock selection of the DTS sensor.
53                                This parameter can be a value of @ref DTS_Reference_Clock_Selection */
54 
55   uint32_t TriggerInput;  /*!< Specifies the trigger input of the DTS sensor.
56                                This parameter can be a value of @ref DTS_TriggerConfig             */
57 
58   uint32_t SamplingTime;  /*!< Specifies the sampling time configuration.
59                                This parameter can be a value of @ref DTS_Sampling_Time             */
60 
61   uint32_t Divider;       /*!< Specifies the high speed clock divider ratio.
62                                This parameter can be a value from 0 to 127                         */
63 
64   uint32_t HighThreshold; /*!< Specifies the high threshold of the DTS sensor                      */
65 
66   uint32_t LowThreshold;  /*!< Specifies the low threshold of the DTS sensor                       */
67 
68 } DTS_InitTypeDef;
69 
70 /**
71   * @brief  HAL State structures definition
72   */
73 typedef enum
74 {
75   HAL_DTS_STATE_RESET   = 0x00UL,     /*!< DTS not yet initialized or disabled */
76   HAL_DTS_STATE_READY   = 0x01UL,     /*!< DTS initialized and ready for use   */
77   HAL_DTS_STATE_BUSY    = 0x02UL,     /*!< DTS is running                      */
78   HAL_DTS_STATE_TIMEOUT = 0x03UL,     /*!< Timeout state                       */
79   HAL_DTS_STATE_ERROR   = 0x04UL      /*!< Internal Process error              */
80 
81 } HAL_DTS_StateTypeDef;
82 
83 /**
84   * @brief  DTS Handle Structure definition
85   */
86 #if (USE_HAL_DTS_REGISTER_CALLBACKS == 1U)
87 typedef struct __DTS_HandleTypeDef
88 #else
89 typedef struct
90 #endif /* USE_HAL_DTS_REGISTER_CALLBACKS */
91 {
92   DTS_TypeDef                *Instance;                               /*!< Register base address                      */
93   DTS_InitTypeDef            Init;                                    /*!< DTS required parameters                    */
94   HAL_LockTypeDef            Lock;                                    /*!< DTS Locking object                         */
95   __IO HAL_DTS_StateTypeDef  State;                                   /*!< DTS peripheral state                       */
96 
97 #if (USE_HAL_DTS_REGISTER_CALLBACKS == 1U)
98   void (* MspInitCallback)(struct __DTS_HandleTypeDef *hdts);         /*!< DTS Base Msp Init Callback                 */
99   void (* MspDeInitCallback)(struct __DTS_HandleTypeDef *hdts);       /*!< DTS Base Msp DeInit Callback               */
100   void (* EndCallback)(struct __DTS_HandleTypeDef *hdts);             /*!< End measure Callback                       */
101   void (* LowCallback)(struct __DTS_HandleTypeDef *hdts);             /*!< low threshold Callback                     */
102   void (* HighCallback)(struct __DTS_HandleTypeDef *hdts);            /*!< high threshold Callback                    */
103   void (* AsyncEndCallback)(struct __DTS_HandleTypeDef *hdts);        /*!< Asynchronous end of measure Callback       */
104   void (* AsyncLowCallback)(struct __DTS_HandleTypeDef *hdts);        /*!< Asynchronous low threshold Callback        */
105   void (* AsyncHighCallback)(struct __DTS_HandleTypeDef *hdts);       /*!< Asynchronous high threshold Callback       */
106 #endif /* USE_HAL_DTS_REGISTER_CALLBACKS */
107 } DTS_HandleTypeDef;
108 
109 #if (USE_HAL_DTS_REGISTER_CALLBACKS == 1U)
110 /**
111   * @brief  DTS callback ID enumeration definition
112   */
113 typedef enum
114 {
115   HAL_DTS_MEAS_COMPLETE_CB_ID        = 0x00U, /*!< Measure complete callback ID */
116   HAL_DTS_ASYNC_MEAS_COMPLETE_CB_ID  = 0x01U, /*!< Asynchronous measure complete callback ID */
117   HAL_DTS_LOW_THRESHOLD_CB_ID        = 0x02U, /*!< Low threshold detection callback ID */
118   HAL_DTS_ASYNC_LOW_THRESHOLD_CB_ID  = 0x03U, /*!< Asynchronous low threshold detection callback ID */
119   HAL_DTS_HIGH_THRESHOLD_CB_ID       = 0x04U, /*!< High threshold detection callback ID */
120   HAL_DTS_ASYNC_HIGH_THRESHOLD_CB_ID = 0x05U, /*!< Asynchronous high threshold detection callback ID */
121   HAL_DTS_MSPINIT_CB_ID              = 0x06U, /*!< MSP init callback ID */
122   HAL_DTS_MSPDEINIT_CB_ID            = 0x07U  /*!< MSP de-init callback ID */
123 } HAL_DTS_CallbackIDTypeDef;
124 
125 /**
126   * @brief  DTS callback pointers definition
127   */
128 typedef void (*pDTS_CallbackTypeDef)(DTS_HandleTypeDef *hdts);
129 #endif /* USE_HAL_DTS_REGISTER_CALLBACKS */
130 
131 /**
132   * @}
133   */
134 
135 /* Exported constants ------------------------------------------------------------------------------------------------*/
136 /** @defgroup DTS_Exported_Constants DTS Exported Constants
137   * @{
138   */
139 
140 /** @defgroup DTS_TriggerConfig  DTS Trigger Configuration
141   * @{
142   */
143 /* @brief No Hardware trigger detection */
144 #define DTS_TRIGGER_HW_NONE   (0UL)
145 
146 /* @brief External Interrupt Mode with LPTIMER1 trigger detection */
147 #define DTS_TRIGGER_LPTIMER1  DTS_CFGR1_TS1_INTRIG_SEL_0
148 
149 /* @brief External Interrupt Mode with LPTIMER2 trigger detection */
150 #define DTS_TRIGGER_LPTIMER2  DTS_CFGR1_TS1_INTRIG_SEL_1
151 
152 #if defined(LPTIM3)
153 /* @brief External Interrupt Mode with LPTIMER3 trigger detection */
154 #define DTS_TRIGGER_LPTIMER3 (DTS_CFGR1_TS1_INTRIG_SEL_0 | DTS_CFGR1_TS1_INTRIG_SEL_1)
155 #endif /* defined(LPTIM3) */
156 
157 /* @brief External Interrupt Mode with EXTI13 trigger detection */
158 #define DTS_TRIGGER_EXTI13    DTS_CFGR1_TS1_INTRIG_SEL_2
159 /**
160   * @}
161   */
162 
163 /** @defgroup DTS_Quick_Measurement  DTS Quick Measurement
164   * @{
165   */
166 #define DTS_QUICKMEAS_ENABLE    DTS_CFGR1_Q_MEAS_OPT /*!< Enable the Quick Measure (Measure without calibration) */
167 #define DTS_QUICKMEAS_DISABLE   (0x0UL)              /*!< Disable the Quick Measure (Measure with calibration)   */
168 /**
169   * @}
170   */
171 
172 /** @defgroup DTS_Reference_Clock_Selection   DTS Reference Clock Selection
173   * @{
174   */
175 #define DTS_REFCLKSEL_LSE   DTS_CFGR1_REFCLK_SEL /*!< Low speed REF clock (LSE)   */
176 #define DTS_REFCLKSEL_PCLK (0UL)                 /*!< High speed REF clock (PCLK) */
177 /**
178   * @}
179   */
180 
181 /** @defgroup DTS_Sampling_Time   DTS Sampling Time
182   * @{
183   */
184 #define DTS_SMP_TIME_1_CYCLE     DTS_CFGR1_TS1_SMP_TIME_0   /*!< 1 clock cycle for the sampling time  */
185 #define DTS_SMP_TIME_2_CYCLE     DTS_CFGR1_TS1_SMP_TIME_1   /*!< 2 clock cycle for the sampling time  */
186 #define DTS_SMP_TIME_3_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_0 |\
187                                  DTS_CFGR1_TS1_SMP_TIME_1)  /*!< 3 clock cycle for the sampling time  */
188 #define DTS_SMP_TIME_4_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_2)  /*!< 4 clock cycle for the sampling time  */
189 #define DTS_SMP_TIME_5_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_0 |\
190                                  DTS_CFGR1_TS1_SMP_TIME_2)  /*!< 5 clock cycle for the sampling time  */
191 #define DTS_SMP_TIME_6_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_1 |\
192                                  DTS_CFGR1_TS1_SMP_TIME_2)  /*!< 6 clock cycle for the sampling time  */
193 #define DTS_SMP_TIME_7_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_0 |\
194                                  DTS_CFGR1_TS1_SMP_TIME_1 |\
195                                  DTS_CFGR1_TS1_SMP_TIME_2)  /*!< 7 clock cycle for the sampling time  */
196 #define DTS_SMP_TIME_8_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 8 clock cycle for the sampling time  */
197 #define DTS_SMP_TIME_9_CYCLE    (DTS_CFGR1_TS1_SMP_TIME_0 |\
198                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 9 clock cycle for the sampling time  */
199 #define DTS_SMP_TIME_10_CYCLE   (DTS_CFGR1_TS1_SMP_TIME_1 |\
200                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 10 clock cycle for the sampling time */
201 #define DTS_SMP_TIME_11_CYCLE   (DTS_CFGR1_TS1_SMP_TIME_0 |\
202                                  DTS_CFGR1_TS1_SMP_TIME_1 |\
203                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 11 clock cycle for the sampling time */
204 #define DTS_SMP_TIME_12_CYCLE   (DTS_CFGR1_TS1_SMP_TIME_2 |\
205                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 12 clock cycle for the sampling time */
206 #define DTS_SMP_TIME_13_CYCLE   (DTS_CFGR1_TS1_SMP_TIME_0 |\
207                                  DTS_CFGR1_TS1_SMP_TIME_2 |\
208                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 13 clock cycle for the sampling time */
209 #define DTS_SMP_TIME_14_CYCLE   (DTS_CFGR1_TS1_SMP_TIME_1 |\
210                                  DTS_CFGR1_TS1_SMP_TIME_2 |\
211                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 14 clock cycle for the sampling time */
212 #define DTS_SMP_TIME_15_CYCLE   (DTS_CFGR1_TS1_SMP_TIME_0 |\
213                                  DTS_CFGR1_TS1_SMP_TIME_1 |\
214                                  DTS_CFGR1_TS1_SMP_TIME_2 |\
215                                  DTS_CFGR1_TS1_SMP_TIME_3)  /*!< 15 clock cycle for the sampling time */
216 /**
217   * @}
218   */
219 
220 /** @defgroup DTS_Flag_Definitions DTS Flag Definitions
221   * @{
222   */
223 #define DTS_FLAG_TS1_ITE   DTS_SR_TS1_ITEF   /*!< Interrupt flag for end of measure for DTS1              */
224 #define DTS_FLAG_TS1_ITL   DTS_SR_TS1_ITLF   /*!< Interrupt flag for low threshold for DTS1               */
225 #define DTS_FLAG_TS1_ITH   DTS_SR_TS1_ITHF   /*!< Interrupt flag for high threshold for DTS1              */
226 #define DTS_FLAG_TS1_AITE  DTS_SR_TS1_AITEF  /*!< Asynchronous Interrupt flag for end of measure for DTS1 */
227 #define DTS_FLAG_TS1_AITL  DTS_SR_TS1_AITLF  /*!< Asynchronous Interrupt flag for low threshold for DTS1  */
228 #define DTS_FLAG_TS1_AITH  DTS_SR_TS1_AITHF  /*!< Asynchronous Interrupt flag for high threshold for DTS1 */
229 #define DTS_FLAG_TS1_RDY   DTS_SR_TS1_RDY    /*!< Ready flag for DTS1                                     */
230 /**
231   * @}
232   */
233 
234 /** @defgroup DTS_Interrupts_Definitions DTS Interrupts Definitions
235   * @{
236   */
237 #define DTS_IT_TS1_ITE  DTS_ITENR_TS1_ITEEN   /*!< Enable interrupt flag for end of measure for DTS1              */
238 #define DTS_IT_TS1_ITL  DTS_ITENR_TS1_ITLEN   /*!< Enable interrupt flag for low threshold for DTS1               */
239 #define DTS_IT_TS1_ITH  DTS_ITENR_TS1_ITHEN   /*!< Enable interrupt flag for high threshold for DTS1              */
240 #define DTS_IT_TS1_AITE DTS_ITENR_TS1_AITEEN  /*!< Enable asynchronous interrupt flag for end of measure for DTS1 */
241 #define DTS_IT_TS1_AITL DTS_ITENR_TS1_AITLEN  /*!< Enable asynchronous interrupt flag for low threshold for DTS1  */
242 #define DTS_IT_TS1_AITH DTS_ITENR_TS1_AITHEN  /*!< Enable asynchronous interrupt flag for high threshold for DTS1 */
243 /**
244   * @}
245   */
246 
247 /**
248   * @}
249   */
250 /* Exported macros ---------------------------------------------------------------------------------------------------*/
251 /** @defgroup DTS_Exported_Macros DTS Exported Macros
252   * @{
253   */
254 
255 /** @brief  Reset DTS handle state
256   * @param  __HANDLE__ DTS handle.
257   * @retval None
258   */
259 #if (USE_HAL_DTS_REGISTER_CALLBACKS == 1U)
260 #define __HAL_DTS_RESET_HANDLE_STATE(__HANDLE__) do{                                             \
261                                                       (__HANDLE__)->State = HAL_DTS_STATE_RESET; \
262                                                       (__HANDLE__)->MspInitCallback = NULL;      \
263                                                       (__HANDLE__)->MspDeInitCallback = NULL;    \
264                                                     } while(0)
265 #else /* USE_HAL_DTS_REGISTER_CALLBACKS */
266 #define __HAL_DTS_RESET_HANDLE_STATE(__HANDLE__)    ((__HANDLE__)->State = HAL_DTS_STATE_RESET)
267 #endif /* USE_HAL_DTS_REGISTER_CALLBACKS */
268 
269 /**
270   * @brief  Enable the specified DTS sensor
271   * @param  __HANDLE__ DTS handle.
272   * @retval None
273   */
274 #define __HAL_DTS_ENABLE(__HANDLE__)  SET_BIT((__HANDLE__)->Instance->CFGR1, DTS_CFGR1_TS1_EN)
275 
276 /**
277   * @brief  Disable the specified DTS sensor
278   * @param  __HANDLE__ DTS handle.
279   * @retval None
280   */
281 #define __HAL_DTS_DISABLE(__HANDLE__)    CLEAR_BIT((__HANDLE__)->Instance->CFGR1, DTS_CFGR1_TS1_EN)
282 
283 /**
284   * @brief  Enable the DTS EXTI line in interrupt mode
285   * @retval None
286   */
287 #define __HAL_DTS_EXTI_WAKEUP_ENABLE_IT()  SET_BIT(EXTI->IMR2, DTS_EXTI_LINE_DTS1)
288 
289 /**
290   * @brief  Disable the DTS EXTI line in interrupt mode
291   * @retval None
292   */
293 #define __HAL_DTS_EXTI_WAKEUP_DISABLE_IT()  CLEAR_BIT(EXTI->IMR2, DTS_EXTI_LINE_DTS1)
294 
295 /**
296   * @brief  Enable the DTS EXTI Line in event mode
297   * @retval None
298   */
299 #define __HAL_DTS_EXTI_WAKEUP_ENABLE_EVENT() SET_BIT(EXTI->EMR2, DTS_EXTI_LINE_DTS1)
300 
301 /**
302   * @brief  Disable the DTS EXTI Line in event mode
303   * @retval None
304   */
305 #define __HAL_DTS_EXTI_WAKEUP_DISABLE_EVENT()  CLEAR_BIT(EXTI->EMR2, DTS_EXTI_LINE_DTS1)
306 
307 /** @brief  Checks whether the specified DTS flag is set or not.
308   * @param  __HANDLE__ specifies the DTS Handle.
309   * @param  __FLAG__ specifies the flag to check.
310   *        This parameter can be one of the following values:
311   *            @arg DTS_FLAG_TS1_ITE : interrupt flag for end of measure for DTS1
312   *            @arg DTS_FLAG_TS1_ITL : interrupt flag for low threshold for DTS1
313   *            @arg DTS_FLAG_TS1_ITH : interrupt flag for high threshold for DTS1
314   *            @arg DTS_FLAG_TS1_AITE: asynchronous interrupt flag for end of measure for DTS1
315   *            @arg DTS_FLAG_TS1_AITL: asynchronous interrupt flag for low threshold for DTS1
316   *            @arg DTS_FLAG_TS1_AITH: asynchronous interrupt flag for high threshold for DTS1
317   *            @arg DTS_FLAG_TS1_RDY : Ready flag for DTS1
318   *            @retval The new state of __FLAG__ (SET or RESET).
319   */
320 #define __HAL_DTS_GET_FLAG(__HANDLE__, __FLAG__)  \
321   (((((__HANDLE__)->Instance->SR &(__FLAG__)) == (__FLAG__)))? SET : RESET)
322 
323 
324 /** @brief  Clears the specified DTS pending flag.
325   * @param  __HANDLE__ specifies the DTS Handle.
326   * @param  __FLAG__ specifies the flag to check.
327   *          This parameter can be any combination of the following values:
328   *            @arg DTS_FLAG_TS1_ITE : interrupt flag for end of measure for DTS1
329   *            @arg DTS_FLAG_TS1_ITL : interrupt flag for low threshold for DTS1
330   *            @arg DTS_FLAG_TS1_ITH : interrupt flag for high threshold for DTS1
331   *            @arg DTS_FLAG_TS1_AITE: asynchronous interrupt flag for end of measure for DTS1
332   *            @arg DTS_FLAG_TS1_AITL: asynchronous interrupt flag for low threshold for DTS1
333   *            @arg DTS_FLAG_TS1_AITH: asynchronous interrupt flag for high threshold for DTS1
334   * @retval None
335   */
336 #define __HAL_DTS_CLEAR_FLAG(__HANDLE__, __FLAG__)  \
337   ((__HANDLE__)->Instance->ICIFR  = (__FLAG__))
338 
339 
340 /** @brief  Enable the specified DTS interrupt.
341   * @param  __HANDLE__ specifies the DTS Handle.
342   * @param  __INTERRUPT__ specifies the DTS interrupt source to enable.
343   *          This parameter can be one of the following values:
344   *            @arg DTS_IT_TS1_ITE  : interrupt flag for end of measure for DTS1
345   *            @arg DTS_IT_TS1_ITL  : interrupt flag for low of measure for DTS1
346   *            @arg DTS_IT_TS1_ITH  : interrupt flag for high of measure for DTS1
347   *            @arg DTS_IT_TS1_AITE : asynchronous interrupt flag for end of measure for DTS1
348   *            @arg DTS_IT_TS1_AITL : asynchronous interrupt flag for low of measure for DTS1
349   *            @arg DTS_IT_TS1_AITH : asynchronous interrupt flag for high of measure for DTS1
350   * @retval None
351   */
352 #define __HAL_DTS_ENABLE_IT(__HANDLE__, __INTERRUPT__)  \
353   SET_BIT((__HANDLE__)->Instance->ITENR, __INTERRUPT__)
354 
355 
356 /** @brief  Disable the specified DTS interrupt.
357   * @param  __HANDLE__ specifies the DTS Handle.
358   * @param  __INTERRUPT__ specifies the DTS interrupt source to enable.
359   *          This parameter can be one of the following values:
360   *            @arg DTS_IT_TS1_ITE  : interrupt flag for end of measure for DTS1
361   *            @arg DTS_IT_TS1_ITL  : interrupt flag for low of measure for DTS1
362   *            @arg DTS_IT_TS1_ITH  : interrupt flag for high of measure for DTS1
363   *            @arg DTS_IT_TS1_AITE : asynchronous interrupt flag for end of measure for DTS1
364   *            @arg DTS_IT_TS1_AITL : asynchronous interrupt flag for low of measure for DTS1
365   *            @arg DTS_IT_TS1_AITH : asynchronous interrupt flag for high of measure for DTS1
366   * @retval None
367   */
368 #define __HAL_DTS_DISABLE_IT(__HANDLE__,__INTERRUPT__)  \
369   CLEAR_BIT((__HANDLE__)->Instance->ITENR, __INTERRUPT__)
370 
371 
372 /** @brief  Check whether the specified DTS interrupt source is enabled or not.
373   * @param __HANDLE__ DTS handle.
374   * @param __INTERRUPT__ DTS interrupt source to check
375   *          This parameter can be one of the following values:
376   *            @arg DTS_IT_TS1_ITE  : interrupt flag for end of measure for DTS1
377   *            @arg DTS_IT_TS1_ITL  : interrupt flag for low of measure for DTS1
378   *            @arg DTS_IT_TS1_ITH  : interrupt flag for high of measure for DTS1
379   *            @arg DTS_IT_TS1_AITE : asynchronous interrupt flag for end of measure for DTS1
380   *            @arg DTS_IT_TS1_AITL : asynchronous interrupt flag for low of measure for DTS1
381   *            @arg DTS_IT_TS1_AITH : asynchronous interrupt flag for high of measure for DTS1
382   * @retval State of interruption (SET or RESET)
383   */
384 #define __HAL_DTS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)  \
385   (( ((__HANDLE__)->Instance->ITENR & (__INTERRUPT__)) == (__INTERRUPT__))? SET : RESET)
386 
387 
388 /** @brief  Check whether the specified DTS REFCLK is selected
389   * @param __HANDLE__ DTS handle.
390   * @param __REFCLK__ DTS reference clock to check
391   *          This parameter can be one of the following values:
392   * @arg DTS_REFCLKSEL_LSE:   Low speed REF clock
393   * @arg DTS_REFCLKSEL_PCLK:  High speed REF clock
394   * @retval State of the REF clock tested (SET or RESET)
395   */
396 #define __HAL_DTS_GET_REFCLK(__HANDLE__, __REFCLK__)  \
397   ((((__HANDLE__)->Instance->CFGR1 & (__REFCLK__)) == (__REFCLK__))? SET : RESET)
398 
399 /** @brief  Get Trigger
400   * @param __HANDLE__ DTS handle.
401   * @retval One of the following trigger
402   *     DTS_TRIGGER_HW_NONE : No HW trigger (SW trigger)
403   *     DTS_TRIGGER_LPTIMER1: LPTIMER1 trigger
404   *     DTS_TRIGGER_LPTIMER2: LPTIMER2 trigger
405   *     DTS_TRIGGER_LPTIMER3: LPTIMER3 trigger
406   *     DTS_TRIGGER_EXTI13  : EXTI13 trigger
407   */
408 #define __HAL_DTS_GET_TRIGGER(__HANDLE__)  ((__HANDLE__)->Instance->CFGR1 & (DTS_CFGR1_TS1_INTRIG_SEL))
409 /**
410   * @}
411   */
412 
413 /* Exported functions ------------------------------------------------------------------------------------------------*/
414 /** @addtogroup DTS_Exported_Functions
415   * @{
416   */
417 
418 /** @addtogroup DTS_Exported_Functions_Group1
419   * @{
420   */
421 /* Initialization and de-initialization functions */
422 HAL_StatusTypeDef HAL_DTS_Init(DTS_HandleTypeDef *hdts);
423 HAL_StatusTypeDef HAL_DTS_DeInit(DTS_HandleTypeDef *hdts);
424 void              HAL_DTS_MspInit(DTS_HandleTypeDef *hdts);
425 void              HAL_DTS_MspDeInit(DTS_HandleTypeDef *hdts);
426 #if (USE_HAL_DTS_REGISTER_CALLBACKS == 1U)
427 HAL_StatusTypeDef HAL_DTS_RegisterCallback(DTS_HandleTypeDef        *hdts,
428                                            HAL_DTS_CallbackIDTypeDef CallbackID,
429                                            pDTS_CallbackTypeDef      pCallback);
430 HAL_StatusTypeDef HAL_DTS_UnRegisterCallback(DTS_HandleTypeDef        *hdts,
431                                              HAL_DTS_CallbackIDTypeDef CallbackID);
432 #endif /* USE_HAL_DTS_REGISTER_CALLBACKS */
433 /**
434   * @}
435   */
436 
437 
438 /** @addtogroup DTS_Exported_Functions_Group2
439   * @{
440   */
441 /* IO operation functions */
442 HAL_StatusTypeDef HAL_DTS_Start(DTS_HandleTypeDef *hdts);
443 HAL_StatusTypeDef HAL_DTS_Stop(DTS_HandleTypeDef *hdts);
444 HAL_StatusTypeDef HAL_DTS_GetTemperature(DTS_HandleTypeDef *hdts, int32_t *Temperature);
445 HAL_StatusTypeDef HAL_DTS_Start_IT(DTS_HandleTypeDef *hdts);
446 HAL_StatusTypeDef HAL_DTS_Stop_IT(DTS_HandleTypeDef *hdts);
447 void              HAL_DTS_IRQHandler(DTS_HandleTypeDef *hdts);
448 HAL_DTS_StateTypeDef HAL_DTS_GetState(DTS_HandleTypeDef *hdts);
449 
450 /* Callback in Interrupt mode */
451 void HAL_DTS_EndCallback(DTS_HandleTypeDef *hdts);
452 void HAL_DTS_LowCallback(DTS_HandleTypeDef *hdts);
453 void HAL_DTS_HighCallback(DTS_HandleTypeDef *hdts);
454 void HAL_DTS_AsyncEndCallback(DTS_HandleTypeDef *hdts);
455 void HAL_DTS_AsyncLowCallback(DTS_HandleTypeDef *hdts);
456 void HAL_DTS_AsyncHighCallback(DTS_HandleTypeDef *hdts);
457 /**
458   * @}
459   */
460 
461 /* Private types -----------------------------------------------------------------------------------------------------*/
462 /* Private constants -------------------------------------------------------------------------------------------------*/
463 /** @defgroup DTS_Private_Constants DTS Private Constants
464   * @{
465   */
466 /** @defgroup DTS_ExtiLine DTS EXTI Lines
467   * @{
468   */
469 #define DTS_EXTI_LINE_DTS1   (EXTI_IMR2_IM50)  /*!< EXTI line 50 connected to DTS1 output */
470 /**
471   * @}
472   */
473 /**
474   * @}
475   */
476 
477 /* Private macros ----------------------------------------------------------------------------------------------------*/
478 /** @defgroup DTS_Private_Macros DTS Private Macros
479   * @{
480   */
481 
482 /** @defgroup DTS_IS_DTS_Definitions  DTS Private macros to check input parameters
483   * @{
484   */
485 #define IS_DTS_QUICKMEAS(__SEL__)   (((__SEL__) == DTS_QUICKMEAS_DISABLE) || \
486                                      ((__SEL__) == DTS_QUICKMEAS_ENABLE))
487 
488 #define IS_DTS_REFCLK(__SEL__)      (((__SEL__) == DTS_REFCLKSEL_LSE) || \
489                                      ((__SEL__) == DTS_REFCLKSEL_PCLK))
490 #if defined(LPTIM3)
491 #define IS_DTS_TRIGGERINPUT(__INPUT__)  (((__INPUT__) == DTS_TRIGGER_HW_NONE)   || \
492                                          ((__INPUT__) == DTS_TRIGGER_LPTIMER1)  || \
493                                          ((__INPUT__) == DTS_TRIGGER_LPTIMER2)  || \
494                                          ((__INPUT__) == DTS_TRIGGER_LPTIMER3)  || \
495                                          ((__INPUT__) == DTS_TRIGGER_EXTI13))
496 #else
497 #define IS_DTS_TRIGGERINPUT(__INPUT__)  (((__INPUT__) == DTS_TRIGGER_HW_NONE)   || \
498                                          ((__INPUT__) == DTS_TRIGGER_LPTIMER1)  || \
499                                          ((__INPUT__) == DTS_TRIGGER_LPTIMER2)  || \
500                                          ((__INPUT__) == DTS_TRIGGER_EXTI13))
501 #endif /* defined(LPTIM3) */
502 
503 #define IS_DTS_THRESHOLD(__THRESHOLD__)  ((__THRESHOLD__) <= 0xFFFFUL)
504 
505 #define IS_DTS_DIVIDER_RATIO_NUMBER(__NUMBER__) ((__NUMBER__) <= 127UL)
506 
507 #define IS_DTS_SAMPLINGTIME(__CYCLE__)  (((__CYCLE__) == DTS_SMP_TIME_1_CYCLE)  || \
508                                          ((__CYCLE__) == DTS_SMP_TIME_2_CYCLE)    || \
509                                          ((__CYCLE__) == DTS_SMP_TIME_3_CYCLE)    || \
510                                          ((__CYCLE__) == DTS_SMP_TIME_4_CYCLE)    || \
511                                          ((__CYCLE__) == DTS_SMP_TIME_5_CYCLE)    || \
512                                          ((__CYCLE__) == DTS_SMP_TIME_6_CYCLE)    || \
513                                          ((__CYCLE__) == DTS_SMP_TIME_7_CYCLE)    || \
514                                          ((__CYCLE__) == DTS_SMP_TIME_8_CYCLE)    || \
515                                          ((__CYCLE__) == DTS_SMP_TIME_9_CYCLE)    || \
516                                          ((__CYCLE__) == DTS_SMP_TIME_10_CYCLE)   || \
517                                          ((__CYCLE__) == DTS_SMP_TIME_11_CYCLE)   || \
518                                          ((__CYCLE__) == DTS_SMP_TIME_12_CYCLE)   || \
519                                          ((__CYCLE__) == DTS_SMP_TIME_13_CYCLE)   || \
520                                          ((__CYCLE__) == DTS_SMP_TIME_14_CYCLE)   || \
521                                          ((__CYCLE__) == DTS_SMP_TIME_15_CYCLE))
522 
523 /**
524   * @}
525   */
526 
527 /**
528   * @}
529   */
530 
531 /* Private functions -------------------------------------------------------------------------------------------------*/
532 
533 /**
534   * @}
535   */
536 
537 /**
538   * @}
539   */
540 
541 #endif /* DTS */
542 
543 #ifdef __cplusplus
544 }
545 #endif
546 
547 #endif /* __STM32H5xx_HAL_DTS_H */
548