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) 2023 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 #if defined (OPAMP1)
40 
41 /* Private typedef ---------------------------------------------------------------------------------------------------*/
42 /* Private define ----------------------------------------------------------------------------------------------------*/
43 /* Private macro -----------------------------------------------------------------------------------------------------*/
44 /* Private variables -------------------------------------------------------------------------------------------------*/
45 /* Private function prototypes ---------------------------------------------------------------------------------------*/
46 /* Exported functions ------------------------------------------------------------------------------------------------*/
47 
48 /** @defgroup OPAMPEx_Exported_Functions OPAMP Extended Exported Functions
49   * @{
50   */
51 
52 /** @defgroup OPAMPEx_Exported_Functions_Group1 Peripheral Control functions
53   *  @brief    Peripheral Control functions
54   *
55 @verbatim
56  =======================================================================================================================
57                                         ##### Peripheral Control functions #####
58  =======================================================================================================================
59     [..]
60       (+) OPAMP unlock.
61 
62 @endverbatim
63   * @{
64   */
65 
66 /**
67   * @brief  Unlock the selected OPAMP configuration.
68   * @note   This function must be called only when OPAMP is in state "locked".
69   * @param  hopamp: OPAMP handle
70   * @retval HAL status
71   */
HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef * hopamp)72 HAL_StatusTypeDef HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef *hopamp)
73 {
74   HAL_StatusTypeDef status = HAL_OK;
75 
76   /* Check the OPAMP handle allocation */
77   /* Check if OPAMP locked */
78   if (hopamp == NULL)
79   {
80     status = HAL_ERROR;
81   }
82   /* Check the OPAMP handle allocation */
83   /* Check if OPAMP locked */
84   else if (hopamp->State == HAL_OPAMP_STATE_BUSYLOCKED)
85   {
86     /* Check the parameter */
87     assert_param(IS_OPAMP_ALL_INSTANCE(hopamp->Instance));
88 
89     /* OPAMP state changed to locked */
90     hopamp->State = HAL_OPAMP_STATE_BUSY;
91   }
92   else
93   {
94     status = HAL_ERROR;
95   }
96 
97   return status;
98 }
99 
100 /**
101   * @}
102   */
103 
104 /**
105   * @}
106   */
107 
108 /**
109   * @}
110   */
111 
112 /**
113   * @}
114   */
115 
116 #endif /* OPAMP1 */
117 
118 #endif /* HAL_OPAMP_MODULE_ENABLED */
119