1 /** 2 **************************************************************************************** 3 * 4 * @file gr55xx_hal_adc.h 5 * @author BLE Driver Team 6 * @brief Header file containing functions prototypes of ADC HAL library. 7 * 8 **************************************************************************************** 9 * @attention 10 #####Copyright (c) 2019 GOODIX 11 All rights reserved. 12 13 Redistribution and use in source and binary forms, with or without 14 modification, are permitted provided that the following conditions are met: 15 * Redistributions of source code must retain the above copyright 16 notice, this list of conditions and the following disclaimer. 17 * Redistributions in binary form must reproduce the above copyright 18 notice, this list of conditions and the following disclaimer in the 19 documentation and/or other materials provided with the distribution. 20 * Neither the name of GOODIX nor the names of its contributors may be used 21 to endorse or promote products derived from this software without 22 specific prior written permission. 23 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 POSSIBILITY OF SUCH DAMAGE. 35 **************************************************************************************** 36 */ 37 38 /** @addtogroup PERIPHERAL Peripheral Driver 39 * @{ 40 */ 41 42 /** @addtogroup HAL_DRIVER HAL Driver 43 * @{ 44 */ 45 46 /** @defgroup HAL_ADC ADC 47 * @brief ADC HAL module driver. 48 * @{ 49 */ 50 51 /* Define to prevent recursive inclusion -------------------------------------*/ 52 #ifndef __GR55xx_HAL_ADC_H__ 53 #define __GR55xx_HAL_ADC_H__ 54 55 /* Includes ------------------------------------------------------------------*/ 56 #include "gr55xx_ll_adc.h" 57 #include "gr55xx_hal_def.h" 58 #include "gr55xx_hal_dma.h" 59 60 #ifdef __cplusplus 61 extern "C" { 62 #endif 63 64 /* Exported types ------------------------------------------------------------*/ 65 /** @addtogroup HAL_ADC_ENUMERATIONS Enumerations 66 * @{ 67 */ 68 69 /** @defgroup HAL_ADC_state HAL ADC State 70 * @{ 71 */ 72 73 /** 74 * @brief HAL ADC State Enumerations definition 75 */ 76 typedef enum { 77 HAL_ADC_STATE_RESET = 0x00, /**< Peripheral not initialized */ 78 HAL_ADC_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ 79 HAL_ADC_STATE_BUSY = 0x02, /**< An internal process is ongoing */ 80 HAL_ADC_STATE_ERROR = 0x04 /**< Peripheral in error */ 81 } hal_adc_state_t; 82 83 /** @} */ 84 85 /** @} */ 86 87 /** @addtogroup HAL_ADC_STRUCTURES Structures 88 * @{ 89 */ 90 91 /** @defgroup ADC_Configuration ADC Configuration 92 * @{ 93 */ 94 95 /** 96 * @brief ADC init structure definition 97 */ 98 typedef ll_adc_init_t adc_init_t; 99 /** @} */ 100 101 /** @defgroup ADC_handle ADC Handle 102 * @{ 103 */ 104 105 /** 106 * @brief ADC handle Structure definition 107 */ 108 typedef struct _adc_handle { 109 adc_init_t init; /**< ADC configuration parameters */ 110 111 uint16_t *p_buffer; /**< Pointer to ADC conversion buffer */ 112 113 __IO uint32_t buff_size; /**< Conversion buffer size */ 114 115 __IO uint32_t buff_count; /**< Conversion buffer counter */ 116 117 dma_handle_t *p_dma; /**< ADC DMA Handle parameters */ 118 119 __IO hal_lock_t lock; /**< Locking object */ 120 121 __IO hal_adc_state_t state; /**< ADC communication state */ 122 123 __IO uint32_t error_code; /**< ADC error code */ 124 125 uint32_t retention[2]; /**< ADC important register information. */ 126 } adc_handle_t; 127 /** @} */ 128 129 /** @} */ 130 131 /** @addtogroup HAL_ADC_CALLBACK_STRUCTURES Callback Structures 132 * @{ 133 */ 134 135 /** @defgroup ADC_Callback ADC Callback 136 * @{ 137 */ 138 139 /** 140 * @brief HAL ADC Callback function definition 141 */ 142 typedef struct _adc_callback { 143 void (*adc_msp_init)(adc_handle_t *p_adc); /**< ADC init MSP callback */ 144 void (*adc_msp_deinit)(adc_handle_t *p_adc); /**< ADC de-init MSP callback */ 145 void (*adc_conv_cplt_callback)(adc_handle_t *p_adc); /**< ADC conversion completed callback */ 146 } adc_callback_t; 147 148 /** @} */ 149 150 /** @} */ 151 152 /** 153 * @brief ADC init structure definition 154 */ 155 156 /** 157 * @defgroup HAL_ADC_MACRO Defines 158 * @{ 159 */ 160 161 /* Exported constants --------------------------------------------------------*/ 162 /** @defgroup ADC_Exported_Constants ADC Exported Constants 163 * @{ 164 */ 165 166 /** @defgroup ADC_Error_Code ADC Error Code 167 * @{ 168 */ 169 #define HAL_ADC_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ 170 #define HAL_ADC_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ 171 #define HAL_ADC_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error */ 172 #define HAL_ADC_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameter error */ 173 /** @} */ 174 175 /** @defgroup ADC_CLK ADC Clock Select 176 * @{ 177 */ 178 #define ADC_CLK_16M LL_ADC_CLK_16 /**< ADC Clock = 16 MHz */ 179 #define ADC_CLK_1P6M LL_ADC_CLK_1P6 /**< ADC Clock = 1.6 MHz */ 180 #define ADC_CLK_8M LL_ADC_CLK_8 /**< ADC Clock = 8 MHz */ 181 #define ADC_CLK_4M LL_ADC_CLK_4 /**< ADC Clock = 4 MHz */ 182 #define ADC_CLK_2M LL_ADC_CLK_2 /**< ADC Clock = 2 MHz */ 183 #define ADC_CLK_1M LL_ADC_CLK_1 /**< ADC Clock = 1 MHz */ 184 /** @} */ 185 186 /** @defgroup ADC_REFERENCE ADC Reference Value Select 187 * @{ 188 */ 189 #define ADC_REF_VALUE_0P8 LL_ADC_REF_VALUE_0P8 /**< Reference = 0.85 V */ 190 #define ADC_REF_VALUE_1P2 LL_ADC_REF_VALUE_1P2 /**< Reference = 1.28 V */ 191 #define ADC_REF_VALUE_1P6 LL_ADC_REF_VALUE_1P6 /**< Reference = 1.60 V */ 192 /** @} */ 193 194 /** @defgroup ADC_INPUT_MODE ADC Input Mode 195 * @brief Single or Differential mode 196 * @{ 197 */ 198 #define ADC_INPUT_SINGLE LL_ADC_INPUT_SINGLE /**< Single ended mode */ 199 #define ADC_INPUT_DIFFERENTIAL LL_ADC_INPUT_DIFFERENTIAL/**< Differential mode */ 200 /** @} */ 201 202 /** @defgroup ADC_INPUT_SOURCE ADC Input Channel Select 203 * @{ 204 */ 205 #define ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO0 /**< Select MSIO0 as input */ 206 #define ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO1 /**< Select MSIO1 as input */ 207 #define ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO2 /**< Select MSIO2 as input */ 208 #define ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO3 /**< Select MSIO3 as input */ 209 #define ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_IO4 /**< Select MSIO4 as input */ 210 #define ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_TMP /**< Select temperature as input */ 211 #define ADC_INPUT_SRC_BAT LL_ADC_INPUT_SRC_BAT /**< Select Vbattery as input */ 212 #define ADC_INPUT_SRC_REF LL_ADC_INPUT_SRC_REF /**< Select reference as input */ 213 214 /** @} */ 215 216 /** @defgroup ADC_REFERENCE_SOURCE ADC Reference Source Select 217 * @{ 218 */ 219 #define ADC_REF_SRC_BUF_INT LL_ADC_REF_SRC_BUF_INT /**< Select buffered internal reference as reference */ 220 #define ADC_REF_SRC_IO0 LL_ADC_REF_SRC_IO0 /**< Select MSIO0 as reference */ 221 #define ADC_REF_SRC_IO1 LL_ADC_REF_SRC_IO1 /**< Select MSIO1 as reference */ 222 #define ADC_REF_SRC_IO2 LL_ADC_REF_SRC_IO2 /**< Select MSIO2 as reference */ 223 #define ADC_REF_SRC_IO3 LL_ADC_REF_SRC_IO3 /**< Select MSIO3 as reference */ 224 /** @} */ 225 226 /** 227 * @brief ADC_default_config initStruct default configuartion 228 */ 229 #define ADC_DEFAULT_CONFIG LL_ADC_DEFAULT_CONFIG 230 /** @} */ 231 232 /* Exported macro ------------------------------------------------------------*/ 233 /** @defgroup ADC_Exported_Macros ADC Exported Macros 234 * @{ 235 */ 236 237 /** @brief Reset ADC handle states. 238 * @param __HANDLE__ ADC handle. 239 * @retval None 240 */ 241 #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_ADC_STATE_RESET) 242 243 /** @brief Enable the specified ADC peripheral. 244 * @param __HANDLE__ Specify the ADC Handle. 245 * @retval None 246 */ 247 #define __HAL_ADC_ENABLE(__HANDLE__) ll_adc_enable() 248 249 /** @brief Disable the specified ADC peripheral. 250 * @param __HANDLE__ Specify the ADC Handle. 251 * @retval None 252 */ 253 #define __HAL_ADC_DISABLE(__HANDLE__) ll_adc_disable() 254 255 /** @brief Enable the specified ADC clock. 256 * @param __HANDLE__ Specify the ADC Handle. 257 * @retval None 258 */ 259 #define __HAL_ADC_ENABLE_CLOCK(__HANDLE__) ll_adc_enable_clock() 260 261 /** @brief Disable the specified ADC clock. 262 * @param __HANDLE__ Specify the ADC Handle. 263 * @retval None 264 */ 265 #define __HAL_ADC_DISABLE_CLOCK(__HANDLE__) ll_adc_disable_clock() 266 267 /** @brief Check the FIFO is not empty. 268 * @param __HANDLE__ Specify the ADC Handle. 269 * @retval The new state of notempty flag (TRUE or FALSE). 270 */ 271 #define __HAL_ADC_GET_FLAG_NOTEMPTY(__HANDLE__) ll_adc_is_fifo_notempty() 272 273 /** @brief Flush the FIFO. 274 * @param __HANDLE__ Specify the ADC Handle. 275 * @retval None 276 */ 277 #define __HAL_ADC_FLUSH_FIFO(__HANDLE__) \ 278 do { \ 279 while (ll_adc_is_fifo_notempty()) \ 280 { \ 281 ll_adc_read_fifo(); \ 282 } \ 283 } while (0) 284 285 /** @} */ 286 287 /* Private macros ------------------------------------------------------------*/ 288 /** @addtogroup ADC_Private_Macros ADC Private Macros 289 * @{ 290 */ 291 292 /** 293 * @brief Check if ADC input source is valid. 294 * @param __INPUT__ ADC input source. 295 * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid) 296 */ 297 #define IS_ADC_INPUT(__INPUT__) (((__INPUT__) == ADC_INPUT_SRC_IO0) || \ 298 ((__INPUT__) == ADC_INPUT_SRC_IO1) || \ 299 ((__INPUT__) == ADC_INPUT_SRC_IO2) || \ 300 ((__INPUT__) == ADC_INPUT_SRC_IO3) || \ 301 ((__INPUT__) == ADC_INPUT_SRC_IO4) || \ 302 ((__INPUT__) == ADC_INPUT_SRC_TMP) || \ 303 ((__INPUT__) == ADC_INPUT_SRC_BAT) || \ 304 ((__INPUT__) == ADC_INPUT_SRC_REF)) 305 306 /** 307 * @brief Check if ADC input mode is valid. 308 * @param __MODE__ ADC input mode. 309 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) 310 */ 311 #define IS_ADC_INPUT_MODE(__MODE__) (((__MODE__) == ADC_INPUT_SINGLE) || \ 312 ((__MODE__) == ADC_INPUT_DIFFERENTIAL) 313 314 /** 315 * @brief Check if ADC reference source is valid. 316 * @param __INPUT__ ADC reference source. 317 * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid) 318 */ 319 #define IS_ADC_REF(__INPUT__) (((__INPUT__) == ADC_REF_SRC_BUF_INT) || \ 320 ((__INPUT__) == ADC_REF_SRC_INT) || \ 321 ((__INPUT__) == ADC_REF_SRC_IO0) || \ 322 ((__INPUT__) == ADC_REF_SRC_IO1) || \ 323 ((__INPUT__) == ADC_REF_SRC_IO2) || \ 324 ((__INPUT__) == ADC_REF_SRC_IO3)) 325 326 /** 327 * @brief Check if ADC reference value is valid. 328 * @param __VALUE__ ADC reference value. 329 * @retval SET (__VALUE__ is valid) or RESET (__VALUE__ is invalid) 330 */ 331 #define IS_ADC_REF_VALUE(__VALUE__) (((__VALUE__) >= ADC_REF_VALUE_0P8) && \ 332 ((__VALUE__) <= ADC_REF_VALUE_1P6)) 333 334 /** 335 * @brief Check if ADC clock is valid. 336 * @param __CLOCK__ ADC clock. 337 * @retval SET (__CLOCK__ is valid) or RESET (__CLOCK__ is invalid) 338 */ 339 #define IS_ADC_CLOCK(__CLOCK__) (((__CLOCK__) == ADC_CLK_16M) || \ 340 ((__CLOCK__) == ADC_CLK_8M) || \ 341 ((__CLOCK__) == ADC_CLK_4M) || \ 342 ((__CLOCK__) == ADC_CLK_2M) || \ 343 ((__CLOCK__) == ADC_CLK_1M) || \ 344 ((__CLOCK__) == ADC_CLK_1P6M)) 345 346 /** @} */ 347 348 /** @} */ 349 350 /* Exported functions --------------------------------------------------------*/ 351 /** @addtogroup HAL_ADC_DRIVER_FUNCTIONS Functions 352 * @{ 353 */ 354 355 /** @addtogroup ADC_Exported_Functions_Group1 Initialization and de-initialization Functions 356 * @brief Initialization and Configuration functions 357 * @{ 358 */ 359 360 /** 361 **************************************************************************************** 362 * @brief Initialize the ADC according to the specified parameters 363 * in the adc_init_t and initialize the associated handle. 364 * 365 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 366 * the specified ADC module. 367 * 368 * @retval ::HAL_OK: Operation is OK. 369 * @retval ::HAL_ERROR: Parameter error or operation not supported. 370 * @retval ::HAL_BUSY: Driver is busy. 371 * @retval ::HAL_TIMEOUT: Timeout occurred. 372 **************************************************************************************** 373 */ 374 hal_status_t hal_adc_init(adc_handle_t *p_adc); 375 376 /** 377 **************************************************************************************** 378 * @brief De-initialize the ADC peripheral. 379 * 380 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 381 * the specified ADC module. 382 * 383 * @retval ::HAL_OK: Operation is OK. 384 * @retval ::HAL_ERROR: Parameter error or operation not supported. 385 * @retval ::HAL_BUSY: Driver is busy. 386 * @retval ::HAL_TIMEOUT: Timeout occurred. 387 **************************************************************************************** 388 */ 389 hal_status_t hal_adc_deinit(adc_handle_t *p_adc); 390 391 /** 392 **************************************************************************************** 393 * @brief Initialize the ADC MSP. 394 * 395 * @note This function should not be modified. When the callback is needed, 396 * the hal_adc_msp_deinit can be implemented in the user file. 397 * 398 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 399 * the specified ADC module. 400 **************************************************************************************** 401 */ 402 void hal_adc_msp_init(adc_handle_t *p_adc); 403 404 /** 405 **************************************************************************************** 406 * @brief De-initialize the ADC MSP. 407 * 408 * @note This function should not be modified. When the callback is needed, 409 * the hal_adc_msp_deinit can be implemented in the user file. 410 * 411 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 412 * the specified ADC module. 413 **************************************************************************************** 414 */ 415 void hal_adc_msp_deinit(adc_handle_t *p_adc); 416 417 /** @} */ 418 419 /** @addtogroup ADC_Exported_Functions_Group2 IO Operation Functions 420 * @brief ADC polling and DMA conversion management functions. 421 * @{ 422 */ 423 424 /** 425 **************************************************************************************** 426 * @brief Set the FIFO threshold for DMA trigger. 427 * 428 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 429 * the specified ADC module. 430 * @param[in] threshold: FIFO threshold value ranging bwtween 0x0U ~ 0x64U. 431 * 432 * @retval ::HAL_OK: Operation is OK. 433 * @retval ::HAL_ERROR: Parameter error or operation not supported. 434 * @retval ::HAL_BUSY: Driver is busy. 435 * @retval ::HAL_TIMEOUT: Timeout occurred. 436 **************************************************************************************** 437 */ 438 hal_status_t hal_adc_set_dma_threshold(adc_handle_t *p_adc, uint32_t threshold); 439 440 /** 441 **************************************************************************************** 442 * @brief Get the FIFO threshold for DMA trigger. 443 * 444 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 445 * the specified ADC module. 446 * 447 * @return FIFO threshold 448 **************************************************************************************** 449 */ 450 uint32_t hal_adc_get_dma_threshold(adc_handle_t *p_adc); 451 452 /** 453 **************************************************************************************** 454 * @brief Polling for conversion. 455 * 456 * @param[in] p_adc: Pointer to an ADC handle. 457 * @param[in] p_data: Pointer to data buffer which to store ADC conversion results. 458 * @param[in] length: Length of data buffer. 459 * 460 * @retval ::HAL_OK: Operation is OK. 461 * @retval ::HAL_ERROR: Parameter error or operation not supported. 462 * @retval ::HAL_BUSY: Driver is busy. 463 * @retval ::HAL_TIMEOUT: Timeout occurred. 464 **************************************************************************************** 465 */ 466 hal_status_t hal_adc_poll_for_conversion(adc_handle_t *p_adc, uint16_t *p_data, uint32_t length); 467 468 /** 469 **************************************************************************************** 470 * @brief DMA for conversion. 471 * 472 * @param[in] p_adc: Pointer to an ADC handle. 473 * @param[in] p_data: Pointer to data buffer which to store ADC conversion results. 474 * @param[in] length: Length of data buffer, ranging between 0 and 4095. 475 * 476 * @retval ::HAL_OK: Operation is OK. 477 * @retval ::HAL_ERROR: Parameter error or operation not supported. 478 * @retval ::HAL_BUSY: Driver is busy. 479 * @retval ::HAL_TIMEOUT: Timeout occurred. 480 **************************************************************************************** 481 */ 482 hal_status_t hal_adc_start_dma(adc_handle_t *p_adc, uint16_t *p_data, uint32_t length); 483 484 /** 485 **************************************************************************************** 486 * @brief Abort ongoing conversion (blocking mode). 487 * 488 * @note This procedure could be only used for aborting conversion started in DMA mode. 489 * This procedure performs following operations: 490 * - Disable ADC clock, stop conversion 491 * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) 492 * - Set handle State to READY. 493 * This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. 494 * 495 * @param[in] p_adc: ADC handle. 496 * 497 * @retval ::HAL_OK: Operation is OK. 498 * @retval ::HAL_ERROR: Parameter error or operation not supported. 499 * @retval ::HAL_BUSY: Driver is busy. 500 * @retval ::HAL_TIMEOUT: Timeout occurred. 501 **************************************************************************************** 502 */ 503 hal_status_t hal_adc_stop_dma(adc_handle_t *p_adc); 504 505 /** 506 **************************************************************************************** 507 * @brief Conversion completed callback. 508 * 509 * @note This function should not be modified. When the callback is needed, 510 * the hal_adc_msp_deinit can be implemented in the user file. 511 * 512 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 513 * the specified ADC module. 514 **************************************************************************************** 515 */ 516 void hal_adc_conv_cplt_callback(adc_handle_t* p_adc); 517 518 /** @} */ 519 520 /** @defgroup ADC_Exported_Functions_Group3 Peripheral State and Errors Functions 521 * @brief ADC control functions 522 * 523 @verbatim 524 =============================================================================== 525 ##### Peripheral State and Errors functions ##### 526 =============================================================================== 527 [..] 528 This subsection provides a set of functions allowing to control the ADC. 529 (+) hal_adc_get_state() API can be helpful to check in run-time the state of the ADC peripheral. 530 (+) hal_adc_get_error() check in run-time Errors occurring during communication. 531 @endverbatim 532 * @{ 533 */ 534 535 /** 536 **************************************************************************************** 537 * @brief Return the ADC handle state. 538 * 539 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 540 * the specified ADC module. 541 * 542 * @retval ::HAL_ADC_STATE_RESET: Peripheral not initialized. 543 * @retval ::HAL_ADC_STATE_READY: Peripheral initialized and ready for use. 544 * @retval ::HAL_ADC_STATE_BUSY: An internal process is ongoing. 545 * @retval ::HAL_ADC_STATE_ERROR: Peripheral in error. 546 **************************************************************************************** 547 */ 548 hal_adc_state_t hal_adc_get_state(adc_handle_t *p_adc); 549 550 /** 551 **************************************************************************************** 552 * @brief Return the ADC error code. 553 * 554 * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for 555 * the specified ADC module. 556 * 557 * @return ADC error code in bitmap format 558 **************************************************************************************** 559 */ 560 uint32_t hal_adc_get_error(adc_handle_t *p_adc); 561 562 /** 563 **************************************************************************************** 564 * @brief Suspend some registers related to ADC configuration before sleep. 565 * @param[in] p_adc: Pointer to a ADC handle which contains the configuration 566 * information for the specified ADC module. 567 * @retval ::HAL_OK: Operation is OK. 568 * @retval ::HAL_ERROR: Parameter error or operation not supported. 569 * @retval ::HAL_BUSY: Driver is busy. 570 * @retval ::HAL_TIMEOUT: Timeout occurred. 571 **************************************************************************************** 572 */ 573 hal_status_t hal_adc_suspend_reg(adc_handle_t *p_adc); 574 575 /** 576 **************************************************************************************** 577 * @brief Restore some registers related to ADC configuration after sleep. 578 * This function must be used in conjunction with the hal_adc_suspend_reg(). 579 * @param[in] p_adc: Pointer to a ADC handle which contains the configuration 580 * information for the specified ADC module. 581 * @retval ::HAL_OK: Operation is OK. 582 * @retval ::HAL_ERROR: Parameter error or operation not supported. 583 * @retval ::HAL_BUSY: Driver is busy. 584 * @retval ::HAL_TIMEOUT: Timeout occurred. 585 **************************************************************************************** 586 */ 587 hal_status_t hal_adc_resume_reg(adc_handle_t *p_adc); 588 589 /** @} */ 590 591 /** @} */ 592 593 #ifdef __cplusplus 594 } 595 #endif 596 597 #endif /* __GR55xx_HAL_ADC_H__ */ 598 599 /** @} */ 600 601 /** @} */ 602 603 /** @} */ 604