本项止转自github官方arduino-esp32 传在这里仅为阅读源码方便
projectuser
2019-07-05 50148ccffe21ff54262064ec9f2245900eaf18aa
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
 
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _SOC_SENS_STRUCT_H_
#define _SOC_SENS_STRUCT_H_
 
#ifdef __cplusplus
extern "C" {
#endif
 
typedef volatile struct {
    union {
        struct {
            uint32_t sar1_clk_div:      8;
            uint32_t sar1_sample_cycle: 8;
            uint32_t sar1_sample_bit:   2;
            uint32_t sar1_clk_gated:    1;
            uint32_t sar1_sample_num:   8;
            uint32_t sar1_dig_force:    1;                /*1: ADC1 is controlled by the digital controller  0: RTC controller*/
            uint32_t sar1_data_inv:     1;
            uint32_t reserved29:        3;
        };
        uint32_t val;
    } sar_read_ctrl;
    uint32_t sar_read_status1;                            /**/
    union {
        struct {
            uint32_t sar_amp_wait1:16;
            uint32_t sar_amp_wait2:16;
        };
        uint32_t val;
    } sar_meas_wait1;
    union {
        struct {
            uint32_t sar_amp_wait3: 16;
            uint32_t force_xpd_amp:  2;
            uint32_t force_xpd_sar:  2;
            uint32_t sar2_rstb_wait: 8;
            uint32_t reserved28:     4;
        };
        uint32_t val;
    } sar_meas_wait2;
    union {
        struct {
            uint32_t xpd_sar_amp_fsm:       4;
            uint32_t amp_rst_fb_fsm:        4;
            uint32_t amp_short_ref_fsm:     4;
            uint32_t amp_short_ref_gnd_fsm: 4;
            uint32_t xpd_sar_fsm:           4;
            uint32_t sar_rstb_fsm:          4;
            uint32_t sar2_xpd_wait:         8;
        };
        uint32_t val;
    } sar_meas_ctrl;
    uint32_t sar_read_status2;                            /**/
    uint32_t ulp_cp_sleep_cyc0;                          /**/
    uint32_t ulp_cp_sleep_cyc1;                          /**/
    uint32_t ulp_cp_sleep_cyc2;                          /**/
    uint32_t ulp_cp_sleep_cyc3;                          /**/
    uint32_t ulp_cp_sleep_cyc4;                          /**/
    union {
        struct {
            uint32_t sar1_bit_width:         2;
            uint32_t sar2_bit_width:         2;
            uint32_t sar2_en_test:           1;
            uint32_t sar2_pwdet_cct:         3;
            uint32_t ulp_cp_force_start_top: 1;
            uint32_t ulp_cp_start_top:       1;
            uint32_t sarclk_en:              1;
            uint32_t pc_init:               11;
            uint32_t sar2_stop:              1;
            uint32_t sar1_stop:              1;
            uint32_t sar2_pwdet_en:          1;
            uint32_t reserved25:             7;
        };
        uint32_t val;
    } sar_start_force;
    union {
        struct {
            uint32_t mem_wr_addr_init:    11;
            uint32_t mem_wr_addr_size:    11;
            uint32_t rtc_mem_wr_offst_clr: 1;
            uint32_t reserved23:           9;
        };
        uint32_t val;
    } sar_mem_wr_ctrl;
    uint32_t sar_atten1;                                  /**/
    uint32_t sar_atten2;                                  /**/
    union {
        struct {
            uint32_t i2c_slave_addr1:   11;
            uint32_t i2c_slave_addr0:   11;
            uint32_t meas_status:        8;
            uint32_t reserved30:         2;
        };
        uint32_t val;
    } sar_slave_addr1;
    union {
        struct {
            uint32_t i2c_slave_addr3:11;
            uint32_t i2c_slave_addr2:11;
            uint32_t reserved22:     10;
        };
        uint32_t val;
    } sar_slave_addr2;
    union {
        struct {
            uint32_t i2c_slave_addr5:11;
            uint32_t i2c_slave_addr4:11;
            uint32_t tsens_out:       8;
            uint32_t tsens_rdy_out:   1;
            uint32_t reserved31:      1;
        };
        uint32_t val;
    } sar_slave_addr3;
    union {
        struct {
            uint32_t i2c_slave_addr7:11;
            uint32_t i2c_slave_addr6:11;
            uint32_t i2c_rdata:       8;
            uint32_t i2c_done:        1;
            uint32_t reserved31:      1;
        };
        uint32_t val;
    } sar_slave_addr4;
    union {
        struct {
            uint32_t tsens_xpd_wait:      12;
            uint32_t tsens_xpd_force:      1;
            uint32_t tsens_clk_inv:        1;
            uint32_t tsens_clk_gated:      1;
            uint32_t tsens_in_inv:         1;
            uint32_t tsens_clk_div:        8;
            uint32_t tsens_power_up:       1;
            uint32_t tsens_power_up_force: 1;
            uint32_t tsens_dump_out:       1;
            uint32_t reserved27:           5;
        };
        uint32_t val;
    } sar_tctrl;
    union {
        struct {
            uint32_t sar_i2c_ctrl:       28;
            uint32_t sar_i2c_start:       1;
            uint32_t sar_i2c_start_force: 1;
            uint32_t reserved30:          2;
        };
        uint32_t val;
    } sar_i2c_ctrl;
    union {
        struct {
            uint32_t meas1_data_sar:   16;
            uint32_t meas1_done_sar:    1;
            uint32_t meas1_start_sar:   1;
            uint32_t meas1_start_force: 1;                /*1: ADC1 is controlled by the digital or RTC controller  0: Ulp coprocessor*/
            uint32_t sar1_en_pad:      12;
            uint32_t sar1_en_pad_force: 1;                /*1: Data ports are controlled by the digital or RTC controller  0: Ulp coprocessor*/
        };
        uint32_t val;
    } sar_meas_start1;
    union {
        struct {
            uint32_t touch_meas_delay:16;
            uint32_t touch_xpd_wait:   8;
            uint32_t touch_out_sel:    1;
            uint32_t touch_out_1en:    1;
            uint32_t xpd_hall_force:   1;                 /*1: Power of hall sensor is controlled by the digital or RTC controller  0: Ulp coprocessor*/
            uint32_t hall_phase_force: 1;                 /*1: Phase of hall sensor is controlled by the digital or RTC controller  0: Ulp coprocessor*/
            uint32_t reserved28:       4;
        };
        uint32_t val;
    } sar_touch_ctrl1;
    union {
        struct {
            uint32_t l_thresh: 16;
            uint32_t h_thresh: 16;
        };
        uint32_t val;
    } touch_thresh[5];
    union {
        struct {
            uint32_t l_val: 16;
            uint32_t h_val: 16;
        };
        uint32_t val;
    } touch_meas[5];
    union {
        struct {
            uint32_t touch_meas_en:     10;
            uint32_t touch_meas_done:    1;
            uint32_t touch_start_fsm_en: 1;
            uint32_t touch_start_en:     1;
            uint32_t touch_start_force:  1;
            uint32_t touch_sleep_cycles:16;
            uint32_t touch_meas_en_clr:  1;
            uint32_t reserved31:         1;
        };
        uint32_t val;
    } sar_touch_ctrl2;
    uint32_t reserved_88;
    union {
        struct {
            uint32_t touch_pad_worken:10;
            uint32_t touch_pad_outen2:10;
            uint32_t touch_pad_outen1:10;
            uint32_t reserved30:       2;
        };
        uint32_t val;
    } sar_touch_enable;
    union {
        struct {
            uint32_t sar2_clk_div:      8;
            uint32_t sar2_sample_cycle: 8;
            uint32_t sar2_sample_bit:   2;
            uint32_t sar2_clk_gated:    1;
            uint32_t sar2_sample_num:   8;
            uint32_t sar2_pwdet_force:  1;                /*1: ADC2 is controlled by PWDET  0: digital or RTC controller*/
            uint32_t sar2_dig_force:    1;                /*1: ADC2 is controlled by the digital controller  0: RTC controller*/
            uint32_t sar2_data_inv:     1;
            uint32_t reserved30:        2;
        };
        uint32_t val;
    } sar_read_ctrl2;
    union {
        struct {
            uint32_t meas2_data_sar:   16;
            uint32_t meas2_done_sar:    1;
            uint32_t meas2_start_sar:   1;
            uint32_t meas2_start_force: 1;                /*1: ADC2 is controlled by the digital or RTC controller  0: Ulp coprocessor*/
            uint32_t sar2_en_pad:      12;
            uint32_t sar2_en_pad_force: 1;                /*1: Data ports are controlled by the digital or RTC controller  0: Ulp coprocessor*/
        };
        uint32_t val;
    } sar_meas_start2;
    union {
        struct {
            uint32_t sw_fstep:          16;
            uint32_t sw_tone_en:         1;
            uint32_t debug_bit_sel:      5;
            uint32_t dac_dig_force:      1;
            uint32_t dac_clk_force_low:  1;
            uint32_t dac_clk_force_high: 1;
            uint32_t dac_clk_inv:        1;
            uint32_t reserved26:         6;
        };
        uint32_t val;
    } sar_dac_ctrl1;
    union {
        struct {
            uint32_t dac_dc1:    8;
            uint32_t dac_dc2:    8;
            uint32_t dac_scale1: 2;
            uint32_t dac_scale2: 2;
            uint32_t dac_inv1:   2;
            uint32_t dac_inv2:   2;
            uint32_t dac_cw_en1: 1;
            uint32_t dac_cw_en2: 1;
            uint32_t reserved26: 6;
        };
        uint32_t val;
    } sar_dac_ctrl2;
    union {
        struct {
            uint32_t sar1_dac_xpd_fsm:           4;
            uint32_t sar1_dac_xpd_fsm_idle:      1;
            uint32_t xpd_sar_amp_fsm_idle:       1;
            uint32_t amp_rst_fb_fsm_idle:        1;
            uint32_t amp_short_ref_fsm_idle:     1;
            uint32_t amp_short_ref_gnd_fsm_idle: 1;
            uint32_t xpd_sar_fsm_idle:           1;
            uint32_t sar_rstb_fsm_idle:          1;
            uint32_t sar2_rstb_force:            2;
            uint32_t amp_rst_fb_force:           2;
            uint32_t amp_short_ref_force:        2;
            uint32_t amp_short_ref_gnd_force:    2;
            uint32_t reserved19:                13;
        };
        uint32_t val;
    } sar_meas_ctrl2;
    uint32_t reserved_a4;
    uint32_t reserved_a8;
    uint32_t reserved_ac;
    uint32_t reserved_b0;
    uint32_t reserved_b4;
    uint32_t reserved_b8;
    uint32_t reserved_bc;
    uint32_t reserved_c0;
    uint32_t reserved_c4;
    uint32_t reserved_c8;
    uint32_t reserved_cc;
    uint32_t reserved_d0;
    uint32_t reserved_d4;
    uint32_t reserved_d8;
    uint32_t reserved_dc;
    uint32_t reserved_e0;
    uint32_t reserved_e4;
    uint32_t reserved_e8;
    uint32_t reserved_ec;
    uint32_t reserved_f0;
    uint32_t reserved_f4;
    uint32_t sar_nouse;                                   /**/
    union {
        struct {
            uint32_t sar_date:  28;
            uint32_t reserved28: 4;
        };
        uint32_t val;
    } sardate;
} sens_dev_t;
extern sens_dev_t SENS;
 
#ifdef __cplusplus
}
#endif
 
#endif  /* _SOC_SENS_STRUCT_H_ */