InPlay API
hal_adc.h
1 
12 #ifndef HAL_ADC
13 #define HAL_ADC
14 
25 #include <stdint.h>
26 #include "in_mmap.h"
27 #include "in_compile.h"
28 #include "./hal/hal_power.h"
29 
30 #define ADC_INTR_SAMPLE_DONE 0x00000001UL
31 #define ADC_INTR_FIFO_FULL 0x00000002UL
32 #define ADC_INTR_FIFO_EMPTY 0x00000004UL
33 #define ADC_INTR_FIFO_ALMOST_FULL 0x00000008UL
34 
35 #define ADC_CH_VBAT ADC_CH14
36 #define ADC_CH_TEMP ADC_CH15
37 #define ADC_EFUSE_SAMPLES (16) //c0: 32, e0: 16
38 
39 #define ADC_VBAT_SAMPLES (16)
40 #define ADC_TEMP_SAMPLES (16)
41 #define ADC_CHX_SAMPLES (16)
42 
43 #define ADC_SAMPLE_RETRY (1000)
44 
45 enum adc_ch{
46  ADC_CH0 = 0,
56  ADC_CH10 = 10,
60  ADC_CH14 = 14,
61  ADC_CH15 = 15,
62  ADC_CH_MAX = 16,
63 };
64 enum adc_error {
65  ADC_ERR_OK = 0,
66  ADC_ERR_INVALID_PARAM = -1,
67  ADC_ERR_EFUSE = -2,
68  ADC_ERR_SMEM = -3,
69  ADC_ERR_HW = -4,
70  ADC_ERR_TIMEOUT = -5,
71  ADC_ERR_SEMA = -6,
72  ADC_ERR_INIT = -7,
73 
74 };
75 typedef enum adc_vref {
78 }adc_vref_t ;
79 typedef struct {
80  int vref;
81  int irq_prio;
82  void *arg;
83  void (*cb)(void *arg);
84 } adc_init_t;
85 
86 
87 typedef struct adc_ch_timing {
88  uint8_t sample_dly;
89  uint8_t sample_dly_en;
90  uint8_t capture_clk_half_duration;
91  uint8_t num_cap_clk;
92 } adc_ch_timing_t;
93 
94 
95 static INLINE uint32_t adc_intr_status(void)
96 {
97  return RD_WORD(SADCCTRL_REG_INTR_STATUS);
98 }
99 static INLINE uint32_t adc_intr_mask_status(void)
100 {
101  return RD_WORD(SADCCTRL_REG_INTR_MASK_STATUS);
102 }
103 static INLINE void adc_intr_clear(uint32_t reg)
104 {
105  WR_WORD(SADCCTRL_REG_INTR_CLEAR, reg);
106 }
107 static INLINE void adc_intr_set(uint32_t reg)
108 {
109  WR_WORD(SADCCTRL_REG_INTR_SET, reg);
110 }
111 static INLINE void adc_intr_mask_clear(uint32_t reg)
112 {
113  WR_WORD(SADCCTRL_REG_INTR_MASK_CLEAR, reg);
114 }
115 static INLINE void adc_intr_mask_set(uint32_t reg)
116 {
117  WR_WORD(SADCCTRL_REG_INTR_MASK_SET, reg);
118 }
119 
120 
121 static INLINE void adc_enable(void)
122 {
123  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
124  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
125  reg |= SADCCTRL_REG_MISC_CTRL_CTL_ENABLE;
126  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
127 }
128 static INLINE void adc_disable(void)
129 {
130  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
131  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
132  reg &= ~SADCCTRL_REG_MISC_CTRL_CTL_ENABLE;
133  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
134 }
135 static INLINE void adc_start(void)
136 {
137  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
138  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
139  reg |= SADCCTRL_REG_MISC_CTRL_CTL_START;
140  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
141 }
142 static INLINE void adc_stop(void)
143 {
144  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
145  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
146  //WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
147  reg |= SADCCTRL_REG_MISC_CTRL_CTL_END;
148  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
149 }
150 static INLINE void adc_reset_interrupt(void)
151 {
152  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
153  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
154  //WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
155  reg |= SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL;
156  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
157 }
164 static INLINE void adc_use_ana_data_valid(uint8_t val)
165 {
166  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
167  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
168  if (0 == val)
169  reg &= ~SADCCTRL_REG_MISC_CTRL_CTL_USE_ANA_DATA_VALID;
170  else
171  reg |= SADCCTRL_REG_MISC_CTRL_CTL_USE_ANA_DATA_VALID;
172  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
173 }
174 
175 static INLINE void adc_en_always_on(uint8_t en)
176 {
177  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
178  if (0 == en)
179  reg &= ~SADCCTRL_REG_MISC_CTRL_CTL_ENABLE_ALWAYS_ON;
180  else
181  reg |= SADCCTRL_REG_MISC_CTRL_CTL_ENABLE_ALWAYS_ON;
182  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
183 }
184 
185 static INLINE void adc_num_sample(uint16_t val)
186 {
187  uint32_t reg = RD_WORD(SADCCTRL_REG_MISC_CTRL);
188  reg &= ~(SADCCTRL_REG_MISC_CTRL_CTL_START|SADCCTRL_REG_MISC_CTRL_CTL_END|SADCCTRL_REG_MISC_CTRL_CTL_RST_INTRCTRL);
189  reg &= ~SADCCTRL_REG_MISC_CTRL_CTL_NUM_SAMPLES;
190  reg |= val<<16;
191  WR_WORD(SADCCTRL_REG_MISC_CTRL, reg);
192 }
193 
194 
195 static INLINE void adc_set_ch_en(uint16_t val)
196 {
197  uint32_t reg = RD_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL);
198  reg &= ~SADCCTRL_REG_CHANNEL_EN_CTRL_CTL_CH_EN;
199  reg |= val;
200  WR_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL, reg);
201 }
202 static INLINE uint32_t adc_get_ch_en(void)
203 {
204  return RD_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL) & SADCCTRL_REG_CHANNEL_EN_CTRL_CTL_CH_EN;
205 }
206 
207 static INLINE void adc_sample_grp_intv(uint8_t val)
208 {
209  uint32_t reg = RD_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL);
210  reg &= ~SADCCTRL_REG_CHANNEL_EN_CTRL_CTL_SAMPLE_GRP_INTERVAL;
211  reg |= val << SADCCTRL_REG_CHANNEL_EN_CTRL_CTL_SAMPLE_GRP_INTERVAL_SHIFT;
212  WR_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL, reg);
213 }
214 static INLINE void adc_disable_grp_intv(uint8_t disable)
215 {
216  uint32_t reg = RD_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL);
217  if (0 == disable)
218  reg &= ~SADCCTRL_REG_CHANNEL_EN_CTRL_CTL_DISABLE_BETWEEN_GRP;
219  else
220  reg |= SADCCTRL_REG_CHANNEL_EN_CTRL_CTL_DISABLE_BETWEEN_GRP;
221  WR_WORD(SADCCTRL_REG_CHANNEL_EN_CTRL, reg);
222 }
223 
224 static INLINE void adc_en2start_delay(uint8_t val)
225 {
226  uint32_t reg = RD_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL);
227  reg &= ~SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_EN2START_DELAY;
228  reg |= val & SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_EN2START_DELAY_MASK;
229  WR_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL, reg);
230 }
231 static INLINE void adc_ch2start_delay(uint8_t val)
232 {
233  uint32_t reg = RD_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL);
234  reg &= ~SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_CH2START_DLY_M1;
235  reg |= (val& SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_CH2START_DLY_M1_MASK) << SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_CH2START_DLY_M1_SHIFT;
236  WR_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL, reg);
237 }
238 
239 static INLINE void adc_conv_clk_half_duration(uint8_t val) {
240  uint32_t reg = RD_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL);
241  reg &= ~SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_CONV_CLK_HLF_DUR;
242  reg |= (val& SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_CONV_CLK_HLF_DUR_MASK) << SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_CONV_CLK_HLF_DUR_SHIFT;
243  WR_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL, reg);
244 }
245 static INLINE void adc_start_to_capture_offset(uint8_t val)
246 {
247  uint32_t reg = RD_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL);
248  reg &= ~SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_START_TO_CLK_OFFSET;
249  reg |= (val & SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_START_TO_CLK_OFFSET_MASK) << SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_START_TO_CLK_OFFSET_SHIFT;
250  WR_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL, reg);
251 }
252 static INLINE void adc_ignore_num_clk_before_ready(uint8_t n)
253 {
254  uint32_t reg = RD_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL);
255  reg &= ~SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_IGNORE_RDY_NUM_CLK;
256  reg |= (n & SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_IGNORE_RDY_NUM_CLK_MASK) << SADCCTRL_REG_SAMPLE_TIMING_CTRL_CTL_IGNORE_RDY_NUM_CLK_SHIFT;
257  WR_WORD(SADCCTRL_REG_SAMPLE_TIMING_CTRL, reg);
258 }
259 
260 static INLINE void adc_fifo_size(uint16_t reg)
261 {
262  WR_WORD(SADCCTRL_REG_FIFO_CTRL, reg);
263 }
264 static INLINE void adc_fifo_almost_full(uint16_t reg)
265 {
266  WR_WORD(SADCCTRL_REG_FIFO_ALMOST_FULL_CTRL, reg);
267 }
268 
269 static INLINE uint8_t adc_cur_ch()
270 {
271  return RD_WORD(SADCCTRL_REG_STATUS)&SADCCTRL_REG_STATUS_STS_CURR_CH;
272 }
273 static INLINE uint16_t adc_fifo_cnt()
274 {
275  return (RD_WORD(SADCCTRL_REG_STATUS)&SADCCTRL_REG_STATUS_STS_FIFO_CNT)>>4;
276 }
277 static INLINE uint8_t adc_fifo_data_ready()
278 {
279  return (RD_WORD(SADCCTRL_REG_STATUS)&SADCCTRL_REG_STATUS_STS_FIFO_RDATA_RDY) >> 31u;
280 }
281 
282 static INLINE uint16_t adc_status2_curr_grp_cnt_get(void) {
283  return RD_WORD(SADCCTRL_REG_STATUS2)&SADCCTRL_REG_STATUS2_STS_CURR_GRP_CNT_MASK;
284 }
285 
286 static INLINE uint16_t adc_fifo_data()
287 {
288  return RD_WORD(SADCCTRL_REG_FIFO_VAL);
289 }
290 
291 static INLINE void adc_force_enable()
292 {
293  uint32_t reg = RD_WORD(SADCCTRL_REG_FORCE_CTRL);
294  reg |= SADCCTRL_REG_FORCE_CTRL_CTL_FORCE_EN;
295  WR_WORD(SADCCTRL_REG_FORCE_CTRL, reg);
296 }
297 
298 static INLINE void adc_force_disable()
299 {
300  uint32_t reg = RD_WORD(SADCCTRL_REG_FORCE_CTRL);
301  reg &= ~SADCCTRL_REG_FORCE_CTRL_CTL_FORCE_EN;
302  WR_WORD(SADCCTRL_REG_FORCE_CTRL, reg);
303 }
304 
305 static INLINE void adc_force_ch(uint8_t val)
306 {
307  uint32_t reg = RD_WORD(SADCCTRL_REG_FORCE_CTRL);
308  reg &= ~SADCCTRL_REG_FORCE_CTRL_CTL_FORCE_CH;
309  reg |= (val & SADCCTRL_REG_FORCE_CTRL_CTL_FORCE_CH_MASK) << SADCCTRL_REG_FORCE_CTRL_CTL_FORCE_CH_SHIFT;
310  WR_WORD(SADCCTRL_REG_FORCE_CTRL, reg);
311 }
312 
313 static INLINE uint8_t adc_sts_curr_adc_data_valid(void)
314 {
315  return (RD_WORD(SADCCTRL_REG_FORCE_CTRL) & SADCCTRL_REG_FORCE_CTRL_STS_CURR_ADC_DATA_VALID)>>31u;
316 }
317 
318 static INLINE void adc_force_start(uint8_t val)
319 {
320  uint32_t reg = RD_WORD(SADCCTRL_REG_FORCE_CTRL_START);
321  if (0 == val)
322  reg &= ~SADCCTRL_REG_FORCE_CTRL_START_CTL_FORCE_START;
323  else
324  reg |= SADCCTRL_REG_FORCE_CTRL_START_CTL_FORCE_START;
325  WR_WORD(SADCCTRL_REG_FORCE_CTRL_START, reg);
326 }
327 
328 static INLINE uint16_t adc_cur_adc_val()
329 {
330  return RD_WORD(SADCCTRL_REG_CURR_ADC_VAL) & SADCCTRL_REG_CURR_ADC_VAL_STS_CUR_ADC_VAL_MASK;
331 }
332 
333 static INLINE uint16_t adc_force_adc_val()
334 {
335  return (RD_WORD(SADCCTRL_REG_CURR_ADC_VAL) & SADCCTRL_REG_CURR_ADC_VAL_STS_FORCE_ADC_VAL) >> SADCCTRL_REG_CURR_ADC_VAL_STS_FORCE_ADC_VAL_SHIFT;
336 }
337 
338 
339 #define ADC_REF_SEL_MASK 0x000000E0UL
340 // #define ADC_REF_V1P0 0
341 // #define ADC_REF_VBAT_DIV2 1
342 // #define ADC_REF_CH0 2
343 // #define ADC_REF_CH2 3
344 // #define ADC_REF_CH4 4
345 // #define ADC_REF_CH6 5
346 // #define ADC_REF_CH8 6
347 // #define ADC_REF_CH10 7
348 
349 
350 
351 static INLINE void adc_ref_sel(int val)
352 {
353  uint32_t reg = RD_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3);
354  if (val == 0)
355  reg &= ~(1<<24);
356  else
357  reg |= 1<<24;
358  WR_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3, reg);
359 }
360 static INLINE void adc_ref_code(uint32_t val)
361 {
362  uint32_t reg = RD_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3);
363  reg &= ~(0x1F<<19);
364  reg |= (val&0x1F)<<19;
365  WR_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3, reg);
366 }
367 #define ADC_CH_SEL_MASK 0x10UL
368 static INLINE void adc_ch_sel(uint8_t en, uint32_t ch)
369 {
370  uint32_t reg = RD_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3);
371  if (1 != en) {
372  reg &= ~(1 << 4u);
373  } else {
374  reg &= ~0x0fu;
375  reg |= ch & 0x0fu;
376  reg |= (1 << 4u);
377  }
378  WR_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3, reg);
379 }
380 
381 static INLINE void adc_clk_edge_set(uint8_t val)
382 {
383  uint32_t reg = RD_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3);
384  if (1 != val) {
385  reg &= ~(1 << 8u);
386  } else {
387  reg |= (1 << 8u);
388  }
389  WR_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3, reg);
390 }
391 
392 static INLINE void adc_offset_cal_en(int en)
393 {
394  uint32_t reg = RD_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3);
395  if (en) {
396  reg |= 1<<13;
397  } else {
398  reg &= ~(1<<13);
399  }
400  WR_WORD(SADCCTRL_REG_SENSOR_ADC_REG1TO3, reg);
401 }
402 
403 static INLINE void adc_num_cap_clk(uint32_t addr, uint32_t num)
404 {
405  uint32_t reg = RD_WORD(addr);
406  reg &= ~SADCCTRL_REG_CH0_CTL_NUM_CAP_CLK;
407  reg |= (num&SADCCTRL_REG_CH0_CTL_NUM_CAP_CLK_MASK)<<SADCCTRL_REG_CH0_CTL_NUM_CAP_CLK_SHIFT;
408  WR_WORD(addr, reg);
409 }
410 
411 static INLINE void adc_cap_clk_hlf_dur(uint32_t addr, uint32_t num)
412 {
413  uint32_t reg = RD_WORD(addr);
414  reg &= ~SADCCTRL_REG_CH0_CTL_CAP_CLK_HLF_DUR;
415  reg |= (num&SADCCTRL_REG_CH0_CTL_CAP_CLK_HLF_DUR_MASK)<<SADCCTRL_REG_CH0_CTL_CAP_CLK_HLF_DUR_SHIFT;
416  WR_WORD(addr, reg);
417 }
425 int hal_adc_open(adc_init_t *init);
426 
433 void hal_adc_close(void);
434 
435 
443 int hal_adc_force_mode_enable_ch(int ch);
444 
453 
463 int hal_adc_force_mode_start(int ch, uint16_t* buff, uint16_t sample_num);
464 
474 int hal_adc_auto_mode_enable_ch(int ch, uint16_t *buf, uint16_t buf_sz);
475 
483 int hal_adc_auto_mode_disable_ch(int ch);
484 
492 int hal_adc_auto_mode_config(uint8_t grp_intv);
493 
494 
502 int hal_adc_auto_mode_start(uint16_t sample_num);
503 
504 
513 int hal_adc_set_vref(int vref);
514 
515 
516 
527 int hal_adc_measure_analog_ch(int ch, float vref, float* vc);
528 
529 
538 float hal_adc_sample_convert(uint16_t adc_val);
539 
548 float hal_adc_vbat_sample_convert(uint16_t adc_val);
549 
558 float hal_adc_temp_sample_convert(uint16_t adc_val);
559 
569 int hal_adc_auto_mode_cap_clk(int ch, uint32_t cap_clk);
570 
579 int hal_adc_force_mode_cap_clk(uint32_t cap_clk);
580 
590 int hal_adc_measure_temp(uint16_t sample_num, float *temp);
592 
593 #endif
594 
int hal_adc_auto_mode_disable_ch(int ch)
Disable channel in auto mode.
internal 1.5v
Definition: hal_adc.h:77
int hal_adc_measure_temp(uint16_t sample_num, float *temp)
Read temperature, this function is more accurate than hal_adc_force_mode_start or hal_adc_auto_mode_s...
adc_ch
Definition: hal_adc.h:45
VBAT.
Definition: hal_adc.h:60
GPIO_2_9.
Definition: hal_adc.h:47
GPIO_2_6.
Definition: hal_adc.h:50
float hal_adc_temp_sample_convert(uint16_t adc_val)
convert temperature sample(channel 15) value to temperature, unit is centigrade
GPIO_2_0.
Definition: hal_adc.h:56
GPIO_3_1.
Definition: hal_adc.h:57
adc_vref
Definition: hal_adc.h:75
GPIO_3_0.
Definition: hal_adc.h:58
ADC_CH_IN.
Definition: hal_adc.h:46
int hal_adc_open(adc_init_t *init)
Open ADC device.
int hal_adc_measure_analog_ch(int ch, float vref, float *vc)
read analog channel voltage.
int hal_adc_auto_mode_cap_clk(int ch, uint32_t cap_clk)
Set capture clock for auto mode.
int hal_adc_auto_mode_start(uint16_t sample_num)
Start auto mode.
temperature sensor
Definition: hal_adc.h:61
GPIO_2_2.
Definition: hal_adc.h:54
GPIO_2_8.
Definition: hal_adc.h:48
GPIO_2_7.
Definition: hal_adc.h:49
GPIO_2_1.
Definition: hal_adc.h:55
int hal_adc_force_mode_enable_ch(int ch)
Enable channel in force mode.
GPIO_2_4.
Definition: hal_adc.h:52
int hal_adc_auto_mode_config(uint8_t grp_intv)
Config auto mode.
float hal_adc_sample_convert(uint16_t adc_val)
convert adc sample value to voltage, unit is mV, vref must be 1.0v
float hal_adc_vbat_sample_convert(uint16_t adc_val)
convert vbat(channel 14) sample value to voltage, unit is mV
int hal_adc_force_mode_cap_clk(uint32_t cap_clk)
Set capture clock for force mode.
void hal_adc_close(void)
Close ADC device.
int hal_adc_force_mode_disable_ch(int ch)
Disable channel in force mode.
PMU internal testpoint.
Definition: hal_adc.h:59
int hal_adc_set_vref(int vref)
Set ADC reference. Default is internal 1.0v.
GPIO_2_3.
Definition: hal_adc.h:53
int hal_adc_auto_mode_enable_ch(int ch, uint16_t *buf, uint16_t buf_sz)
Enable channel in auto mode.
int hal_adc_force_mode_start(int ch, uint16_t *buff, uint16_t sample_num)
Start force mode.
internal 1.0v
Definition: hal_adc.h:76
GPIO_2_5.
Definition: hal_adc.h:51