RTEMS 6.1-rc5
Loading...
Searching...
No Matches
stm32h7xx_hal_opamp.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_OPAMP_H
21#define STM32H7xx_HAL_OPAMP_H
22
23#ifdef __cplusplus
24 extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
38/* Exported types ------------------------------------------------------------*/
39
49typedef struct
50{
51
52 uint32_t PowerMode;
55 uint32_t Mode;
59 uint32_t InvertingInput;
69 uint32_t PgaGain;
73 uint32_t PgaConnect;
79 uint32_t UserTrimming;
83 uint32_t TrimmingValueP;
88 uint32_t TrimmingValueN;
104
109typedef enum
110{
111 HAL_OPAMP_STATE_RESET = 0x00000000U,
113 HAL_OPAMP_STATE_READY = 0x00000001U,
116 HAL_OPAMP_STATE_BUSY = 0x00000004U,
117 HAL_OPAMP_STATE_BUSYLOCKED = 0x00000005U
121
125#if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
126typedef struct __OPAMP_HandleTypeDef
127#else
128typedef struct
129#endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
130{
137#if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
138void (* MspInitCallback) (struct __OPAMP_HandleTypeDef *hopamp);
139void (* MspDeInitCallback) (struct __OPAMP_HandleTypeDef *hopamp);
140#endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
142
148
149#if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
153typedef enum
154{
155 HAL_OPAMP_MSPINIT_CB_ID = 0x01U,
156 HAL_OPAMP_MSPDEINIT_CB_ID = 0x02U,
157 HAL_OPAMP_ALL_CB_ID = 0x03U
158}HAL_OPAMP_CallbackIDTypeDef;
159
163typedef void (*pOPAMP_CallbackTypeDef)(OPAMP_HandleTypeDef *hopamp);
164#endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
169/* Exported constants --------------------------------------------------------*/
179#define OPAMP_STANDALONE_MODE 0x00000000U
180#define OPAMP_PGA_MODE OPAMP_CSR_VMSEL_1
181#define OPAMP_FOLLOWER_MODE (OPAMP_CSR_VMSEL_1 | OPAMP_CSR_VMSEL_0)
192#define OPAMP_NONINVERTINGINPUT_IO0 0x00000000U
193#define OPAMP_NONINVERTINGINPUT_DAC_CH OPAMP_CSR_VPSEL_0
194#if defined(DAC2)
195#define OPAMP_NONINVERTINGINPUT_DAC2_CH OPAMP_CSR_VPSEL_1
196#endif /* DAC2 */
197
207#define OPAMP_INVERTINGINPUT_IO0 0x00000000U
208#define OPAMP_INVERTINGINPUT_IO1 OPAMP_CSR_VMSEL_0
219#define OPAMP_PGA_CONNECT_INVERTINGINPUT_NO 0x00000000U
220#define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0 OPAMP_CSR_PGGAIN_2
221#define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_BIAS OPAMP_CSR_PGGAIN_3
222#define OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_IO1_BIAS (OPAMP_CSR_PGGAIN_2 | OPAMP_CSR_PGGAIN_3)
234#define OPAMP_PGA_GAIN_2_OR_MINUS_1 0x00000000U
235#define OPAMP_PGA_GAIN_4_OR_MINUS_3 OPAMP_CSR_PGGAIN_0
236#define OPAMP_PGA_GAIN_8_OR_MINUS_7 OPAMP_CSR_PGGAIN_1
237#define OPAMP_PGA_GAIN_16_OR_MINUS_15 (OPAMP_CSR_PGGAIN_0 | OPAMP_CSR_PGGAIN_1)
247#define OPAMP_POWERMODE_NORMAL 0x00000000U
248#define OPAMP_POWERMODE_HIGHSPEED OPAMP_CSR_OPAHSM
249
260#define OPAMP_VREF_3VDDA 0x00000000U
261#define OPAMP_VREF_10VDDA OPAMP_CSR_CALSEL_0
262#define OPAMP_VREF_50VDDA OPAMP_CSR_CALSEL_1
263#define OPAMP_VREF_90VDDA OPAMP_CSR_CALSEL
273#define OPAMP_TRIMMING_FACTORY 0x00000000U
274#define OPAMP_TRIMMING_USER OPAMP_CSR_USERTRIM
285#define OPAMP_FACTORYTRIMMING_DUMMY 0xFFFFFFFFU
287#define OPAMP_FACTORYTRIMMING_N 0x00000000U
288#define OPAMP_FACTORYTRIMMING_P 0x00000001U
298/* Private constants ---------------------------------------------------------*/
305/* NONINVERTING bit position in OTR & HSOTR */
306#define OPAMP_INPUT_NONINVERTING (8U)
308/* Offset trimming time: during calibration, minimum time needed between two */
309/* steps to have 1 mV accuracy. */
310/* Refer to datasheet, electrical characteristics: parameter tOFFTRIM Typ=2ms.*/
311/* Unit: ms. */
312#define OPAMP_TRIMMING_DELAY (2U)
313
318/* Exported macros -----------------------------------------------------------*/
328#define __HAL_OPAMP_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_OPAMP_STATE_RESET)
329
334/* Private macro -------------------------------------------------------------*/
335
341#define IS_OPAMP_FUNCTIONAL_NORMALMODE(INPUT) (((INPUT) == OPAMP_STANDALONE_MODE) || \
342 ((INPUT) == OPAMP_PGA_MODE) || \
343 ((INPUT) == OPAMP_FOLLOWER_MODE))
344
345#define IS_OPAMP_INVERTING_INPUT_STANDALONE(INPUT) (((INPUT) == OPAMP_INVERTINGINPUT_IO0) || \
346 ((INPUT) == OPAMP_INVERTINGINPUT_IO1))
347
348#if defined(DAC2)
349#define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NONINVERTINGINPUT_IO0) || \
350 ((INPUT) == OPAMP_NONINVERTINGINPUT_DAC_CH) || \
351 ((INPUT) == OPAMP_NONINVERTINGINPUT_DAC2_CH))
352#else
353#define IS_OPAMP_NONINVERTING_INPUT(INPUT) (((INPUT) == OPAMP_NONINVERTINGINPUT_IO0) || \
354 ((INPUT) == OPAMP_NONINVERTINGINPUT_DAC_CH))
355#endif /* DAC2 */
356
357#define IS_OPAMP_PGACONNECT(CONNECT) (((CONNECT) == OPAMP_PGA_CONNECT_INVERTINGINPUT_NO) || \
358 ((CONNECT) == OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0) || \
359 ((CONNECT) == OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_BIAS) || \
360 ((CONNECT) == OPAMP_PGA_CONNECT_INVERTINGINPUT_IO0_IO1_BIAS))
361
362#define IS_OPAMP_PGA_GAIN(GAIN) (((GAIN) == OPAMP_PGA_GAIN_2_OR_MINUS_1) || \
363 ((GAIN) == OPAMP_PGA_GAIN_4_OR_MINUS_3) || \
364 ((GAIN) == OPAMP_PGA_GAIN_8_OR_MINUS_7) || \
365 ((GAIN) == OPAMP_PGA_GAIN_16_OR_MINUS_15))
366
367
368#define IS_OPAMP_VREF(VREF) (((VREF) == OPAMP_VREF_3VDDA) || \
369 ((VREF) == OPAMP_VREF_10VDDA) || \
370 ((VREF) == OPAMP_VREF_50VDDA) || \
371 ((VREF) == OPAMP_VREF_90VDDA))
372
373#define IS_OPAMP_POWERMODE(TRIMMING) (((TRIMMING) == OPAMP_POWERMODE_NORMAL) || \
374 ((TRIMMING) == OPAMP_POWERMODE_HIGHSPEED) )
375
376
377#define IS_OPAMP_TRIMMING(TRIMMING) (((TRIMMING) == OPAMP_TRIMMING_FACTORY) || \
378 ((TRIMMING) == OPAMP_TRIMMING_USER))
379
380
381#define IS_OPAMP_TRIMMINGVALUE(TRIMMINGVALUE) ((TRIMMINGVALUE) <= 0x1FU)
382
383#define IS_OPAMP_FACTORYTRIMMING(TRIMMING) (((TRIMMING) == OPAMP_FACTORYTRIMMING_N) || \
384 ((TRIMMING) == OPAMP_FACTORYTRIMMING_P))
385
390/* Include OPAMP HAL Extended module */
392
393/* Exported functions --------------------------------------------------------*/
401/* Initialization/de-initialization functions **********************************/
402HAL_StatusTypeDef HAL_OPAMP_Init(OPAMP_HandleTypeDef *hopamp);
403HAL_StatusTypeDef HAL_OPAMP_DeInit (OPAMP_HandleTypeDef *hopamp);
404void HAL_OPAMP_MspInit(OPAMP_HandleTypeDef *hopamp);
405void HAL_OPAMP_MspDeInit(OPAMP_HandleTypeDef *hopamp);
414/* I/O operation functions *****************************************************/
415HAL_StatusTypeDef HAL_OPAMP_Start(OPAMP_HandleTypeDef *hopamp);
416HAL_StatusTypeDef HAL_OPAMP_Stop(OPAMP_HandleTypeDef *hopamp);
417HAL_StatusTypeDef HAL_OPAMP_SelfCalibrate(OPAMP_HandleTypeDef *hopamp);
418
427/* Peripheral Control functions ************************************************/
428#if (USE_HAL_OPAMP_REGISTER_CALLBACKS == 1)
429/* OPAMP callback registering/unregistering */
430HAL_StatusTypeDef HAL_OPAMP_RegisterCallback (OPAMP_HandleTypeDef *hopamp, HAL_OPAMP_CallbackIDTypeDef CallbackId, pOPAMP_CallbackTypeDef pCallback);
431HAL_StatusTypeDef HAL_OPAMP_UnRegisterCallback (OPAMP_HandleTypeDef *hopamp, HAL_OPAMP_CallbackIDTypeDef CallbackId);
432#endif /* USE_HAL_OPAMP_REGISTER_CALLBACKS */
433HAL_StatusTypeDef HAL_OPAMP_Lock(OPAMP_HandleTypeDef *hopamp);
434HAL_OPAMP_TrimmingValueTypeDef HAL_OPAMP_GetTrimOffset (OPAMP_HandleTypeDef *hopamp, uint32_t trimmingoffset);
435
444/* Peripheral State functions **************************************************/
445HAL_OPAMP_StateTypeDef HAL_OPAMP_GetState(OPAMP_HandleTypeDef *hopamp);
446
463#ifdef __cplusplus
464}
465#endif
466
467#endif /* STM32H7xx_HAL_OPAMP_H */
468
#define __IO
Definition: core_cm4.h:239
uint32_t HAL_OPAMP_TrimmingValueTypeDef
HAl_OPAMP_TrimmingValueTypeDef definition.
Definition: stm32h7xx_hal_opamp.h:147
HAL_OPAMP_StateTypeDef
HAL State structures definition
Definition: stm32h7xx_hal_opamp.h:110
@ HAL_OPAMP_STATE_BUSYLOCKED
Definition: stm32h7xx_hal_opamp.h:117
@ HAL_OPAMP_STATE_CALIBBUSY
Definition: stm32h7xx_hal_opamp.h:114
@ HAL_OPAMP_STATE_RESET
Definition: stm32h7xx_hal_opamp.h:111
@ HAL_OPAMP_STATE_BUSY
Definition: stm32h7xx_hal_opamp.h:116
@ HAL_OPAMP_STATE_READY
Definition: stm32h7xx_hal_opamp.h:113
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of OPAMP HAL Extended module.
OPAMP Handle Structure definition.
Definition: stm32h7xx_hal_opamp.h:130
OPAMP_TypeDef * Instance
Definition: stm32h7xx_hal_opamp.h:131
HAL_StatusTypeDef Status
Definition: stm32h7xx_hal_opamp.h:133
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_opamp.h:134
OPAMP_InitTypeDef Init
Definition: stm32h7xx_hal_opamp.h:132
__IO HAL_OPAMP_StateTypeDef State
Definition: stm32h7xx_hal_opamp.h:135
OPAMP Init structure definition
Definition: stm32h7xx_hal_opamp.h:50
uint32_t Mode
Definition: stm32h7xx_hal_opamp.h:55
uint32_t NonInvertingInput
Definition: stm32h7xx_hal_opamp.h:66
uint32_t UserTrimming
Definition: stm32h7xx_hal_opamp.h:79
uint32_t InvertingInput
Definition: stm32h7xx_hal_opamp.h:59
uint32_t PowerMode
Definition: stm32h7xx_hal_opamp.h:52
uint32_t TrimmingValueN
Definition: stm32h7xx_hal_opamp.h:88
uint32_t TrimmingValueP
Definition: stm32h7xx_hal_opamp.h:83
uint32_t TrimmingValuePHighSpeed
Definition: stm32h7xx_hal_opamp.h:93
uint32_t TrimmingValueNHighSpeed
Definition: stm32h7xx_hal_opamp.h:98
uint32_t PgaConnect
Definition: stm32h7xx_hal_opamp.h:73
uint32_t PgaGain
Definition: stm32h7xx_hal_opamp.h:69
Operational Amplifier (OPAMP)
Definition: stm32h723xx.h:1083