adc_arch_private.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2022 Gunar Schorcht
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include "driver/adc_types_legacy.h"
24 #include "periph/gpio.h"
25 #include "soc/soc_caps.h"
26 
27 #ifndef DOXYGEN /* hide implementation details from doxygen */
28 
29 #define RTCIO_GPIO(n) n /* n-th RTCIO GPIO */
30 #define RTCIO_NA UINT8_MAX /* RTCIO pin not available */
31 
32 #define ADC_UNIT_INV ((adc_unit_t)255) /* Invalid ADC unit ID */
33 #define ADC_CHANNEL_INV SOC_ADC_MAX_CHANNEL_NUM /* Invalid ADC channel ID */
34 
35 #define ADC1_CHANNEL_MAX (SOC_ADC_CHANNEL_NUM(ADC_UNIT_1)) /* Number of channels of ADC1 */
36 #define ADC2_CHANNEL_MAX (SOC_ADC_CHANNEL_NUM(ADC_UNIT_2)) /* Number of channels of ADC2 */
37 #define ADC_CHANNEL_MAX(u) ((u == ADC_UNIT_1) ? ADC1_CHANNEL_MAX : ADC2_CHANNEL_MAX)
38 
42 typedef struct {
43  uint8_t rtc_gpio;
44  gpio_t gpio;
45  adc_unit_t adc_ctrl;
46  adc_channel_t adc_channel;
47  char* pad_name;
48 } _adc_hw_desc_t;
49 
56 extern const _adc_hw_desc_t _adc_hw[];
57 
61 extern const gpio_t _gpio_rtcio_map[];
62 
63 #endif /* !DOXYGEN */
64 
65 #ifdef __cplusplus
66 }
67 #endif
Low-level GPIO peripheral driver interface definitions.