26 #if defined(CPU_FAM_ESP32)
28 #elif defined(CPU_FAM_ESP32C3)
30 #elif defined(CPU_FAM_ESP32S2)
32 #elif defined(CPU_FAM_ESP32S3)
35 #error "ESP32x SoC family not supported"
39 #include "periph_cpu.h"
75 #define ADC_NUMOF ARRAY_SIZE(adc_channels)
107 #define DAC_NUMOF ARRAY_SIZE(dac_channels)
115 #if defined(I2C0_SCL) && !defined(I2C0_SCL_PULLUP)
117 #define I2C0_SCL_PULLUP true
120 #if defined(I2C0_SDA) && !defined(I2C0_SDA_PULLUP)
122 #define I2C0_SDA_PULLUP true
125 #if (SOC_I2C_NUM > 1) && defined(I2C1_SCL) && !defined(I2C1_SCL_PULLUP)
127 #define I2C1_SCL_PULLUP true
130 #if (SOC_I2C_NUM > 1) && defined(I2C1_SDA) && !defined(I2C1_SDA_PULLUP)
132 #define I2C1_SDA_PULLUP true
139 #if defined(I2C0_SCL) && defined(I2C0_SDA) && defined(I2C0_SPEED)
141 .
module = PERIPH_I2C0_MODULE,
145 .scl_pullup = I2C0_SCL_PULLUP,
146 .sda_pullup = I2C0_SCL_PULLUP,
149 #if (SOC_I2C_NUM > 1) && defined(I2C1_SCL) && defined(I2C1_SDA) && defined(I2C1_SPEED)
151 .module = PERIPH_I2C1_MODULE,
155 .scl_pullup = I2C1_SCL_PULLUP,
156 .sda_pullup = I2C1_SCL_PULLUP,
169 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
182 static const gpio_t pwm0_gpios[] = PWM0_GPIOS;
189 static const gpio_t pwm1_gpios[] =
PWM1_GPIOS;
196 static const gpio_t pwm2_gpios[] = PWM2_GPIOS;
203 static const gpio_t pwm3_gpios[] = PWM3_GPIOS;
213 .
module = PERIPH_LEDC_MODULE,
214 .group = LEDC_LOW_SPEED_MODE,
215 .timer = LEDC_TIMER_0,
222 .module = PERIPH_LEDC_MODULE,
223 #ifdef SOC_LEDC_SUPPORT_HS_MODE
224 .group = LEDC_HIGH_SPEED_MODE,
226 .group = LEDC_LOW_SPEED_MODE,
228 .timer = LEDC_TIMER_1,
235 .module = PERIPH_LEDC_MODULE,
236 .group = LEDC_LOW_SPEED_MODE,
237 .timer = LEDC_TIMER_2,
244 .module = PERIPH_LEDC_MODULE,
245 #ifdef SOC_LEDC_SUPPORT_HS_MODE
246 .group = LEDC_HIGH_SPEED_MODE,
248 .group = LEDC_LOW_SPEED_MODE,
250 .timer = LEDC_TIMER_3,
264 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
284 #ifndef HAVE_RMT_CHANNEL_CONFIG
286 #ifdef WS281X_PARAM_PIN
298 #define RMT_CH_NUMOF ARRAY_SIZE(rmt_channel_config)
311 #if defined(SPI0_CTRL)
320 #if defined(SPI1_CTRL) && (SOC_SPI_PERIPH_NUM > 2)
339 #define SPI_NUMOF ARRAY_SIZE(spi_config)
341 #if IS_USED(MODULE_PERIPH_SPI)
359 #if (SOC_UART_NUM > 1) && defined(UART1_TXD) && defined(UART1_RXD)
365 #if (SOC_UART_NUM > 2) && defined(UART2_TXD) && defined(UART2_RXD)
381 #define UART_NUMOF ARRAY_SIZE(uart_config)
384 #ifdef SOC_USB_OTG_SUPPORTED
390 #include "usbdev_esp32.h"
397 .
periph = USB_OTG_FS_PERIPH_BASE,
406 #define USBDEV_NUMOF ARRAY_SIZE(dwc2_usb_otg_fshs_config)
#define WS281X_PARAM_PIN
GPIO pin connected to the data pin of the first LED.
#define static_assert(cond,...)
static_assert for c-version < c11
#define I2C0_SPEED
I2C bus speed of I2C_DEV(0)
#define I2C0_SCL
SCL signal of I2C_DEV(0)
#define I2C0_SDA
SDA signal of I2C_DEV(0)
#define PWM1_GPIOS
PWM_DEV(1) is not used.
#define SPI1_MOSI
HSPI MOSI.
#define SPI1_SCK
HSPI SCK.
#define SPI1_MISO
HSPI MISO.
#define SPI1_CS0
HSPI CS0.
#define SPI1_CTRL
HSPI is used as SPI_DEV(1)
#define ARRAY_SIZE(a)
Calculate the number of elements in a static array.
static const uart_conf_t uart_config[]
Static array with configuration for declared UART devices.
#define DAC_GPIOS
Declaration of GPIOs that can be used as DAC channels.
static const pwm_config_t pwm_config[]
GPIOs used as channels for the according PWM device.
static const gpio_t dac_channels[]
Static array with declared DAC channels.
static const spi_conf_t spi_config[]
Static array with configuration for declared SPI devices.
static const rmt_channel_config_t rmt_channel_config[]
RMT channel configuration.
static const gpio_t adc_channels[]
Static array with declared ADC channels.
static const i2c_conf_t i2c_config[]
Static array with configuration for declared I2C devices.
#define SPI_NUMOF
Number of SPI interfaces.
#define ADC_GPIOS
Declaration of GPIOs that can be used as ADC channels.
#define SPI0_MOSI
HSPI / SPI_DEV(0) MOSI pin.
#define SPI0_CTRL
HSPI / SPI_DEV(0) controller.
#define SPI0_CS0
HSPI / SPI_DEV(0) CS default pin, only used when cs parameter in spi_acquire is GPIO_UNDEF.
#define SPI0_SCK
HSPI / SPI_DEV(0) SCK pin.
#define SPI0_MISO
HSPI / SPI_DEV(0) MISO pin.
static const dwc2_usb_otg_fshs_config_t dwc2_usb_otg_fshs_config[]
Common USB OTG FS configuration.
Common macros and compiler attributes/pragmas configuration.
Common declarations of ESP32 periphery for all ESP32 boards.
Common peripheral configurations for ESP32-C3 boards.
Common peripheral configurations for ESP32-S2 boards.
Common peripheral configurations for ESP32-S3 boards.
uintptr_t periph
USB peripheral base address.
I2C configuration structure.
uint8_t module
I2C module identifier.
PWM configuration structure type.
uint8_t module
LEDC module identifier.
RMT channel configuration.
SPI device configuration.
spi_ctrl_t ctrl
SPI controller used for the interface.
UART device configuration.
gpio_t txd
GPIO used as TxD pin.
@ DWC2_USB_OTG_PHY_BUILTIN
on-chip FS PHY
@ DWC2_USB_OTG_FS
Full speed peripheral.