BLE5.2 1.0
开发文档说明
xc_drv_pga.h
浏览该文件的文档.
1
25 /* Define to prevent recursive inclusion -------------------------------------*/
26#ifndef __XC_DRV_PGA_H_
27#define __XC_DRV_PGA_H_
28
29/*-----------------------------------------------------------------------------------
30 INCLUDE HEADE FILES
31 ------------------------------------------------------------------------------------*/
32#include "xc6xxx.h"
33/*------------------------------------------------------------------------------------
34 Macros
35 -------------------------------------------------------------------------------------*/
36
37
38
39
40
41/*------------------------------------------------------------------------------------
42 TypeDef
43 -------------------------------------------------------------------------------------*/
44
45
46#define PGA_PDBIAS_EN 0
47#define PGA_PDBIAS_PD 1
48
49#define PGA_ELECTRICITY_LEVEL0 (0x07<<2)
50#define PGA_ELECTRICITY_LEVEL1 (0x06<<2)
51#define PGA_ELECTRICITY_LEVEL2 (0x05<<2)
52#define PGA_ELECTRICITY_LEVEL3 (0x4<<2)
53#define PGA_ELECTRICITY_LEVEL4 (0x3<<2)
54#define PGA_ELECTRICITY_LEVEL5 (0x2<<2)
55#define PGA_ELECTRICITY_LEVEL6 (0x1<<2)
56#define PGA_ELECTRICITY_LEVEL7 (0x0<<2) /* max electricity*/
57#define PGA_SINGLE (0x0<<1)
58#define PGA_DIFFERENCE (0x1<<1)
59
60
61#define CMP_CTRL_VOLTAGE_LEVEL0 (0x00) /* 0MV */
62#define CMP_CTRL_VOLTAGE_LEVEL1 (0x01) /* 12MV */
63#define CMP_CTRL_VOLTAGE_LEVEL2 (0x02) /* 23MV */
64#define CMP_CTRL_VOLTAGE_LEVEL3 (0x03) /* max electricity 36MV*/
65
66#define CMP_IBC_ELECTRICITY_LEVEL0 (0x03) /* 1.43ua */
67#define CMP_IBC_ELECTRICITY_LEVEL1 (0x02) /* 2ua */
68#define CMP_IBC_ELECTRICITY_LEVEL2 (0x01) /* 3.33ua */
69#define CMP_IBC_ELECTRICITY_LEVEL3 (0x00) /* max electricity 10ua*/
70
71#define TEMP_SENSOR_ENABLE 1
72#define TEMP_SENSOR_DISABLE 0
73
74#define PGA_OPA_CTRL_SIGNAL_PD (0x1<<2)
75#define PGA_OPA_CTRL_SIGNAL_EN (0x0<<2)
76#define PGA_OPA_CTRL_INPUT_SWAP_ENABLE (0x1<<1)
77#define PGA_OPA_CTRL_INPUT_SWAP_DISABLE (0x0<<2)
78#define PGA_OPA_CTRL_ELECTRICITY_MAX (0x0<<0)
79#define PGA_OPA_CTRL_ELECTRICITY_MIN (0x1<<0)
80
81#define PDOPA_SIGNAL_PD 1
82#define PDOPA_SIGNAL_EN 0
83
84
85
86
87
88typedef enum
89{
93
94
95/* 0 - 22.3db */
96typedef enum
97{
114
115
116
136typedef struct
137{
140 uint8_t resadj;
141 uint8_t cmp_ctrl;
142 uint8_t cmp_ibc;
143 uint8_t bg5v_ctrl;
145 uint8_t bias;
146 uint8_t volr;
147 uint8_t opa_ctrl;
148 uint8_t pdopa;
149 uint8_t micgain;
151
152
153
154/*------------------------------------------------------------------------------------
155 Global Variables
156 -------------------------------------------------------------------------------------*/
157
158
159/*------------------------------------------------------------------------------------
160 Exported Functions
161 -------------------------------------------------------------------------------------*/
162void xc_pga_init(PGA_InitCfg_t *pga_cfg);
163void xc_pga_micgain_2_set(uint8_t micgain2);
164void xc_pga_volr2_set(uint8_t volr2);
165void xc_pga_resadj_set(uint8_t resadj);
166void xc_pga_cmp_ctrl_set(uint8_t cmp_ctrl);
167void xc_pga_cmp_ibc_set(uint8_t cmp_ibc);
168void xc_pga_temp_sensor_enable(uint8_t en_temp_sensor);
169void xc_pga_volr_set(uint8_t volr);
170void xc_pga_pdbias_set(uint8_t pdbias);
171void xc_pga_opa_ctrl_set(uint8_t opa_ctrl);
172void xc_pga_pdopa_set(uint8_t pdopa);
173void xc_pga_micgain_set(uint8_t micgain);
174
175#endif //__XC_DRV_PGA_H_
CPR_OPA_CTRL_REG register definition
Definition xc_drv_pga.h:137
PGA_VOLR2TypeDef_t volr2
Definition xc_drv_pga.h:139
uint8_t micgain
Definition xc_drv_pga.h:149
uint8_t bg5v_ctrl
Definition xc_drv_pga.h:143
uint8_t cmp_ctrl
Definition xc_drv_pga.h:141
uint8_t cmp_ibc
Definition xc_drv_pga.h:142
uint8_t opa_ctrl
Definition xc_drv_pga.h:147
uint8_t resadj
Definition xc_drv_pga.h:140
uint8_t pdopa
Definition xc_drv_pga.h:148
PGA_MIC_GAIN2TypeDef_t gain2
Definition xc_drv_pga.h:138
uint8_t en_temp_sensor
Definition xc_drv_pga.h:144
void xc_pga_volr_set(uint8_t volr)
xc_pga_volr_set
Definition xc_drv_pga.c:173
void xc_pga_temp_sensor_enable(uint8_t en_temp_sensor)
xc_pga_temp_sensor_enable
Definition xc_drv_pga.c:158
void xc_pga_cmp_ibc_set(uint8_t cmp_ibc)
xc_pga_cmp_ibc_set
Definition xc_drv_pga.c:143
void xc_pga_volr2_set(uint8_t volr2)
xc_pga_volr2_set
Definition xc_drv_pga.c:95
void xc_pga_init(PGA_InitCfg_t *pga_cfg)
xc_pga_init
Definition xc_drv_pga.c:48
void xc_pga_micgain_set(uint8_t micgain)
xc_pga_micgain_set
Definition xc_drv_pga.c:235
void xc_pga_micgain_2_set(uint8_t micgain2)
xc_pga_micgain_2_set
Definition xc_drv_pga.c:81
void xc_pga_resadj_set(uint8_t resadj)
xc_pga_resadj_set
Definition xc_drv_pga.c:112
void xc_pga_pdopa_set(uint8_t pdopa)
xc_pga_pdopa_set
Definition xc_drv_pga.c:220
void xc_pga_opa_ctrl_set(uint8_t opa_ctrl)
xc_pga_opa_ctrl_set
Definition xc_drv_pga.c:206
PGA_MIC_GAIN2TypeDef_t
Definition xc_drv_pga.h:89
@ PGA_MIC_GAIN2_ENABLE
Definition xc_drv_pga.h:91
@ PGA_MIC_GAIN2_DISABLE
Definition xc_drv_pga.h:90
void xc_pga_pdbias_set(uint8_t pdbias)
xc_pga_pdbias_set
Definition xc_drv_pga.c:189
void xc_pga_cmp_ctrl_set(uint8_t cmp_ctrl)
xc_pga_cmp_ctrl_set
Definition xc_drv_pga.c:127
PGA_VOLR2TypeDef_t
Definition xc_drv_pga.h:97
@ PGA_VOLR2_GAIN_8_0DB
Definition xc_drv_pga.h:103
@ PGA_VOLR2_GAIN_9_6DB
Definition xc_drv_pga.h:104
@ PGA_VOLR2_GAIN_12_8DB
Definition xc_drv_pga.h:106
@ PGA_VOLR2_GAIN_3_2DB
Definition xc_drv_pga.h:100
@ PGA_VOLR2_GAIN_0_0DB
Definition xc_drv_pga.h:98
@ PGA_VOLR2_GAIN_14_4DB
Definition xc_drv_pga.h:107
@ PGA_VOLR2_GAIN_6_4DB
Definition xc_drv_pga.h:102
@ PGA_VOLR2_GAIN_20_8DB
Definition xc_drv_pga.h:111
@ PGA_VOLR2_GAIN_17_6DB
Definition xc_drv_pga.h:109
@ PGA_VOLR2_GAIN_11_2DB
Definition xc_drv_pga.h:105
@ PGA_VOLR2_GAIN_16_0DB
Definition xc_drv_pga.h:108
@ PGA_VOLR2_GAIN_4_8DB
Definition xc_drv_pga.h:101
@ PGA_VOLR2_GAIN_22_3DB
Definition xc_drv_pga.h:112
@ PGA_VOLR2_GAIN_1_6DB
Definition xc_drv_pga.h:99
@ PGA_VOLR2_GAIN_19_2DB
Definition xc_drv_pga.h:110