1 /*
2  * Copyright (c) 2006-2025, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2020-08-18     guohp1128    the first version
9  */
10 
11 #ifndef __DRV_ADC_H__
12 #define __DRV_ADC_H__
13 
14 #include <board.h>
15 #include "rtdevice.h"
16 #include <hal/nrf_saadc.h>
17 #include <drivers/include/nrfx_saadc.h>
18 
19 #define ADC_NAME "adc"
20 
21 /*
22     previous definition in application
23 
24     set single-ended mode or differential mode.
25     selection ADC input pin, and config the number of Channel.
26 
27     mode: 0 single-ended mode,1 differential mode
28     pin_p: 0-7
29     pin_n: 0-7,if single-ended mode, pin_n invalid
30     channel_num: 0-7
31  */
32 typedef struct
33 {
34     nrf_saadc_mode_t    mode;           /* /< SAADC mode. Single-ended or differential. */
35     uint8_t             pin_p;          /* /< Input positive pin selection. */
36     uint8_t             pin_n;          /* /< Input negative pin selection. */
37     uint8_t             channel_num;    /* /< Channel number. */
38 } drv_nrfx_saadc_channel_t;
39 
40 typedef struct
41 {
42     nrfx_saadc_channel_t    channels[8];
43     uint8_t                 channel_count;
44     nrf_saadc_value_t       result_buffer[8];
45     uint8_t                 done;
46 } drv_nrfx_saadc_result_t;
47 
48 #endif /* __DRV_ADC_H__ */
49 
50