|
9 | 9 | #include <zephyr/drivers/comparator/nrf_lpcomp.h> |
10 | 10 | #include <zephyr/kernel.h> |
11 | 11 | #include <zephyr/pm/device.h> |
| 12 | +#include "comparator_nrf_common.h" |
12 | 13 |
|
13 | 14 | #include <string.h> |
14 | 15 |
|
@@ -38,30 +39,6 @@ struct shim_nrf_lpcomp_data { |
38 | 39 | void *user_data; |
39 | 40 | }; |
40 | 41 |
|
41 | | -#if (NRF_LPCOMP_HAS_AIN_AS_PIN) |
42 | | -static const uint32_t shim_nrf_lpcomp_ain_map[] = { |
43 | | -#if defined(CONFIG_SOC_NRF54H20) || defined(CONFIG_SOC_NRF9280) |
44 | | - NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1), |
45 | | - NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1), |
46 | | - NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1), |
47 | | - NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1), |
48 | | - NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), |
49 | | - NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), |
50 | | - NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), |
51 | | - NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), |
52 | | -#elif defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15) |
53 | | - NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1), |
54 | | - NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1), |
55 | | - NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1), |
56 | | - NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1), |
57 | | - NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1), |
58 | | - NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1), |
59 | | - NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1), |
60 | | - NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1), |
61 | | -#endif |
62 | | -}; |
63 | | -#endif |
64 | | - |
65 | 42 | #if (NRF_LPCOMP_HAS_AIN_AS_PIN) |
66 | 43 | BUILD_ASSERT(COMP_NRF_LPCOMP_PSEL_AIN0 == 0); |
67 | 44 | BUILD_ASSERT(COMP_NRF_LPCOMP_PSEL_AIN7 == 7); |
@@ -152,11 +129,11 @@ static int shim_nrf_lpcomp_pm_callback(const struct device *dev, enum pm_device_ |
152 | 129 | static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, |
153 | 130 | nrf_lpcomp_input_t *nrf) |
154 | 131 | { |
155 | | - if (shim >= ARRAY_SIZE(shim_nrf_lpcomp_ain_map)) { |
| 132 | + if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { |
156 | 133 | return -EINVAL; |
157 | 134 | } |
158 | 135 |
|
159 | | - *nrf = shim_nrf_lpcomp_ain_map[(uint32_t)shim]; |
| 136 | + *nrf = shim_nrf_comp_ain_map[(uint32_t)shim]; |
160 | 137 | return 0; |
161 | 138 | } |
162 | 139 | #else |
@@ -208,11 +185,11 @@ static int shim_nrf_lpcomp_psel_to_nrf(enum comp_nrf_lpcomp_psel shim, |
208 | 185 | static int shim_nrf_lpcomp_extrefsel_to_nrf(enum comp_nrf_lpcomp_extrefsel shim, |
209 | 186 | nrf_lpcomp_ext_ref_t *nrf) |
210 | 187 | { |
211 | | - if (shim >= ARRAY_SIZE(shim_nrf_lpcomp_ain_map)) { |
| 188 | + if (shim >= ARRAY_SIZE(shim_nrf_comp_ain_map)) { |
212 | 189 | return -EINVAL; |
213 | 190 | } |
214 | 191 |
|
215 | | - *nrf = shim_nrf_lpcomp_ain_map[shim]; |
| 192 | + *nrf = shim_nrf_comp_ain_map[shim]; |
216 | 193 | return 0; |
217 | 194 | } |
218 | 195 | #else |
|
0 commit comments