1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
/*******************************************************************************
* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
*
* This software is owned and published by:
* Huada Semiconductor Co.,Ltd ("HDSC").
*
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
*
* This software contains source code for use with HDSC
* components. This software is licensed by HDSC to be adapted only
* for use in systems utilizing HDSC components. HDSC shall not be
* responsible for misuse or illegal use of this software for devices not
* supported herein. HDSC is providing this software "AS IS" and will
* not be responsible for issues arising from incorrect user implementation
* of the software.
*
* Disclaimer:
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
* WARRANTY OF NONINFRINGEMENT.
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
* SAVINGS OR PROFITS,
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
* FROM, THE SOFTWARE.
*
* This software may be replicated in part or whole for the licensed use,
* with the restriction that this Disclaimer and Copyright notice must be
* included with each copy of this software, whether used in part or whole,
* at all times.
*/
/******************************************************************************/
/** \file OPA.h
**
** Headerfile for OPA functions
** @link OPA Group Some description @endlink
**
** History:
** - 2018-04-15 Devi First Version
**
******************************************************************************/
#ifndef __OPA_H__
#define __OPA_H__
/*******************************************************************************
* Include files
******************************************************************************/
#include "ddl.h"
#include "interrupts_hc32l136.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
******************************************************************************
** \defgroup OPAGroup (OPA)
**
******************************************************************************/
//@{
/**
*******************************************************************************
** function prototypes.
******************************************************************************/
/**
*******************************************************************************
** \brief OPA通道选择
** \note
******************************************************************************/
typedef enum en_opa_channel
{
OPA0 = 0u, ///<<OPA0
OPA1 = 1u, ///<<OPA1
OPA2 = 2u, ///<<OPA2
}en_opa_channel_t;
/**
*******************************************************************************
** \brief OPA反向增益选择
** \note
******************************************************************************/
typedef enum en_opa_invert_pagagain
{
Gain15 = 0u, ///< 反向增益15倍
Gain07 = 1u, ///< 反向增益7倍
Gain13_3 = 2u, ///< 反向增益13/3倍
Gain03 = 3u, ///< 反向增益3倍
Gain05_3 = 4u, ///< 反向增益5/3倍
Gain01 = 5u, ///< 反向增益1倍
Gain01_3 = 6u, ///< 反向增益1/3倍
Gain11_5 = 7u, ///< 反向增益11/5倍
}en_opa_invert_pagagain_t;
/**
*******************************************************************************
** \brief OPA正向增益选择
** \note
******************************************************************************/
typedef enum en_opa_noinvert_pagagain
{
Gain16 = 0u, ///< 正向增益16倍
Gain08 = 1u, ///< 正向增益8倍
Gain16_3 = 2u, ///< 正向增益16/3倍
Gain04 = 3u, ///< 正向增益4倍
Gain08_3 = 4u, ///< 正向增益8/3倍
Gain02 = 5u, ///< 正向增益2倍
Gain04_3 = 6u, ///< 正向增益4/3倍
Gain16_5 = 7u, ///< 正向增益16/5倍
}en_opa_noinvert_pagagain_t;
/**
*******************************************************************************
** \brief 仪表增益配置
******************************************************************************/
typedef enum opa_metergain
{
OpaMeterGain3 = 0u,
OpaMeterGain1_3 = 1u,
OpaMeterGain1 = 2u,
}en_opa_metergain_t;
/**
*******************************************************************************
** \brief opa 模式选择
******************************************************************************/
typedef enum opa_modesel
{
OpaUintMode = 0u, ///< PGA单位增益
OpaForWardMode = 1u, ///< 正向输入PGA
OpaOppositeMode = 2u, ///< 反向输入PGA
OpaThreeOppMode = 3u, ///< 3个OPA级联反向输入PGA
OpaThreeForMode = 4u, ///< 3个OPA级联正向输入PGA
OpaDiffMode = 5u, ///< 两运放差分输入PGA
OpaMeterMode = 6u, ///< 仪表放大器
OpaGpMode = 7u, ///< 通用运放
}en_opa_modesel_t;
/**
*******************************************************************************
** \brief opa 校正模式
******************************************************************************/
typedef enum opa_calsel
{
OpaSoftMode = 0u, ///< 软件控制
OpaSoftTriggerMode = 1u, ///< 软件触发
OpaADCTriggerMode = 2u, ///< ADC触发
}en_opa_calsel_t;
/**
******************************************************************************
** \brief OPA增益配置
*****************************************************************************/
typedef struct stc_opa_gain_config
{
en_opa_invert_pagagain_t enInGain; ///< 反向增益
en_opa_noinvert_pagagain_t enNoInGain; ///< 正向增益
}stc_opa_gain_config_t;
/******************************************************************************
* Global variable declarations ('extern', definition in C source)
******************************************************************************/
/******************************************************************************
* Global function prototypes (definition in C source)
******************************************************************************/
///< OPA初始化
en_result_t OPA_Init(void);
///< OPA去初始化
en_result_t OPA_DeInit(void);
///< OPA基本功能设置
en_result_t OPA_Operate(en_opa_channel_t enchannel ,en_opa_modesel_t enMode,stc_opa_gain_config_t *pstrGain);
///< OPA三级联设置
en_result_t OPA_ThreeOperate(en_opa_modesel_t enMode,stc_opa_gain_config_t *pstrGain0,stc_opa_gain_config_t *pstrGain1,stc_opa_gain_config_t *pstrGain2);
///< OPA 仪表模式
en_result_t OPA_MeterOperate(en_opa_metergain_t enGainMode);
///< OPA校正模式
en_result_t OPA_Cal(en_opa_calsel_t enCalMode);
//@} // OPA Group
#ifdef __cplusplus
#endif
#endif /* __OPA_H__ */
/*******************************************************************************
* EOF (not truncated)
******************************************************************************/
|