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