1 /**
2 **********************************************************************************************************************
3 * @file stm32h5xx_hal_opamp_ex.c
4 * @author MCD Application Team
5 * @brief Extended OPAMP HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the operational amplifier(s) peripheral:
8 * + Extended Initialization and de-initialization functions
9 * + Extended Peripheral Control functions
10 *
11 @verbatim
12 **********************************************************************************************************************
13 * @attention
14 *
15 * Copyright (c) 2022 STMicroelectronics.
16 * All rights reserved.
17 *
18 * This software is licensed under terms that can be found in the LICENSE file
19 * in the root directory of this software component.
20 * If no LICENSE file comes with this software, it is provided AS-IS.
21 *
22 **********************************************************************************************************************
23 */
24
25 /* Includes ----------------------------------------------------------------------------------------------------------*/
26 #include "stm32h5xx_hal.h"
27
28 /** @addtogroup STM32H5xx_HAL_Driver
29 * @{
30 */
31
32 /** @defgroup OPAMPEx OPAMPEx
33 * @brief OPAMP Extended HAL module driver
34 * @{
35 */
36
37 #ifdef HAL_OPAMP_MODULE_ENABLED
38
39 /* Private typedef ---------------------------------------------------------------------------------------------------*/
40 /* Private define ----------------------------------------------------------------------------------------------------*/
41 /* Private macro -----------------------------------------------------------------------------------------------------*/
42 /* Private variables -------------------------------------------------------------------------------------------------*/
43 /* Private function prototypes ---------------------------------------------------------------------------------------*/
44 /* Exported functions ------------------------------------------------------------------------------------------------*/
45
46 /** @defgroup OPAMPEx_Exported_Functions OPAMP Extended Exported Functions
47 * @{
48 */
49
50 /** @defgroup OPAMPEx_Exported_Functions_Group1 Peripheral Control functions
51 * @brief Peripheral Control functions
52 *
53 @verbatim
54 =======================================================================================================================
55 ##### Peripheral Control functions #####
56 =======================================================================================================================
57 [..]
58 (+) OPAMP unlock.
59
60 @endverbatim
61 * @{
62 */
63
64 /**
65 * @brief Unlock the selected OPAMP configuration.
66 * @note This function must be called only when OPAMP is in state "locked".
67 * @param hopamp: OPAMP handle
68 * @retval HAL status
69 */
HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef * hopamp)70 HAL_StatusTypeDef HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef *hopamp)
71 {
72 HAL_StatusTypeDef status = HAL_OK;
73
74 /* Check the OPAMP handle allocation */
75 /* Check if OPAMP locked */
76 if (hopamp == NULL)
77 {
78 status = HAL_ERROR;
79 }
80 /* Check the OPAMP handle allocation */
81 /* Check if OPAMP locked */
82 else if (hopamp->State == HAL_OPAMP_STATE_BUSYLOCKED)
83 {
84 /* Check the parameter */
85 assert_param(IS_OPAMP_ALL_INSTANCE(hopamp->Instance));
86
87 /* OPAMP state changed to locked */
88 hopamp->State = HAL_OPAMP_STATE_BUSY;
89 }
90 else
91 {
92 status = HAL_ERROR;
93 }
94
95 return status;
96 }
97
98 /**
99 * @}
100 */
101
102 /**
103 * @}
104 */
105
106 /**
107 * @}
108 */
109
110 /**
111 * @}
112 */
113
114 #endif /* HAL_OPAMP_MODULE_ENABLED */
115