mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
90:cb3d968589d8
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 90:cb3d968589d8 1 /**
Kojto 90:cb3d968589d8 2 ******************************************************************************
Kojto 90:cb3d968589d8 3 * @file stm32f3xx_hal_opamp.h
Kojto 90:cb3d968589d8 4 * @author MCD Application Team
Kojto 90:cb3d968589d8 5 * @version V1.1.0
Kojto 90:cb3d968589d8 6 * @date 12-Sept-2014
Kojto 90:cb3d968589d8 7 * @brief Header file of OPAMP HAL module.
Kojto 90:cb3d968589d8 8 ******************************************************************************
Kojto 90:cb3d968589d8 9 * @attention
Kojto 90:cb3d968589d8 10 *
Kojto 90:cb3d968589d8 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 90:cb3d968589d8 12 *
Kojto 90:cb3d968589d8 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 90:cb3d968589d8 14 * are permitted provided that the following conditions are met:
Kojto 90:cb3d968589d8 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 90:cb3d968589d8 16 * this list of conditions and the following disclaimer.
Kojto 90:cb3d968589d8 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 90:cb3d968589d8 18 * this list of conditions and the following disclaimer in the documentation
Kojto 90:cb3d968589d8 19 * and/or other materials provided with the distribution.
Kojto 90:cb3d968589d8 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 90:cb3d968589d8 21 * may be used to endorse or promote products derived from this software
Kojto 90:cb3d968589d8 22 * without specific prior written permission.
Kojto 90:cb3d968589d8 23 *
Kojto 90:cb3d968589d8 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 90:cb3d968589d8 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 90:cb3d968589d8 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 90:cb3d968589d8 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 90:cb3d968589d8 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 90:cb3d968589d8 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 90:cb3d968589d8 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 90:cb3d968589d8 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 90:cb3d968589d8 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 90:cb3d968589d8 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 90:cb3d968589d8 34 *
Kojto 90:cb3d968589d8 35 ******************************************************************************
Kojto 90:cb3d968589d8 36 */
Kojto 90:cb3d968589d8 37
Kojto 90:cb3d968589d8 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 90:cb3d968589d8 39 #ifndef __STM32F3xx_HAL_OPAMP_H
Kojto 90:cb3d968589d8 40 #define __STM32F3xx_HAL_OPAMP_H
Kojto 90:cb3d968589d8 41
Kojto 90:cb3d968589d8 42 #ifdef __cplusplus
Kojto 90:cb3d968589d8 43 extern "C" {
Kojto 90:cb3d968589d8 44 #endif
Kojto 90:cb3d968589d8 45
Kojto 90:cb3d968589d8 46 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx) || \
Kojto 90:cb3d968589d8 47 defined(STM32F302xC) || defined(STM32F303xC) || defined(STM32F358xx) || \
Kojto 90:cb3d968589d8 48 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
Kojto 90:cb3d968589d8 49 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
Kojto 90:cb3d968589d8 50
Kojto 90:cb3d968589d8 51 /* Includes ------------------------------------------------------------------*/
Kojto 90:cb3d968589d8 52 #include "stm32f3xx_hal_def.h"
Kojto 90:cb3d968589d8 53
Kojto 90:cb3d968589d8 54 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 90:cb3d968589d8 55 * @{
Kojto 90:cb3d968589d8 56 */
Kojto 90:cb3d968589d8 57
Kojto 90:cb3d968589d8 58 /** @addtogroup OPAMP
Kojto 90:cb3d968589d8 59 * @{
Kojto 90:cb3d968589d8 60 */
Kojto 90:cb3d968589d8 61
Kojto 90:cb3d968589d8 62 /* Exported types ------------------------------------------------------------*/
Kojto 90:cb3d968589d8 63 /** @defgroup OPAMP_Exported_Types OPAMP Exported Types
Kojto 90:cb3d968589d8 64 * @{
Kojto 90:cb3d968589d8 65 */
Kojto 90:cb3d968589d8 66
Kojto 90:cb3d968589d8 67 /**
Kojto 90:cb3d968589d8 68 * @brief OPAMP Init structure definition
Kojto 90:cb3d968589d8 69 */
Kojto 90:cb3d968589d8 70
Kojto 90:cb3d968589d8 71 typedef struct
Kojto 90:cb3d968589d8 72 {
Kojto 90:cb3d968589d8 73 uint32_t Mode; /*!< Specifies the OPAMP mode
Kojto 90:cb3d968589d8 74 This parameter must be a value of @ref OPAMP_Mode
Kojto 90:cb3d968589d8 75 mode is either Standalone, - Follower or PGA */
Kojto 90:cb3d968589d8 76
Kojto 90:cb3d968589d8 77 uint32_t InvertingInput; /*!< Specifies the inverting input in Standalone & Pga modes
Kojto 90:cb3d968589d8 78 - In Standalone mode: i.e when mode is OPAMP_STANDALONE_MODE
Kojto 90:cb3d968589d8 79 This parameter must be a value of @ref OPAMP_InvertingInput
Kojto 90:cb3d968589d8 80 InvertingInput is either VM0 or VM1
Kojto 90:cb3d968589d8 81 - In PGA mode: i.e when mode is OPAMP_PGA_MODE
Kojto 90:cb3d968589d8 82 & in Follower mode i.e when mode is OPAMP_FOLLOWER_MODE
Kojto 90:cb3d968589d8 83 This parameter is Not Applicable */
Kojto 90:cb3d968589d8 84
Kojto 90:cb3d968589d8 85 uint32_t NonInvertingInput; /*!< Specifies the non inverting input of the opamp:
Kojto 90:cb3d968589d8 86 This parameter must be a value of @ref OPAMP_NonInvertingInput
Kojto 90:cb3d968589d8 87 NonInvertingInput is either VP0, VP1, VP2 or VP3 */
Kojto 90:cb3d968589d8 88
Kojto 90:cb3d968589d8 89 uint32_t TimerControlledMuxmode; /*!< Specifies if the Timer controlled Mux mode is enabled or disabled
Kojto 90:cb3d968589d8 90 This parameter must be a value of @ref OPAMP_TimerControlledMuxmode */
Kojto 90:cb3d968589d8 91
Kojto 90:cb3d968589d8 92 uint32_t InvertingInputSecondary; /*!< Specifies the inverting input (secondary) of the opamp when
Kojto 90:cb3d968589d8 93 TimerControlledMuxmode is enabled
Kojto 90:cb3d968589d8 94 i.e. when TimerControlledMuxmode is OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE
Kojto 90:cb3d968589d8 95 - In Standalone mode: i.e when mode is OPAMP_STANDALONE_MODE
Kojto 90:cb3d968589d8 96 This parameter must be a value of @ref OPAMP_InvertingInputSecondary
Kojto 90:cb3d968589d8 97 InvertingInputSecondary is either VM0 or VM1
Kojto 90:cb3d968589d8 98 - In PGA mode: i.e when mode is OPAMP_PGA_MODE
Kojto 90:cb3d968589d8 99 & in Follower mode i.e when mode is OPAMP_FOLLOWER_MODE
Kojto 90:cb3d968589d8 100 This parameter is Not Applicable */
Kojto 90:cb3d968589d8 101
Kojto 90:cb3d968589d8 102 uint32_t NonInvertingInputSecondary; /*!< Specifies the non inverting input (secondary) of the opamp when
Kojto 90:cb3d968589d8 103 TimerControlledMuxmode is enabled
Kojto 90:cb3d968589d8 104 i.e. when TimerControlledMuxmode is OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE
Kojto 90:cb3d968589d8 105 This parameter must be a value of @ref OPAMP_NonInvertingInputSecondary
Kojto 90:cb3d968589d8 106 NonInvertingInput is either VP0, VP1, VP2 or VP3 */
Kojto 90:cb3d968589d8 107
Kojto 90:cb3d968589d8 108 uint32_t PgaConnect; /*!< Specifies the inverting pin in PGA mode
Kojto 90:cb3d968589d8 109 i.e. when mode is OPAMP_PGA_MODE
Kojto 90:cb3d968589d8 110 This parameter must be a value of @ref OPAMP_PgaConnect
Kojto 90:cb3d968589d8 111 Either: not connected, connected to VM0, connected to VM1
Kojto 90:cb3d968589d8 112 (VM0 or VM1 are typically used for external filtering) */
Kojto 90:cb3d968589d8 113
Kojto 90:cb3d968589d8 114 uint32_t PgaGain; /*!< Specifies the gain in PGA mode
Kojto 90:cb3d968589d8 115 i.e. when mode is OPAMP_PGA_MODE.
Kojto 90:cb3d968589d8 116 This parameter must be a value of @ref OPAMP_PgaGain (2, 4, 8 or 16 ) */
Kojto 90:cb3d968589d8 117
Kojto 90:cb3d968589d8 118 uint32_t UserTrimming; /*!< Specifies the trimming mode
Kojto 90:cb3d968589d8 119 This parameter must be a value of @ref OPAMP_UserTrimming
Kojto 90:cb3d968589d8 120 UserTrimming is either factory or user trimming */
Kojto 90:cb3d968589d8 121
Kojto 90:cb3d968589d8 122 uint32_t TrimmingValueP; /*!< Specifies the offset trimming value (PMOS)
Kojto 90:cb3d968589d8 123 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
Kojto 90:cb3d968589d8 124 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
Kojto 90:cb3d968589d8 125
Kojto 90:cb3d968589d8 126 uint32_t TrimmingValueN; /*!< Specifies the offset trimming value (NMOS)
Kojto 90:cb3d968589d8 127 i.e. when UserTrimming is OPAMP_TRIMMING_USER.
Kojto 90:cb3d968589d8 128 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
Kojto 90:cb3d968589d8 129
Kojto 90:cb3d968589d8 130 }OPAMP_InitTypeDef;
Kojto 90:cb3d968589d8 131
Kojto 90:cb3d968589d8 132 /**
Kojto 90:cb3d968589d8 133 * @brief HAL State structures definition
Kojto 90:cb3d968589d8 134 */
Kojto 90:cb3d968589d8 135
Kojto 90:cb3d968589d8 136 typedef enum
Kojto 90:cb3d968589d8 137 {
Kojto 90:cb3d968589d8 138 HAL_OPAMP_STATE_RESET = 0x00000000, /*!< OPMAP is not yet Initialized */
Kojto 90:cb3d968589d8 139
Kojto 90:cb3d968589d8 140 HAL_OPAMP_STATE_READY = 0x00000001, /*!< OPAMP is initialized and ready for use */
Kojto 90:cb3d968589d8 141 HAL_OPAMP_STATE_CALIBBUSY = 0x00000002, /*!< OPAMP is enabled in auto calibration mode */
Kojto 90:cb3d968589d8 142
Kojto 90:cb3d968589d8 143 HAL_OPAMP_STATE_BUSY = 0x00000004, /*!< OPAMP is enabled and running in normal mode */
Kojto 90:cb3d968589d8 144 HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005, /*!< OPAMP is locked
Kojto 90:cb3d968589d8 145 only system reset allows reconfiguring the opamp. */
Kojto 90:cb3d968589d8 146
Kojto 90:cb3d968589d8 147 }HAL_OPAMP_StateTypeDef;
Kojto 90:cb3d968589d8 148
Kojto 90:cb3d968589d8 149 /**
Kojto 90:cb3d968589d8 150 * @brief OPAMP Handle Structure definition to @brief OPAMP Handle Structure definition
Kojto 90:cb3d968589d8 151 */
Kojto 90:cb3d968589d8 152 typedef struct
Kojto 90:cb3d968589d8 153 {
Kojto 90:cb3d968589d8 154 OPAMP_TypeDef *Instance; /*!< OPAMP instance's registers base address */
Kojto 90:cb3d968589d8 155 OPAMP_InitTypeDef Init; /*!< OPAMP required parameters */
Kojto 90:cb3d968589d8 156 HAL_StatusTypeDef Status; /*!< OPAMP peripheral status */
Kojto 90:cb3d968589d8 157 HAL_LockTypeDef Lock; /*!< Locking object */
Kojto 90:cb3d968589d8 158 __IO HAL_OPAMP_StateTypeDef State; /*!< OPAMP communication state */
Kojto 90:cb3d968589d8 159
Kojto 90:cb3d968589d8 160 } OPAMP_HandleTypeDef;
Kojto 90:cb3d968589d8 161
Kojto 90:cb3d968589d8 162 /**
Kojto 90:cb3d968589d8 163 * @brief OPAMP_TrimmingValueTypeDef @brief definition
Kojto 90:cb3d968589d8 164 */
Kojto 90:cb3d968589d8 165
Kojto 90:cb3d968589d8 166 typedef uint32_t OPAMP_TrimmingValueTypeDef;
Kojto 90:cb3d968589d8 167 /**
Kojto 90:cb3d968589d8 168 * @}
Kojto 90:cb3d968589d8 169 */
Kojto 90:cb3d968589d8 170
Kojto 90:cb3d968589d8 171 /* Exported constants --------------------------------------------------------*/
Kojto 90:cb3d968589d8 172 /** @defgroup OPAMP_Exported_Constants OPAMP Exported Constants
Kojto 90:cb3d968589d8 173 * @{
Kojto 90:cb3d968589d8 174 */
Kojto 90:cb3d968589d8 175
Kojto 90:cb3d968589d8 176 /** @defgroup CSR_INIT CSR init register Mask
Kojto 90:cb3d968589d8 177 * @{
Kojto 90:cb3d968589d8 178 */
Kojto 90:cb3d968589d8 179 /* Used for Init phase */
Kojto 90:cb3d968589d8 180 #define OPAMP_CSR_UPDATE_PARAMETERS_INIT_MASK (OPAMP_CSR_TRIMOFFSETN | OPAMP_CSR_TRIMOFFSETP \
Kojto 90:cb3d968589d8 181 | OPAMP_CSR_USERTRIM | OPAMP_CSR_PGGAIN | OPAMP_CSR_VPSSEL \
Kojto 90:cb3d968589d8 182 | OPAMP_CSR_VMSSEL | OPAMP_CSR_TCMEN | OPAMP_CSR_VPSEL \
Kojto 90:cb3d968589d8 183 | OPAMP_CSR_VPSEL | OPAMP_CSR_FORCEVP)
Kojto 90:cb3d968589d8 184
Kojto 90:cb3d968589d8 185 /**
Kojto 90:cb3d968589d8 186 * @}
Kojto 90:cb3d968589d8 187 */
Kojto 90:cb3d968589d8 188
Kojto 90:cb3d968589d8 189 /** @defgroup OPAMP_Mode OPAMP Mode
Kojto 90:cb3d968589d8 190 * @{
Kojto 90:cb3d968589d8 191 */
Kojto 90:cb3d968589d8 192 #define OPAMP_STANDALONE_MODE ((uint32_t)0x00000000) /*!< standalone mode */
Kojto 90:cb3d968589d8 193 #define OPAMP_PGA_MODE OPAMP_CSR_VMSEL_1 /*!< PGA mode */
Kojto 90:cb3d968589d8 194 #define OPAMP_FOLLOWER_MODE OPAMP_CSR_VMSEL /*!< follower mode */
Kojto 90:cb3d968589d8 195
Kojto 90:cb3d968589d8 196
Kojto 90:cb3d968589d8 197 #define IS_OPAMP_FUNCTIONAL_NORMALMODE(INPUT) (((INPUT) == OPAMP_STANDALONE_MODE) || \
Kojto 90:cb3d968589d8 198 ((INPUT) == OPAMP_PGA_MODE) || \
Kojto 90:cb3d968589d8 199 ((INPUT) == OPAMP_FOLLOWER_MODE))
Kojto 90:cb3d968589d8 200
Kojto 90:cb3d968589d8 201 /**
Kojto 90:cb3d968589d8 202 * @}
Kojto 90:cb3d968589d8 203 */
Kojto 90:cb3d968589d8 204
Kojto 90:cb3d968589d8 205 /** @defgroup OPAMP_NonInvertingInput OPAMP Non Inverting Input
Kojto 90:cb3d968589d8 206 * @{
Kojto 90:cb3d968589d8 207 */
Kojto 90:cb3d968589d8 208
Kojto 90:cb3d968589d8 209 #define OPAMP_NONINVERTINGINPUT_VP0 OPAMP_CSR_VPSEL /*!< VP0 (PA1 for OPAMP1, PA7 for OPAMP2, PB0 for OPAMP3, PB13 for OPAMP4)
Kojto 90:cb3d968589d8 210 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 211 #define OPAMP_NONINVERTINGINPUT_VP1 ((uint32_t)0x00000000) /*!< VP1 (PA7 for OPAMP1, PD14 for OPAMP2, PB13 for OPAMP3, PD11 for OPAMP4)
Kojto 90:cb3d968589d8 212 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 213 #define OPAMP_NONINVERTINGINPUT_VP2 OPAMP_CSR_VPSEL_1 /*!< VP2 (PA3 for OPAMP1, PB0 for OPAMP2, PA1 for OPAMP3, PA4 for OPAMP4)
Kojto 90:cb3d968589d8 214 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 215 #define OPAMP_NONINVERTINGINPUT_VP3 OPAMP_CSR_VPSEL_0 /*!< vp3 (PA5 for OPAMP1, PB14 for OPAMP2, PA5 for OPAMP3, PB11 for OPAMP4)
Kojto 90:cb3d968589d8 216 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 217
Kojto 90:cb3d968589d8 218 #define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NONINVERTINGINPUT_VP0) || \
Kojto 90:cb3d968589d8 219 ((INPUT) == OPAMP_NONINVERTINGINPUT_VP1) || \
Kojto 90:cb3d968589d8 220 ((INPUT) == OPAMP_NONINVERTINGINPUT_VP2) || \
Kojto 90:cb3d968589d8 221 ((INPUT) == OPAMP_NONINVERTINGINPUT_VP3))
Kojto 90:cb3d968589d8 222
Kojto 90:cb3d968589d8 223 /**
Kojto 90:cb3d968589d8 224 * @}
Kojto 90:cb3d968589d8 225 */
Kojto 90:cb3d968589d8 226
Kojto 90:cb3d968589d8 227 /** @defgroup OPAMP_InvertingInput OPAMP Inverting Input
Kojto 90:cb3d968589d8 228 * @{
Kojto 90:cb3d968589d8 229 */
Kojto 90:cb3d968589d8 230
Kojto 90:cb3d968589d8 231 #define IOPAMP_INVERTINGINPUT_VM0 ((uint32_t)0x00000000) /*!< inverting input connected to VM0 */
Kojto 90:cb3d968589d8 232 #define IOPAMP_INVERTINGINPUT_VM1 OPAMP_CSR_VMSEL_0 /*!< inverting input connected to VM1 */
Kojto 90:cb3d968589d8 233
Kojto 90:cb3d968589d8 234 #define IS_OPAMP_INVERTING_INPUT(INPUT) (((INPUT) == IOPAMP_INVERTINGINPUT_VM0) || \
Kojto 90:cb3d968589d8 235 ((INPUT) == IOPAMP_INVERTINGINPUT_VM1))
Kojto 90:cb3d968589d8 236
Kojto 90:cb3d968589d8 237 /**
Kojto 90:cb3d968589d8 238 * @}
Kojto 90:cb3d968589d8 239 */
Kojto 90:cb3d968589d8 240
Kojto 90:cb3d968589d8 241 /** @defgroup OPAMP_TimerControlledMuxmode OPAMP Timer Controlled Mux mode
Kojto 90:cb3d968589d8 242 * @{
Kojto 90:cb3d968589d8 243 */
Kojto 90:cb3d968589d8 244 #define OPAMP_TIMERCONTROLLEDMUXMODE_DISABLE ((uint32_t)0x00000000) /*!< Timer controlled Mux mode disabled */
Kojto 90:cb3d968589d8 245 #define OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE OPAMP_CSR_TCMEN /*!< Timer controlled Mux mode enabled */
Kojto 90:cb3d968589d8 246
Kojto 90:cb3d968589d8 247 #define IS_OPAMP_TIMERCONTROLLED_MUXMODE(MUXMODE) (((MUXMODE) == OPAMP_TIMERCONTROLLEDMUXMODE_DISABLE) || \
Kojto 90:cb3d968589d8 248 ((MUXMODE) == OPAMP_TIMERCONTROLLEDMUXMODE_ENABLE))
Kojto 90:cb3d968589d8 249 /**
Kojto 90:cb3d968589d8 250 * @}
Kojto 90:cb3d968589d8 251 */
Kojto 90:cb3d968589d8 252
Kojto 90:cb3d968589d8 253 /** @defgroup OPAMP_NonInvertingInputSecondary OPAMP Non Inverting Input Secondary
Kojto 90:cb3d968589d8 254 * @{
Kojto 90:cb3d968589d8 255 */
Kojto 90:cb3d968589d8 256
Kojto 90:cb3d968589d8 257 #define OPAMP_SEC_NONINVERTINGINPUT_VP0 OPAMP_CSR_VPSSEL /*!< VP0 (PA1 for OPAMP1, PA7 for OPAMP2, PB0 for OPAMP3, PB13 for OPAMP4)
Kojto 90:cb3d968589d8 258 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 259 #define OPAMP_SEC_NONINVERTINGINPUT_VP1 ((uint32_t)0x00000000) /*!< VP1 (PA7 for OPAMP1, PD14 for OPAMP2, PB13 for OPAMP3, PD11 for OPAMP4)
Kojto 90:cb3d968589d8 260 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 261 #define OPAMP_SEC_NONINVERTINGINPUT_VP2 OPAMP_CSR_VPSSEL_1 /*!< VP2 (PA3 for OPAMP1, PB0 for OPAMP2, PA1 for OPAMP3, PA4 for OPAMP4)
Kojto 90:cb3d968589d8 262 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 263 #define OPAMP_SEC_NONINVERTINGINPUT_VP3 OPAMP_CSR_VPSSEL_0 /*!< VP3 (PA5 for OPAMP1, PB14 for OPAMP2, PA5 for OPAMP3, PB11 for OPAMP4)
Kojto 90:cb3d968589d8 264 connected to OPAMPx non inverting input */
Kojto 90:cb3d968589d8 265
Kojto 90:cb3d968589d8 266 #define IS_OPAMP_SEC_NONINVERTINGINPUT(INPUT) (((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP0) || \
Kojto 90:cb3d968589d8 267 ((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP1) || \
Kojto 90:cb3d968589d8 268 ((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP2) || \
Kojto 90:cb3d968589d8 269 ((INPUT) == OPAMP_SEC_NONINVERTINGINPUT_VP3))
Kojto 90:cb3d968589d8 270
Kojto 90:cb3d968589d8 271 /**
Kojto 90:cb3d968589d8 272 * @}
Kojto 90:cb3d968589d8 273 */
Kojto 90:cb3d968589d8 274
Kojto 90:cb3d968589d8 275 /** @defgroup OPAMP_InvertingInputSecondary OPAMP Inverting Input Secondary
Kojto 90:cb3d968589d8 276 * @{
Kojto 90:cb3d968589d8 277 */
Kojto 90:cb3d968589d8 278
Kojto 90:cb3d968589d8 279 #define OPAMP_SEC_INVERTINGINPUT_VM0 ((uint32_t)0x00000000) /*!< VM0 (PC5 for OPAMP1 and OPAMP2, PB10 for OPAMP3 and OPAMP4)
Kojto 90:cb3d968589d8 280 connected to OPAMPx inverting input */
Kojto 90:cb3d968589d8 281 #define OPAMP_SEC_INVERTINGINPUT_VM1 OPAMP_CSR_VMSSEL /*!< VM1 (PA3 for OPAMP1, PA5 for OPAMP2, PB2 for OPAMP3, PD8 for OPAMP4)
Kojto 90:cb3d968589d8 282 connected to OPAMPx inverting input */
Kojto 90:cb3d968589d8 283
Kojto 90:cb3d968589d8 284 #define IS_OPAMP_SEC_INVERTINGINPUT(INPUT) (((INPUT) == OPAMP_SEC_INVERTINGINPUT_VM0) || \
Kojto 90:cb3d968589d8 285 ((INPUT) == OPAMP_SEC_INVERTINGINPUT_VM1))
Kojto 90:cb3d968589d8 286
Kojto 90:cb3d968589d8 287 /**
Kojto 90:cb3d968589d8 288 * @}
Kojto 90:cb3d968589d8 289 */
Kojto 90:cb3d968589d8 290
Kojto 90:cb3d968589d8 291 /** @defgroup OPAMP_PgaConnect OPAMP Pga Connect
Kojto 90:cb3d968589d8 292 * @{
Kojto 90:cb3d968589d8 293 */
Kojto 90:cb3d968589d8 294
Kojto 90:cb3d968589d8 295 #define OPAMP_PGACONNECT_NO ((uint32_t)0x00000000) /*!< In PGA mode, the non inverting input is not connected */
Kojto 90:cb3d968589d8 296 #define OPAMP_PGACONNECT_VM0 OPAMP_CSR_PGGAIN_3 /*!< In PGA mode, the non inverting input is connected to VM0 */
Kojto 90:cb3d968589d8 297 #define OPAMP_PGACONNECT_VM1 (OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_PGGAIN_3) /*!< In PGA mode, the non inverting input is connected to VM1 */
Kojto 90:cb3d968589d8 298
Kojto 90:cb3d968589d8 299 #define IS_OPAMP_PGACONNECT(CONNECT) (((CONNECT) == OPAMP_PGACONNECT_NO) || \
Kojto 90:cb3d968589d8 300 ((CONNECT) == OPAMP_PGACONNECT_VM0) || \
Kojto 90:cb3d968589d8 301 ((CONNECT) == OPAMP_PGACONNECT_VM1))
Kojto 90:cb3d968589d8 302 /**
Kojto 90:cb3d968589d8 303 * @}
Kojto 90:cb3d968589d8 304 */
Kojto 90:cb3d968589d8 305
Kojto 90:cb3d968589d8 306
Kojto 90:cb3d968589d8 307 /** @defgroup OPAMP_PgaGain OPAMP Pga Gain
Kojto 90:cb3d968589d8 308 * @{
Kojto 90:cb3d968589d8 309 */
Kojto 90:cb3d968589d8 310
Kojto 90:cb3d968589d8 311 #define OPAMP_PGA_GAIN_2 ((uint32_t)0x00000000) /*!< PGA gain = 2 */
Kojto 90:cb3d968589d8 312 #define OPAMP_PGA_GAIN_4 OPAMP_CSR_PGGAIN_0 /*!< PGA gain = 4 */
Kojto 90:cb3d968589d8 313 #define OPAMP_PGA_GAIN_8 OPAMP_CSR_PGGAIN_1 /*!< PGA gain = 8 */
Kojto 90:cb3d968589d8 314 #define OPAMP_PGA_GAIN_16 (OPAMP_CSR_PGGAIN_0 | OPAMP_CSR_PGGAIN_1) /*!< PGA gain = 16 */
Kojto 90:cb3d968589d8 315
Kojto 90:cb3d968589d8 316 #define IS_OPAMP_PGA_GAIN(GAIN) (((GAIN) == OPAMP_PGA_GAIN_2) || \
Kojto 90:cb3d968589d8 317 ((GAIN) == OPAMP_PGA_GAIN_4) || \
Kojto 90:cb3d968589d8 318 ((GAIN) == OPAMP_PGA_GAIN_8) || \
Kojto 90:cb3d968589d8 319 ((GAIN) == OPAMP_PGA_GAIN_16))
Kojto 90:cb3d968589d8 320 /**
Kojto 90:cb3d968589d8 321 * @}
Kojto 90:cb3d968589d8 322 */
Kojto 90:cb3d968589d8 323
Kojto 90:cb3d968589d8 324 /** @defgroup OPAMP_UserTrimming OPAMP User Trimming
Kojto 90:cb3d968589d8 325 * @{
Kojto 90:cb3d968589d8 326 */
Kojto 90:cb3d968589d8 327
Kojto 90:cb3d968589d8 328 #define OPAMP_TRIMMING_FACTORY ((uint32_t)0x00000000) /*!< Factory trimming */
Kojto 90:cb3d968589d8 329 #define OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM /*!< User trimming */
Kojto 90:cb3d968589d8 330
Kojto 90:cb3d968589d8 331 #define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_TRIMMING_FACTORY) || \
Kojto 90:cb3d968589d8 332 ((TRIMMING) == OPAMP_TRIMMING_USER))
Kojto 90:cb3d968589d8 333
Kojto 90:cb3d968589d8 334 /** @defgroup OPAMP_FactoryTrimming OPAMP Factory Trimming
Kojto 90:cb3d968589d8 335 * @{
Kojto 90:cb3d968589d8 336 */
Kojto 90:cb3d968589d8 337
Kojto 90:cb3d968589d8 338 #define OPAMP_FACTORYTRIMMING_DUMMY ((uint32_t)0xFFFFFFFF) /*!< Dummy trimming value */
Kojto 90:cb3d968589d8 339
Kojto 90:cb3d968589d8 340 #define OPAMP_FACTORYTRIMMING_N ((uint32_t)0x00000000) /*!< Offset trimming N */
Kojto 90:cb3d968589d8 341 #define OPAMP_FACTORYTRIMMING_P ((uint32_t)0x00000001) /*!< Offset trimming P */
Kojto 90:cb3d968589d8 342
Kojto 90:cb3d968589d8 343 #define IS_OPAMP_FACTORYTRIMMING(TRIMMING) (((TRIMMING) == OPAMP_FACTORYTRIMMING_N) || \
Kojto 90:cb3d968589d8 344 ((TRIMMING) == OPAMP_FACTORYTRIMMING_P))
Kojto 90:cb3d968589d8 345
Kojto 90:cb3d968589d8 346 /**
Kojto 90:cb3d968589d8 347 * @}
Kojto 90:cb3d968589d8 348 */
Kojto 90:cb3d968589d8 349
Kojto 90:cb3d968589d8 350
Kojto 90:cb3d968589d8 351 /** @defgroup OPAMP_TrimmingValue OPAMP Trimming Value
Kojto 90:cb3d968589d8 352 * @{
Kojto 90:cb3d968589d8 353 */
Kojto 90:cb3d968589d8 354
Kojto 90:cb3d968589d8 355 #define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1F)
Kojto 90:cb3d968589d8 356
Kojto 90:cb3d968589d8 357
Kojto 90:cb3d968589d8 358 /**
Kojto 90:cb3d968589d8 359 * @}
Kojto 90:cb3d968589d8 360 */
Kojto 90:cb3d968589d8 361
Kojto 90:cb3d968589d8 362
Kojto 90:cb3d968589d8 363 /** @defgroup OPAMP_Input OPAMP Input
Kojto 90:cb3d968589d8 364 * @{
Kojto 90:cb3d968589d8 365 */
Kojto 90:cb3d968589d8 366
Kojto 90:cb3d968589d8 367 #define OPAMP_INPUT_INVERTING ((uint32_t) 24) /*!< Inverting input */
Kojto 90:cb3d968589d8 368 #define OPAMP_INPUT_NONINVERTING ((uint32_t) 19) /*!< Non inverting input */
Kojto 90:cb3d968589d8 369
Kojto 90:cb3d968589d8 370 #define IS_OPAMP_INPUT(INPUT) (((INPUT) == OPAMP_INPUT_INVERTING) || \
Kojto 90:cb3d968589d8 371 ((INPUT) == OPAMP_INPUT_NONINVERTING))
Kojto 90:cb3d968589d8 372 /**
Kojto 90:cb3d968589d8 373 * @}
Kojto 90:cb3d968589d8 374 */
Kojto 90:cb3d968589d8 375
Kojto 90:cb3d968589d8 376
Kojto 90:cb3d968589d8 377 /** @defgroup OPAMP_VREF OPAMP VREF
Kojto 90:cb3d968589d8 378 * @{
Kojto 90:cb3d968589d8 379 */
Kojto 90:cb3d968589d8 380
Kojto 90:cb3d968589d8 381 #define OPAMP_VREF_3VDDA ((uint32_t)0x00000000) /*!< OPMAP Vref = 3.3% VDDA */
Kojto 90:cb3d968589d8 382 #define OPAMP_VREF_10VDDA OPAMP_CSR_CALSEL_0 /*!< OPMAP Vref = 10% VDDA */
Kojto 90:cb3d968589d8 383 #define OPAMP_VREF_50VDDA OPAMP_CSR_CALSEL_1 /*!< OPMAP Vref = 50% VDDA */
Kojto 90:cb3d968589d8 384 #define OPAMP_VREF_90VDDA OPAMP_CSR_CALSEL /*!< OPMAP Vref = 90% VDDA */
Kojto 90:cb3d968589d8 385
Kojto 90:cb3d968589d8 386 #define IS_OPAMP_VREF(VREF) (((VREF) == OPAMP_VREF_3VDDA) || \
Kojto 90:cb3d968589d8 387 ((VREF) == OPAMP_VREF_10VDDA) || \
Kojto 90:cb3d968589d8 388 ((VREF) == OPAMP_VREF_50VDDA) || \
Kojto 90:cb3d968589d8 389 ((VREF) == OPAMP_VREF_90VDDA))
Kojto 90:cb3d968589d8 390
Kojto 90:cb3d968589d8 391 /**
Kojto 90:cb3d968589d8 392 * @}
Kojto 90:cb3d968589d8 393 */
Kojto 90:cb3d968589d8 394
Kojto 90:cb3d968589d8 395 /** @defgroup OPAMP_Vref2ADCforCalib OPAMP Vref2ADCforCalib
Kojto 90:cb3d968589d8 396 */
Kojto 90:cb3d968589d8 397
Kojto 90:cb3d968589d8 398 #define OPAMP_VREF_NOTCONNECTEDTO_ADC ((uint32_t)0x00000000) /*!< VREF not connected to ADC */
Kojto 90:cb3d968589d8 399 #define OPAMP_VREF_CONNECTEDTO_ADC ((uint32_t)0x00000001) /*!< VREF not connected to ADC */
Kojto 90:cb3d968589d8 400
Kojto 90:cb3d968589d8 401 #define IS_OPAMP_ALLOPAMPVREF_CONNECT(CONNECT) (((CONNECT) == OPAMP_VREF_NOTCONNECTEDTO_ADC) || \
Kojto 90:cb3d968589d8 402 ((CONNECT) == OPAMP_VREF_CONNECTEDTO_ADC))
Kojto 90:cb3d968589d8 403
Kojto 90:cb3d968589d8 404
Kojto 90:cb3d968589d8 405 /**
Kojto 90:cb3d968589d8 406 * @}
Kojto 90:cb3d968589d8 407 */
Kojto 90:cb3d968589d8 408
Kojto 90:cb3d968589d8 409 /**
Kojto 90:cb3d968589d8 410 * @}
Kojto 90:cb3d968589d8 411 */
Kojto 90:cb3d968589d8 412
Kojto 90:cb3d968589d8 413 /* Exported macros -----------------------------------------------------------*/
Kojto 90:cb3d968589d8 414 /** @defgroup OPAMP_Exported_Macros OPAMP Exported Macros
Kojto 90:cb3d968589d8 415 * @{
Kojto 90:cb3d968589d8 416 */
Kojto 90:cb3d968589d8 417
Kojto 90:cb3d968589d8 418 /** @brief Reset OPAMP handle state
Kojto 90:cb3d968589d8 419 * @param __HANDLE__: OPAMP handle.
Kojto 90:cb3d968589d8 420 * @retval None
Kojto 90:cb3d968589d8 421 */
Kojto 90:cb3d968589d8 422 #define __HAL_OPAMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_OPAMP_STATE_RESET)
Kojto 90:cb3d968589d8 423
Kojto 90:cb3d968589d8 424 /**
Kojto 90:cb3d968589d8 425 * @}
Kojto 90:cb3d968589d8 426 */
Kojto 90:cb3d968589d8 427
Kojto 90:cb3d968589d8 428 /* Include OPAMP HAL Extended module */
Kojto 90:cb3d968589d8 429 #include "stm32f3xx_hal_opamp_ex.h"
Kojto 90:cb3d968589d8 430
Kojto 90:cb3d968589d8 431 /* Exported functions --------------------------------------------------------*/
Kojto 90:cb3d968589d8 432 /** @defgroup OPAMP_Exported_Functions OPAMP Exported Functions
Kojto 90:cb3d968589d8 433 * @{
Kojto 90:cb3d968589d8 434 */
Kojto 90:cb3d968589d8 435
Kojto 90:cb3d968589d8 436 /** @defgroup OPAMP_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 90:cb3d968589d8 437 * @{
Kojto 90:cb3d968589d8 438 */
Kojto 90:cb3d968589d8 439
Kojto 90:cb3d968589d8 440 /* Initialization/de-initialization functions **********************************/
Kojto 90:cb3d968589d8 441 HAL_StatusTypeDef HAL_OPAMP_Init(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 442 HAL_StatusTypeDef HAL_OPAMP_DeInit (OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 443 void HAL_OPAMP_MspInit(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 444 void HAL_OPAMP_MspDeInit(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 445 /**
Kojto 90:cb3d968589d8 446 * @}
Kojto 90:cb3d968589d8 447 */
Kojto 90:cb3d968589d8 448
Kojto 90:cb3d968589d8 449
Kojto 90:cb3d968589d8 450 /** @defgroup OPAMP_Exported_Functions_Group2 Input and Output operation functions
Kojto 90:cb3d968589d8 451 * @{
Kojto 90:cb3d968589d8 452 */
Kojto 90:cb3d968589d8 453
Kojto 90:cb3d968589d8 454 /* I/O operation functions *****************************************************/
Kojto 90:cb3d968589d8 455 HAL_StatusTypeDef HAL_OPAMP_Start(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 456 HAL_StatusTypeDef HAL_OPAMP_Stop(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 457 HAL_StatusTypeDef HAL_OPAMP_SelfCalibrate(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 458
Kojto 90:cb3d968589d8 459 /**
Kojto 90:cb3d968589d8 460 * @}
Kojto 90:cb3d968589d8 461 */
Kojto 90:cb3d968589d8 462
Kojto 90:cb3d968589d8 463 /** @defgroup OPAMP_Exported_Functions_Group3 Peripheral Control functions
Kojto 90:cb3d968589d8 464 * @{
Kojto 90:cb3d968589d8 465 */
Kojto 90:cb3d968589d8 466
Kojto 90:cb3d968589d8 467 /* Peripheral Control functions ************************************************/
Kojto 90:cb3d968589d8 468 HAL_StatusTypeDef HAL_OPAMP_Lock(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 469
Kojto 90:cb3d968589d8 470 /**
Kojto 90:cb3d968589d8 471 * @}
Kojto 90:cb3d968589d8 472 */
Kojto 90:cb3d968589d8 473
Kojto 90:cb3d968589d8 474 /** @defgroup OPAMP_Exported_Functions_Group4 Peripheral State functions
Kojto 90:cb3d968589d8 475 * @{
Kojto 90:cb3d968589d8 476 */
Kojto 90:cb3d968589d8 477
Kojto 90:cb3d968589d8 478 /* Peripheral State functions **************************************************/
Kojto 90:cb3d968589d8 479 HAL_OPAMP_StateTypeDef HAL_OPAMP_GetState(OPAMP_HandleTypeDef *hopamp);
Kojto 90:cb3d968589d8 480 OPAMP_TrimmingValueTypeDef HAL_OPAMP_GetTrimOffset (OPAMP_HandleTypeDef *hopamp, uint32_t trimmingoffset);
Kojto 90:cb3d968589d8 481
Kojto 90:cb3d968589d8 482 /**
Kojto 90:cb3d968589d8 483 * @}
Kojto 90:cb3d968589d8 484 */
Kojto 90:cb3d968589d8 485
Kojto 90:cb3d968589d8 486 /**
Kojto 90:cb3d968589d8 487 * @}
Kojto 90:cb3d968589d8 488 */
Kojto 90:cb3d968589d8 489
Kojto 90:cb3d968589d8 490 /**
Kojto 90:cb3d968589d8 491 * @}
Kojto 90:cb3d968589d8 492 */
Kojto 90:cb3d968589d8 493
Kojto 90:cb3d968589d8 494 /**
Kojto 90:cb3d968589d8 495 * @}
Kojto 90:cb3d968589d8 496 */
Kojto 90:cb3d968589d8 497
Kojto 90:cb3d968589d8 498 #endif /* STM32F302xE || STM32F303xE || STM32F398xx || */
Kojto 90:cb3d968589d8 499 /* STM32F302xC || STM32F303xC || STM32F358xx || */
Kojto 90:cb3d968589d8 500 /* STM32F303x8 || STM32F334x8 || STM32F328xx || */
Kojto 90:cb3d968589d8 501 /* STM32F301x8 || STM32F302x8 || STM32F318xx */
Kojto 90:cb3d968589d8 502
Kojto 90:cb3d968589d8 503 #ifdef __cplusplus
Kojto 90:cb3d968589d8 504 }
Kojto 90:cb3d968589d8 505 #endif
Kojto 90:cb3d968589d8 506
Kojto 90:cb3d968589d8 507 #endif /* __STM32F3xx_HAL_OPAMP_H */
Kojto 90:cb3d968589d8 508
Kojto 90:cb3d968589d8 509 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/