diff options
-rw-r--r-- | include/adc.h | 19 | ||||
-rw-r--r-- | zephyr/shim/include/zephyr_adc.h | 29 |
2 files changed, 30 insertions, 18 deletions
diff --git a/include/adc.h b/include/adc.h index 2ead96f5b3..e3d0692b87 100644 --- a/include/adc.h +++ b/include/adc.h @@ -13,24 +13,7 @@ #define ADC_READ_ERROR -1 /* Value returned by adc_read_channel() on error */ #ifdef CONFIG_ZEPHYR -#ifdef CONFIG_PLATFORM_EC_ADC -#define NODE_ID_AND_COMMA(node_id) node_id, -enum adc_channel { -#if DT_NODE_EXISTS(DT_INST(0, named_adc_channels)) - DT_FOREACH_CHILD(DT_INST(0, named_adc_channels), NODE_ID_AND_COMMA) -#endif /* named_adc_channels */ - ADC_CH_COUNT -}; - -struct adc_t { - const char *name; - uint8_t input_ch; - int factor_mul; - int factor_div; -}; - -extern const struct adc_t adc_channels[]; -#endif /* CONFIG_PLATFORM_EC_ADC */ +#include <zephyr_adc.h> #endif /* CONFIG_ZEPHYR */ /* diff --git a/zephyr/shim/include/zephyr_adc.h b/zephyr/shim/include/zephyr_adc.h new file mode 100644 index 0000000000..121f8db849 --- /dev/null +++ b/zephyr/shim/include/zephyr_adc.h @@ -0,0 +1,29 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef __CROS_EC_ZEPHYR_ADC_H +#define __CROS_EC_ZEPHYR_ADC_H + +#ifdef CONFIG_PLATFORM_EC_ADC + +#define NODE_ID_AND_COMMA(node_id) node_id, +enum adc_channel { +#if DT_NODE_EXISTS(DT_INST(0, named_adc_channels)) + DT_FOREACH_CHILD(DT_INST(0, named_adc_channels), NODE_ID_AND_COMMA) +#endif /* named_adc_channels */ + ADC_CH_COUNT +}; + +struct adc_t { + const char *name; + uint8_t input_ch; + int factor_mul; + int factor_div; +}; + +extern const struct adc_t adc_channels[]; +#endif /* CONFIG_PLATFORM_EC_ADC */ + +#endif /* __CROS_EC_ZEPHYR_ADC_H */ |