25 #include "hal/ledc_types.h"
26 #include "hal/spi_types.h"
27 #include "soc/ledc_struct.h"
28 #include "soc/periph_defs.h"
29 #include "soc/soc_caps.h"
38 #define STDIO_UART_DEV CONFIG_ESP_CONSOLE_UART_NUM
44 #define PROVIDES_PM_SET_LOWEST
45 #define PROVIDES_PM_RESTART
46 #define PROVIDES_PM_OFF
47 #define PROVIDES_PM_LAYERED_OFF
52 #define PM_NUM_MODES (3U)
58 #define ESP_PM_MODEM_SLEEP (2U)
59 #define ESP_PM_LIGHT_SLEEP (1U)
60 #define ESP_PM_DEEP_SLEEP (0U)
68 #define CPUID_LEN (6U)
82 typedef unsigned int gpio_t;
89 #define GPIO_UNDEF (0xffffffff)
96 #define GPIO_PIN(x, y) ((x << 5) | y)
103 #define PORT_GPIO (0)
110 #define GPIO_PIN_NUMOF (SOC_GPIO_PIN_COUNT)
119 #define HAVE_GPIO_FLANK_T
135 #define HAVE_GPIO_MODE_T
151 #if SOC_GPIO_PIN_COUNT > 32
153 #define GPIO_PORT_NUMOF 2
154 #define GPIO_PORT_0 0
155 #define GPIO_PORT_1 1
156 #define GPIO_PORT_0_PIN_NUMOF (32)
157 #define GPIO_PORT_1_PIN_NUMOF (SOC_GPIO_PIN_COUNT - 32)
158 #define GPIO_PORT_PIN_NUMOF(p) ((p == GPIO_PORT_0) ? GPIO_PORT_0_PIN_NUMOF \
159 : GPIO_PORT_1_PIN_NUMOF)
162 #define GPIO_PORT_NUMOF 1
163 #define GPIO_PORT_0 0
164 #define GPIO_PORT_0_PIN_NUMOF (SOC_GPIO_PIN_COUNT)
165 #define GPIO_PORT_PIN_NUMOF(p) ((p == GPIO_PORT_0) ? GPIO_PORT_0_PIN_NUMOF : 0)
169 #define HAVE_GPIO_PORT_T
172 #define HAVE_GPIO_SLEW_T
180 #define HAVE_GPIO_PULL_STRENGTH_T
188 #define HAVE_GPIO_PULL_T
199 #define HAVE_GPIO_DRIVE_STRENGTH_T
210 #define GPIO_DRIVE_5 GPIO_DRIVE_WEAKEST
211 #define GPIO_DRIVE_10 GPIO_DRIVE_WEAK
212 #define GPIO_DRIVE_20 GPIO_DRIVE_STRONG
213 #define GPIO_DRIVE_30 GPIO_DRIVE_STRONGEST
215 #define HAVE_GPIO_STATE_T
225 #define HAVE_GPIO_CONF_T
351 #define ADC_NUMOF_MAX (SOC_ADC_CHANNEL_NUM(0) + SOC_ADC_CHANNEL_NUM(1))
394 #if defined(SOC_DAC_SUPPORTED) || DOXYGEN
395 #define DAC_NUMOF_MAX (SOC_DAC_PERIPH_NUM)
453 #define HAVE_I2C_SPEED_T
479 #define I2C_NUMOF_MAX (SOC_I2C_NUM)
481 #define PERIPH_I2C_NEED_READ_REG
482 #define PERIPH_I2C_NEED_READ_REGS
483 #define PERIPH_I2C_NEED_WRITE_REG
484 #define PERIPH_I2C_NEED_WRITE_REGS
587 #define PWM_NUMOF_MAX (4)
592 #define PWM_CH_NUMOF_MAX (SOC_LEDC_CHANNEL_NUM)
626 #define RMT_CH_NUMOF_MAX (SOC_RMT_CHANNELS_PER_GROUP)
638 #define RNG_DATA_REG_ADDR (WDEV_RND_REG)
653 #define RTT_FREQUENCY (32768UL)
658 #define RTT_MAX_VALUE (0xFFFFFFFFUL)
687 #if IS_USED(SOC_SDMMC_USE_GPIO_MATRIX) || DOXYGEN
708 #if IS_USED(SOC_SDMMC_USE_GPIO_MATRIX) || DOXYGEN
715 #if IS_USED(MODULE_PERIPH_SMMC_8BIT) || DOXYGEN
729 #define SDMMC_CPU_DMA_REQUIREMENTS __attribute__((aligned(SDMMC_CPU_DMA_ALIGNMENT)))
734 #define SDMMC_CPU_DMA_ALIGNMENT 4
818 #define HAVE_SPI_CLK_T
832 #define spi_pin_mosi(dev) spi_config[dev].mosi
833 #define spi_pin_miso(dev) spi_config[dev].miso
834 #define spi_pin_clk(dev) spi_config[dev].sck
850 #if defined(CPU_FAM_ESP32)
851 #define HSPI SPI2_HOST
852 #define VSPI SPI3_HOST
853 #elif defined(CPU_FAM_ESP32S2)
854 #define FSPI SPI2_HOST
855 #define HSPI SPI3_HOST
857 #define FSPI SPI2_HOST
874 #define SPI_NUMOF_MAX (SOC_SPI_PERIPH_NUM - 1)
876 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE
877 #define PERIPH_SPI_NEEDS_TRANSFER_REG
878 #define PERIPH_SPI_NEEDS_TRANSFER_REGS
906 #ifndef MODULE_ESP_HW_COUNTER
913 #define TIMER_NUMOF (SOC_TIMER_GROUP_TOTAL_TIMERS - 1)
914 #define TIMER_CHANNEL_NUMOF (1)
918 #define TIMER_SYSTEM_GROUP TIMER_GROUP_0
920 #define TIMER_SYSTEM_INDEX TIMER_0
922 #define TIMER_SYSTEM_INT_SRC ETS_TG0_T0_LEVEL_INTR_SOURCE
929 #define PERIPH_TIMER_PROVIDES_SET
984 #define UART_NUMOF_MAX (SOC_UART_NUM)
999 #define USBDEV_NUMOF_MAX (SOC_USB_PERIPH_NUM)
1009 #if defined(CPU_FAM_ESP32)
1011 #elif defined(CPU_FAM_ESP32C3)
1013 #elif defined(CPU_FAM_ESP32S2)
1015 #elif defined(CPU_FAM_ESP32S3)
1018 #error "ESP32x family implementation missing"
1021 #ifdef MODULE_PERIPH_CAN
@ GPIO_OUT
select GPIO MASK as output
@ GPIO_IN
select GPIO MASK as input
sdmmc_slot_t
SDIO/SDMMC slots.
@ SDMMC_SLOT_1
SD/MMC host controller slot 1.
@ SDMMC_SLOT_0
SD/MMC host controller slot 0 (not usable on ESP32 variant)
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
gpio_mode_t
Available pin modes.
gpio_pull_t
Enumeration of pull resistor configurations.
gpio_pull_strength_t
Enumeration of pull resistor values.
gpio_state_t
Enumeration of GPIO states (direction)
gpio_slew_t
Enumeration of slew rate settings.
gpio_drive_strength_t
Enumeration of drive strength options.
typedef gpio_conf_t
GPIO pin configuration.
uintptr_t gpio_port_t
GPIO port type.
@ GPIO_FLOATING
No pull ups nor pull downs enabled.
@ GPIO_PULL_KEEP
Keep the signal at current logic level with pull up/down resistors.
@ GPIO_PULL_DOWN
Pull down resistor enabled.
@ GPIO_PULL_UP
Pull up resistor enabled.
@ GPIO_PULL_WEAKEST
Use the weakest (highest Ohm value) resistor.
@ GPIO_PULL_WEAK
Use a weak pull resistor.
@ GPIO_PULL_STRONG
Use a strong pull resistor.
@ GPIO_PULL_STRONGEST
Use the strongest pull resistor.
@ GPIO_OUTPUT_OPEN_SOURCE
Use pin as output in open emitter configuration.
@ GPIO_USED_BY_PERIPHERAL
The GPIO pin is used by a peripheral.
@ GPIO_OUTPUT_OPEN_DRAIN
Use pin as output in open collector configuration.
@ GPIO_OUTPUT_PUSH_PULL
Use pin as output in push-pull configuration.
@ GPIO_DISCONNECT
Disconnect pin from all peripherals.
@ GPIO_INPUT
Use pin as input.
@ GPIO_SLEW_SLOWEST
let the output voltage level rise/fall as slow as possible
@ GPIO_SLEW_FAST
let the output voltage level rise/fall fast
@ GPIO_SLEW_SLOW
let the output voltage level rise/fall slowly
@ GPIO_SLEW_FASTEST
let the output voltage level rise/fall as fast as possible
@ GPIO_DRIVE_STRONG
Use a strong drive strength.
@ GPIO_DRIVE_WEAK
Use a weak drive strength.
@ GPIO_DRIVE_STRONGEST
Use the strongest drive strength.
@ GPIO_DRIVE_WEAKEST
Use the weakest drive strength.
unsigned int gpio_t
GPIO type identifier.
@ GPIO_FALLING
emit interrupt on falling flank
@ GPIO_RISING
emit interrupt on rising flank
@ GPIO_BOTH
emit interrupt on both flanks
@ GPIO_OD
configure as output in open-drain mode without pull resistor
@ GPIO_IN_PU
configure as input with pull-up resistor
@ GPIO_OD_PU
configure as output in open-drain mode with pull resistor enabled
@ GPIO_IN_PD
configure as input with pull-down resistor
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
ESP32 specific peripheral configuration.
ESP32-C3 specific peripheral configuration.
ESP32-S2 specific peripheral configuration.
ESP32-S3 specific peripheral configuration.
RIOT-OS modification of the bootloader SDK configuration.
I2C configuration structure.
bool scl_pullup
Pullup enabled for SCL pin.
bool sda_pullup
Pullup enabled for SDA pin.
gpio_t sda
GPIO used as SDA pin.
gpio_t scl
GPIO used as SCL pin.
uint8_t module
I2C module identifier.
PWM configuration structure type.
ledc_mode_t group
LEDC channel group used (low/high speed)
ledc_timer_t timer
LEDC timer used by this device.
uint8_t module
LEDC module identifier.
uint8_t ch_numof
Number of channels used by this device.
const gpio_t * gpios
GPIOs used as channels of this device.
RMT channel configuration.
uint8_t channel
channel index
gpio_t gpio
GPIO used as RMT channel.
SDMMC slot configuration.
gpio_t wp
Write Protect pin (must be GPIO_UNDEF if not connected)
gpio_t dat1
DAT[1] pin (GPIO_UNDEF if not connected)
gpio_t dat3
DAT[3] pin (GPIO_UNDEF if not connected)
gpio_t clk
CLK pin (must be defined)
gpio_t dat0
DAT[0] pin (must be defined)
gpio_t dat4
DAT[4] pin (GPIO_UNDEF if not connected)
gpio_t cmd
CMD pin (must be defined)
gpio_t dat6
DAT[6] pin (GPIO_UNDEF if not connected)
gpio_t dat7
DAT[7] pin (GPIO_UNDEF if not connected)
gpio_t dat2
DAT[2] pin (GPIO_UNDEF if not connected)
gpio_t dat5
DAT[5] pin (GPIO_UNDEF if not connected)
sdmmc_slot_t slot
SDMMC slot used [ SDMMC_SLOT_0 | SDMMC_SLOT_1].
gpio_t cd
Card Detect pin (must be GPIO_UNDEF if not connected)
SPI device configuration.
gpio_t mosi
GPIO used as MOSI pin.
spi_ctrl_t ctrl
SPI controller used for the interface.
gpio_t cs
GPIO used as CS0 pin.
gpio_t miso
GPIO used as MISO pin.
gpio_t sck
GPIO used as SCK pin.
UART device configuration.
gpio_t txd
GPIO used as TxD pin.
gpio_t rxd
GPIO used as RxD pin.
GPIO pin configuration for ESP32/ESP32Cx/ESP32Sx MCUs.
bool initial_value
Initial value of the output.
gpio_state_t state
State of the pin.
gpio_drive_strength_t drive_strength
Drive strength of the GPIO.
gpio_pull_t pull
Pull resistor configuration.
Low level USB FS/HS driver definitions for MCUs with Synopsys DWC2 IP core.