File tree Expand file tree Collapse file tree 4 files changed +63
-1
lines changed
include/zephyr/dt-bindings/adc Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 77#define ADC_CONTEXT_USES_KERNEL_TIMER
88#include "adc_context.h"
99#include <nrfx_adc.h>
10+ #include <zephyr/dt-bindings/adc/nrf-adc.h>
1011
1112#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL
1213#include <zephyr/logging/log.h>
1314LOG_MODULE_REGISTER (adc_nrfx_adc );
1415
1516#define DT_DRV_COMPAT nordic_nrf_adc
1617
18+ /* Ensure that definitions in nrf-adc.h match MDK. */
19+ BUILD_ASSERT ((NRF_ADC_AIN0 == NRF_ADC_CONFIG_INPUT_0 ) &&
20+ (NRF_ADC_AIN1 == NRF_ADC_CONFIG_INPUT_1 ) &&
21+ (NRF_ADC_AIN2 == NRF_ADC_CONFIG_INPUT_2 ) &&
22+ (NRF_ADC_AIN3 == NRF_ADC_CONFIG_INPUT_3 ) &&
23+ (NRF_ADC_AIN4 == NRF_ADC_CONFIG_INPUT_4 ) &&
24+ (NRF_ADC_AIN5 == NRF_ADC_CONFIG_INPUT_5 ) &&
25+ (NRF_ADC_AIN6 == NRF_ADC_CONFIG_INPUT_6 ) &&
26+ (NRF_ADC_AIN7 == NRF_ADC_CONFIG_INPUT_7 ),
27+ "Definitions from nrf-adc.h do not match those from nrf_adc.h" );
28+
1729struct driver_data {
1830 struct adc_context ctx ;
1931
Original file line number Diff line number Diff line change 77#define ADC_CONTEXT_USES_KERNEL_TIMER
88#include "adc_context.h"
99#include <hal/nrf_saadc.h>
10+ #include <zephyr/dt-bindings/adc/nrf-adc.h>
1011
1112#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL
1213#include <zephyr/logging/log.h>
1314LOG_MODULE_REGISTER (adc_nrfx_saadc );
1415
1516#define DT_DRV_COMPAT nordic_nrf_saadc
1617
18+ BUILD_ASSERT ((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0 ) &&
19+ (NRF_SAADC_AIN1 == NRF_SAADC_INPUT_AIN1 ) &&
20+ (NRF_SAADC_AIN2 == NRF_SAADC_INPUT_AIN2 ) &&
21+ (NRF_SAADC_AIN3 == NRF_SAADC_INPUT_AIN3 ) &&
22+ (NRF_SAADC_AIN4 == NRF_SAADC_INPUT_AIN4 ) &&
23+ (NRF_SAADC_AIN5 == NRF_SAADC_INPUT_AIN5 ) &&
24+ (NRF_SAADC_AIN6 == NRF_SAADC_INPUT_AIN6 ) &&
25+ (NRF_SAADC_AIN7 == NRF_SAADC_INPUT_AIN7 ) &&
26+ (NRF_SAADC_AIN7 == NRF_SAADC_INPUT_AIN7 ) &&
27+ #if defined(SAADC_CH_PSELP_PSELP_VDDHDIV5 )
28+ (NRF_SAADC_VDDHDIV5 == NRF_SAADC_INPUT_VDDHDIV5 ) &&
29+ #endif
30+ (NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD ),
31+ "Definitions from nrf-adc.h do not match those from nrf_saadc.h" );
32+
1733struct driver_data {
1834 struct adc_context ctx ;
1935
Original file line number Diff line number Diff line change 44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7- #include <zephyr/dt-bindings/i2c/i2c.h>
7+ #include <zephyr/dt-bindings/adc/adc.h>
8+ #include <zephyr/dt-bindings/adc/nrf-adc.h>
89#include <zephyr/dt-bindings/gpio/gpio.h>
10+ #include <zephyr/dt-bindings/i2c/i2c.h>
911#include <zephyr/dt-bindings/pinctrl/nrf-pinctrl.h>
1012#include <zephyr/dt-bindings/pwm/pwm.h>
1113
Original file line number Diff line number Diff line change 1+ /*
2+ * SPDX-License-Identifier: Apache-2.0
3+ *
4+ * Copyright (c) 2022 Nordic Semiconductor ASA
5+ */
6+
7+ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_ADC_H_
8+ #define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_ADC_H_
9+
10+ #include <zephyr/dt-bindings/dt-util.h>
11+
12+ #define NRF_ADC_AIN0 BIT(0)
13+ #define NRF_ADC_AIN1 BIT(1)
14+ #define NRF_ADC_AIN2 BIT(2)
15+ #define NRF_ADC_AIN3 BIT(3)
16+ #define NRF_ADC_AIN4 BIT(4)
17+ #define NRF_ADC_AIN5 BIT(5)
18+ #define NRF_ADC_AIN6 BIT(6)
19+ #define NRF_ADC_AIN7 BIT(7)
20+
21+ #define NRF_SAADC_AIN0 1
22+ #define NRF_SAADC_AIN1 2
23+ #define NRF_SAADC_AIN2 3
24+ #define NRF_SAADC_AIN3 4
25+ #define NRF_SAADC_AIN4 5
26+ #define NRF_SAADC_AIN5 6
27+ #define NRF_SAADC_AIN6 7
28+ #define NRF_SAADC_AIN7 8
29+ #define NRF_SAADC_VDD 9
30+ #define NRF_SAADC_VDDHDIV5 13
31+
32+ #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ADC_NRF_ADC_H_ */
You can’t perform that action at this time.
0 commit comments