forked from espressif/arduino-esp32
IDF master cf457d412 (#5073)
esp-dsp: master 7cc5073 esp-face: master 420fc7e esp-rainmaker: f1b82c7 esp32-camera: master 2dded7c esp_littlefs: master d268e18
This commit is contained in:
@ -20,6 +20,8 @@
|
||||
#include "esp_attr.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if SOC_DEDICATED_GPIO_SUPPORTED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -171,3 +173,5 @@ esp_err_t dedic_gpio_bundle_set_interrupt_and_callback(dedic_gpio_bundle_handle_
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //SOC_DEDICATED_GPIO_SUPPORTED
|
||||
|
@ -3,7 +3,7 @@
|
||||
// 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
|
||||
@ -494,28 +494,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_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
|
||||
|
||||
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
|
||||
|
@ -33,9 +33,39 @@ extern "C" {
|
||||
|
||||
#define I2C_APB_CLK_FREQ APB_CLK_FREQ /*!< I2C source clock is APB clock, 80MHz */
|
||||
|
||||
#define I2C_NUM_0 (0) /*!< I2C port 0 */
|
||||
#define I2C_NUM_1 (1) /*!< I2C port 1 */
|
||||
#define I2C_NUM_MAX (SOC_I2C_NUM) /*!< I2C port max */
|
||||
#define I2C_NUM_0 (0) /*!< I2C port 0 */
|
||||
#if SOC_I2C_NUM >= 2
|
||||
#define I2C_NUM_1 (1) /*!< I2C port 1 */
|
||||
#endif
|
||||
|
||||
// I2C clk flags for users to use, can be expanded in the future.
|
||||
#define I2C_SCLK_SRC_FLAG_FOR_NOMAL (0) /*!< Any one clock source that is available for the specified frequency may be choosen*/
|
||||
#define I2C_SCLK_SRC_FLAG_AWARE_DFS (1 << 0) /*!< For REF tick clock, it won't change with APB.*/
|
||||
#define I2C_SCLK_SRC_FLAG_LIGHT_SLEEP (1 << 1) /*!< For light sleep mode.*/
|
||||
|
||||
/**
|
||||
* @brief I2C initialization parameters
|
||||
*/
|
||||
typedef struct{
|
||||
i2c_mode_t mode; /*!< I2C mode */
|
||||
int sda_io_num; /*!< GPIO number for I2C sda signal */
|
||||
int scl_io_num; /*!< GPIO number for I2C scl signal */
|
||||
bool sda_pullup_en; /*!< Internal GPIO pull mode for I2C sda signal*/
|
||||
bool scl_pullup_en; /*!< Internal GPIO pull mode for I2C scl signal*/
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t clk_speed; /*!< I2C clock frequency for master mode, (no higher than 1MHz for now) */
|
||||
} master; /*!< I2C master config */
|
||||
struct {
|
||||
uint8_t addr_10bit_en; /*!< I2C 10bit address mode enable for slave mode */
|
||||
uint16_t slave_addr; /*!< I2C address for slave mode */
|
||||
} slave; /*!< I2C slave config */
|
||||
};
|
||||
uint32_t clk_flags; /*!< Bitwise of ``I2C_SCLK_SRC_FLAG_**FOR_DFS**`` for clk source choice*/
|
||||
} i2c_config_t;
|
||||
|
||||
|
||||
typedef void *i2c_cmd_handle_t; /*!< I2C command handle */
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "hal/i2s_types.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
|
||||
#if SOC_I2S_SUPPORTS_ADC_DAC
|
||||
#include "driver/adc.h"
|
||||
#endif
|
||||
@ -82,21 +83,6 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin);
|
||||
esp_err_t i2s_set_pdm_rx_down_sample(i2s_port_t i2s_num, i2s_pdm_dsr_t dsr);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set I2S dac mode, I2S built-in DAC is disabled by default
|
||||
*
|
||||
* @param dac_mode DAC mode configurations - see i2s_dac_mode_t
|
||||
*
|
||||
* @note Built-in DAC functions are only supported on I2S0 for current ESP32 chip.
|
||||
* If either of the built-in DAC channel are enabled, the other one can not
|
||||
* be used as RTC DAC function at the same time.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
|
||||
|
||||
/**
|
||||
* @brief Install and start I2S driver.
|
||||
*
|
||||
@ -331,7 +317,23 @@ esp_err_t i2s_adc_enable(i2s_port_t i2s_num);
|
||||
* - ESP_ERR_INVALID_STATE Driver state error
|
||||
*/
|
||||
esp_err_t i2s_adc_disable(i2s_port_t i2s_num);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set I2S dac mode, I2S built-in DAC is disabled by default
|
||||
*
|
||||
* @param dac_mode DAC mode configurations - see i2s_dac_mode_t
|
||||
*
|
||||
* @note Built-in DAC functions are only supported on I2S0 for current ESP32 chip.
|
||||
* If either of the built-in DAC channel are enabled, the other one can not
|
||||
* be used as RTC DAC function at the same time.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
|
||||
#endif //SOC_I2S_SUPPORTS_ADC_DAC
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,10 +17,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/rtc_io_periph.h"
|
||||
#include "hal/rtc_io_types.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#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()
|
||||
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||
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
|
||||
*
|
||||
|
@ -28,6 +28,12 @@ extern "C" {
|
||||
/// Handle representing an SD SPI device
|
||||
typedef int sdspi_dev_handle_t;
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
||||
#define SDSPI_DEFAULT_HOST HSPI_HOST
|
||||
#else
|
||||
#define SDSPI_DEFAULT_HOST SPI2_HOST
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default sdmmc_host_t structure initializer for SD over SPI driver
|
||||
*
|
||||
@ -37,7 +43,7 @@ typedef int sdspi_dev_handle_t;
|
||||
*/
|
||||
#define SDSPI_HOST_DEFAULT() {\
|
||||
.flags = SDMMC_HOST_FLAG_SPI | SDMMC_HOST_FLAG_DEINIT_ARG, \
|
||||
.slot = HSPI_HOST, \
|
||||
.slot = SDSPI_DEFAULT_HOST, \
|
||||
.max_freq_khz = SDMMC_FREQ_DEFAULT, \
|
||||
.io_voltage = 3.3f, \
|
||||
.init = &sdspi_host_init, \
|
||||
@ -71,7 +77,7 @@ typedef struct {
|
||||
* Macro defining default configuration of SD SPI device.
|
||||
*/
|
||||
#define SDSPI_DEVICE_CONFIG_DEFAULT() {\
|
||||
.host_id = HSPI_HOST, \
|
||||
.host_id = SDSPI_DEFAULT_HOST, \
|
||||
.gpio_cs = GPIO_NUM_13, \
|
||||
.gpio_cd = SDSPI_SLOT_NO_CD, \
|
||||
.gpio_wp = SDSPI_SLOT_NO_WP, \
|
||||
@ -228,7 +234,7 @@ typedef struct {
|
||||
*
|
||||
* @note The SDIO over sdspi needs an extra interrupt line. Call ``gpio_install_isr_service()`` before this function.
|
||||
*
|
||||
* @param slot SPI controller to use (HSPI_HOST or VSPI_HOST)
|
||||
* @param slot SPI controller to use (SPI2_HOST or SPI3_HOST)
|
||||
* @param slot_config pointer to slot configuration structure
|
||||
|
||||
* @deprecated Use `sdspi_host_init_device` instead.
|
||||
|
@ -106,7 +106,7 @@ typedef struct {
|
||||
int sclk_io_num; ///< GPIO pin for Spi CLocK signal, or -1 if not used.
|
||||
int quadwp_io_num; ///< GPIO pin for WP (Write Protect) signal which is used as D2 in 4-bit communication modes, or -1 if not used.
|
||||
int quadhd_io_num; ///< GPIO pin for HD (HolD) signal which is used as D3 in 4-bit communication modes, or -1 if not used.
|
||||
int max_transfer_sz; ///< Maximum transfer size, in bytes. Defaults to 4094 if 0.
|
||||
int max_transfer_sz; ///< Maximum transfer size, in bytes. Defaults to 4092 if 0 when DMA enabled, or to `SOC_SPI_MAXIMUM_BUFFER_SIZE` if DMA is disabled.
|
||||
uint32_t flags; ///< Abilities of bus to be checked by the driver. Or-ed value of ``SPICOMMON_BUSFLAG_*`` flags.
|
||||
int intr_flags; /**< Interrupt flag for the bus to set the priority, and IRAM attribute, see
|
||||
* ``esp_intr_alloc.h``. Note that the EDGE, INTRDISABLED attribute are ignored
|
||||
@ -119,7 +119,7 @@ typedef struct {
|
||||
/**
|
||||
* @brief Initialize a SPI bus
|
||||
*
|
||||
* @warning For now, only supports HSPI and VSPI.
|
||||
* @warning SPI0/1 is not supported
|
||||
*
|
||||
* @param host_id SPI peripheral that controls this bus
|
||||
* @param bus_config Pointer to a spi_bus_config_t struct specifying how the host should be initialized
|
||||
|
@ -88,7 +88,7 @@ struct spi_slave_transaction_t {
|
||||
/**
|
||||
* @brief Initialize a SPI bus as a slave interface
|
||||
*
|
||||
* @warning For now, only supports HSPI and VSPI.
|
||||
* @warning SPI0/1 is not supported
|
||||
*
|
||||
* @param host SPI peripheral to use as a SPI slave interface
|
||||
* @param bus_config Pointer to a spi_bus_config_t struct specifying how the host should be initialized
|
||||
|
45
tools/sdk/esp32c3/include/driver/include/esp_private/gpio.h
Normal file
45
tools/sdk/esp32c3/include/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
|
Reference in New Issue
Block a user