mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

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

Who changed what in which revision?

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