mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 04:59:55 +00:00 
			
		
		
		
	gpio, rtcio: removed unsupported features on different targets
This commit is contained in:
		 Michael (XIAO Xufeng)
					Michael (XIAO Xufeng)
				
			
				
					committed by
					
						 bot
						bot
					
				
			
			
				
	
			
			
			 bot
						bot
					
				
			
						parent
						
							5fa34f6a30
						
					
				
				
					commit
					6059ef26fb
				
			| @@ -20,6 +20,8 @@ | |||||||
| #include "esp_attr.h" | #include "esp_attr.h" | ||||||
| #include "soc/soc_caps.h" | #include "soc/soc_caps.h" | ||||||
|  |  | ||||||
|  | #if SOC_DEDICATED_GPIO_SUPPORTED | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| extern "C" { | extern "C" { | ||||||
| #endif | #endif | ||||||
| @@ -171,3 +173,5 @@ esp_err_t dedic_gpio_bundle_set_interrupt_and_callback(dedic_gpio_bundle_handle_ | |||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #endif //SOC_DEDICATED_GPIO_SUPPORTED | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
| // Licensed under the Apache License, Version 2.0 (the "License"); | // Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| // you may not use this file except in compliance with the License. | // you may not use this file except in compliance with the License. | ||||||
| // You may obtain a copy of the License at | // You may obtain a copy of the License at | ||||||
|  | // | ||||||
| //     http://www.apache.org/licenses/LICENSE-2.0 | //     http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| // | // | ||||||
| // Unless required by applicable law or agreed to in writing, software | // Unless required by applicable law or agreed to in writing, software | ||||||
| @@ -492,28 +492,6 @@ esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode); | |||||||
|  *     - ESP_ERR_INVALID_ARG : Parameter error |  *     - ESP_ERR_INVALID_ARG : Parameter error | ||||||
|  */ |  */ | ||||||
| esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); | esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull); | ||||||
|  |  | ||||||
| #if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL |  | ||||||
| /** |  | ||||||
|   * @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information |  | ||||||
|   * |  | ||||||
|   * @note Need to be called before sleep. |  | ||||||
|   * |  | ||||||
|   * @return |  | ||||||
|   *      - ESP_OK Success |  | ||||||
|   */ |  | ||||||
| esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num); |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|   * @brief Emulate ESP32S2 behaviour to restore FUN_PU, FUN_PD information |  | ||||||
|   * |  | ||||||
|   * @note Need to be called after sleep. |  | ||||||
|   * |  | ||||||
|   * @return |  | ||||||
|   *      - ESP_OK Success |  | ||||||
|   */ |  | ||||||
| esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num); |  | ||||||
| #endif |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP | #if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP | ||||||
|   | |||||||
| @@ -17,10 +17,12 @@ | |||||||
|  |  | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include "esp_err.h" | #include "esp_err.h" | ||||||
| #include "driver/gpio.h" |  | ||||||
| #include "soc/soc_caps.h" | #include "soc/soc_caps.h" | ||||||
| #include "soc/rtc_io_periph.h" | #include "soc/rtc_io_periph.h" | ||||||
| #include "hal/rtc_io_types.h" | #include "hal/rtc_io_types.h" | ||||||
|  | #include "driver/gpio.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| extern "C" { | extern "C" { | ||||||
| #endif | #endif | ||||||
| @@ -42,6 +44,7 @@ static inline bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num) | |||||||
|  |  | ||||||
| #define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) // Deprecated, use rtc_gpio_is_valid_gpio() | #define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) // Deprecated, use rtc_gpio_is_valid_gpio() | ||||||
|  |  | ||||||
|  | #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED | ||||||
| /** | /** | ||||||
|  * @brief Get RTC IO index number by gpio number. |  * @brief Get RTC IO index number by gpio number. | ||||||
|  * |  * | ||||||
| @@ -52,15 +55,9 @@ static inline bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num) | |||||||
|  */ |  */ | ||||||
| static inline int rtc_io_number_get(gpio_num_t gpio_num) | static inline int rtc_io_number_get(gpio_num_t gpio_num) | ||||||
| { | { | ||||||
| #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED |  | ||||||
|     return rtc_io_num_map[gpio_num]; |     return rtc_io_num_map[gpio_num]; | ||||||
| #else |  | ||||||
|     return gpio_num; |  | ||||||
| #endif |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @brief Init a GPIO as RTC GPIO |  * @brief Init a GPIO as RTC GPIO | ||||||
|  * |  * | ||||||
|   | |||||||
							
								
								
									
										45
									
								
								components/driver/include/esp_private/gpio.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								components/driver/include/esp_private/gpio.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | |||||||
|  | // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD | ||||||
|  | // | ||||||
|  | // Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  | // you may not use this file except in compliance with the License. | ||||||
|  | // You may obtain a copy of the License at | ||||||
|  | // | ||||||
|  | //     http://www.apache.org/licenses/LICENSE-2.0 | ||||||
|  | // | ||||||
|  | // Unless required by applicable law or agreed to in writing, software | ||||||
|  | // distributed under the License is distributed on an "AS IS" BASIS, | ||||||
|  | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
|  | // See the License for the specific language governing permissions and | ||||||
|  | // limitations under the License. | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  |  | ||||||
|  | #include "sdkconfig.h" | ||||||
|  | #include <esp_types.h> | ||||||
|  |  | ||||||
|  | #include "soc/soc_caps.h" | ||||||
|  | #include "driver/gpio.h" | ||||||
|  |  | ||||||
|  | #if SOC_GPIO_SUPPORT_SLP_SWITCH | ||||||
|  | #if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL | ||||||
|  | /** | ||||||
|  |   * @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information | ||||||
|  |   * | ||||||
|  |   * @note Need to be called before sleep. | ||||||
|  |   * | ||||||
|  |   * @return | ||||||
|  |   *      - ESP_OK Success | ||||||
|  |   */ | ||||||
|  | esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num); | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |   * @brief Emulate ESP32S2 behaviour to restore FUN_PU, FUN_PD information | ||||||
|  |   * | ||||||
|  |   * @note Need to be called after sleep. | ||||||
|  |   * | ||||||
|  |   * @return | ||||||
|  |   *      - ESP_OK Success | ||||||
|  |   */ | ||||||
|  | esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num); | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
| @@ -53,14 +53,14 @@ | |||||||
| #include "esp32/rom/cache.h" | #include "esp32/rom/cache.h" | ||||||
| #include "esp32/clk.h" | #include "esp32/clk.h" | ||||||
| #include "esp32/rom/rtc.h" | #include "esp32/rom/rtc.h" | ||||||
| #include "driver/gpio.h" | #include "esp_private/gpio.h" | ||||||
| #elif CONFIG_IDF_TARGET_ESP32S2 | #elif CONFIG_IDF_TARGET_ESP32S2 | ||||||
| #include "esp32s2/clk.h" | #include "esp32s2/clk.h" | ||||||
| #include "esp32s2/rom/cache.h" | #include "esp32s2/rom/cache.h" | ||||||
| #include "esp32s2/rom/rtc.h" | #include "esp32s2/rom/rtc.h" | ||||||
| #include "esp32s2/brownout.h" | #include "esp32s2/brownout.h" | ||||||
| #include "soc/extmem_reg.h" | #include "soc/extmem_reg.h" | ||||||
| #include "driver/gpio.h" | #include "esp_private/gpio.h" | ||||||
| #elif CONFIG_IDF_TARGET_ESP32S3 | #elif CONFIG_IDF_TARGET_ESP32S3 | ||||||
| #include "esp32s3/clk.h" | #include "esp32s3/clk.h" | ||||||
| #include "esp32s3/rom/cache.h" | #include "esp32s3/rom/cache.h" | ||||||
|   | |||||||
| @@ -30,11 +30,6 @@ extern "C" { | |||||||
| // GPIO0~5 on ESP32C3 can support chip deep sleep wakeup | // GPIO0~5 on ESP32C3 can support chip deep sleep wakeup | ||||||
| #define SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP      (1) | #define SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP      (1) | ||||||
|  |  | ||||||
| #define GPIO_MODE_DEF_DISABLE         (0) |  | ||||||
| #define GPIO_MODE_DEF_INPUT           (BIT0) |  | ||||||
| #define GPIO_MODE_DEF_OUTPUT          (BIT1) |  | ||||||
| #define GPIO_MODE_DEF_OD              (BIT2) |  | ||||||
|  |  | ||||||
| #define SOC_GPIO_VALID_GPIO_MASK        ((1U<<SOC_GPIO_PIN_COUNT) - 1) | #define SOC_GPIO_VALID_GPIO_MASK        ((1U<<SOC_GPIO_PIN_COUNT) - 1) | ||||||
| #define SOC_GPIO_VALID_OUTPUT_GPIO_MASK SOC_GPIO_VALID_GPIO_MASK | #define SOC_GPIO_VALID_OUTPUT_GPIO_MASK SOC_GPIO_VALID_GPIO_MASK | ||||||
| #define SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK        (0ULL | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5) | #define SOC_GPIO_DEEP_SLEEP_WAKEUP_VALID_GPIO_MASK        (0ULL | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user