adc_arch_private.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "driver/adc_types_legacy.h"
27 #include "periph/gpio.h"
28 #include "soc/soc_caps.h"
29 
30 #ifndef DOXYGEN /* hide implementation details from doxygen */
31 
32 #define RTCIO_GPIO(n) n /* n-th RTCIO GPIO */
33 #define RTCIO_NA UINT8_MAX /* RTCIO pin not available */
34 
35 #define ADC_UNIT_INV ((adc_unit_t)255) /* Invalid ADC unit ID */
36 #define ADC_CHANNEL_INV SOC_ADC_MAX_CHANNEL_NUM /* Invalid ADC channel ID */
37 
38 #define ADC1_CHANNEL_MAX (SOC_ADC_CHANNEL_NUM(ADC_UNIT_1)) /* Number of channels of ADC1 */
39 #define ADC2_CHANNEL_MAX (SOC_ADC_CHANNEL_NUM(ADC_UNIT_2)) /* Number of channels of ADC2 */
40 #define ADC_CHANNEL_MAX(u) ((u == ADC_UNIT_1) ? ADC1_CHANNEL_MAX : ADC2_CHANNEL_MAX)
41 
45 typedef struct {
46  uint8_t rtc_gpio;
47  gpio_t gpio;
48  adc_unit_t adc_ctrl;
49  adc_channel_t adc_channel;
50  char* pad_name;
51 } _adc_hw_desc_t;
52 
59 extern const _adc_hw_desc_t _adc_hw[];
60 
64 extern const gpio_t _gpio_rtcio_map[];
65 
66 #endif /* !DOXYGEN */
67 
68 #ifdef __cplusplus
69 }
70 #endif
Low-level GPIO peripheral driver interface definitions.