1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/common: add module boards_common_esp32x

The commit moves the header files from `boards/common/esp32s3/include` that can be used for all types of ESP32x SoCs to a new common ESP32x board module.
This commit is contained in:
Gunar Schorcht 2023-03-29 01:51:20 +02:00
parent 198aadfc0a
commit cb1ebda475
10 changed files with 92 additions and 32 deletions

View File

@ -0,0 +1,20 @@
# Copyright (c) 2020 HAW Hamburg
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
config BOARD_COMMON_ESP32X
bool
select HAS_PERIPH_UART
select HAVE_SAUL_GPIO
config MODULE_BOARDS_COMMON_ESP32X
bool
depends on TEST_KCONFIG
depends on BOARD_COMMON_ESP32X
depends on HAS_ARCH_ESP32
default y
help
Common ESP32x boards code.

View File

@ -0,0 +1,3 @@
MODULE = boards_common_esp32x
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,5 @@
USEMODULE += boards_common_esp32x
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

View File

@ -0,0 +1,4 @@
CPU = esp32
# additional features provided by all boards is at least one UART
FEATURES_PROVIDED += periph_uart

View File

@ -0,0 +1,5 @@
INCLUDES += -I$(RIOTBOARD)/common/esp32x/include
# configure the serial interface
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*)))

View File

@ -7,14 +7,14 @@
*/
/**
* @ingroup boards_common_esp32s3
* @ingroup boards_common_esp32x
* @{
*
* @file
* @brief Common declarations and functions for all ESP32-S3 boards.
* @brief Common declarations and functions for all ESP32x boards.
*
* This file contains default declarations and functions that are valid
* for all ESP32-S3 boards.
* for all ESP32x boards.
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/

View File

@ -0,0 +1,16 @@
/*
* Copyright (C) 2018 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup boards_common_esp32x ESP32x Common
* @brief Definitions and configurations that are common for
* all ESP32 boards.
*
* For detailed information about the ESP32, configuring and compiling RIOT
* for ESP32 boards, please refer \ref esp32_riot.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Gunar Schorcht
* Copyright (C) 2023 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -7,11 +7,11 @@
*/
/**
* @ingroup boards_common_esp32s3
* @ingroup boards_common_esp32x
* @{
*
* @file
* @brief Common board definitions for the Arduino API
* @brief Definitions for the Arduino API that are common for all ESP32x boards
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Gunar Schorcht
* Copyright (C) 2018 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -7,13 +7,12 @@
*/
/**
* @ingroup boards_common_esp32s3
* @brief Common board definitions for ESP32-S3 boards.
* @ingroup boards_common
* @brief Board definitions that are common for all ESP32x boards.
*
* This file contains board configurations that are valid for all
* ESP32-S3 boards.
* This file contains board configurations that are valid for all ESP32.
*
* For detailed information about the configuration of ESP32-S3 boards, see
* For detailed information about the configuration of ESP32 boards, see
* section \ref esp32_peripherals "Common Peripherals".
*
* @author Gunar Schorcht <gunar@schorcht.net>

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Gunar Schorcht
* Copyright (C) 2023 Gunar Schorcht
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -7,13 +7,13 @@
*/
/**
* @ingroup boards_common_esp32s3
* @brief Common peripheral configurations for ESP32-S3 boards
* @ingroup boards_common_esp32x
* @brief Peripheral configurations that are common for all ESP32x boards
*
* This file contains the peripheral configurations that are valid for all
* ESP32-S3 boards.
* ESP32x boards.
*
* For detailed information about the peripheral configuration for ESP32-S3
* For detailed information about the peripheral configuration for ESP32x
* boards, see section \ref esp32_peripherals "Common Peripherals".
*
* @author Gunar Schorcht <gunar@schorcht.net>
@ -24,6 +24,18 @@
#ifndef PERIPH_CONF_COMMON_H
#define PERIPH_CONF_COMMON_H
#if defined(CPU_FAM_ESP32)
#include "periph_conf_common_esp32.h"
#elif defined(CPU_FAM_ESP32C3)
#include "periph_conf_common_esp32c3.h"
#elif defined(CPU_FAM_ESP32S2)
#include "periph_conf_common_esp32s2.h"
#elif defined(CPU_FAM_ESP32S3)
#include "periph_conf_common_esp32s3.h"
#else
#error "ESP32x SoC family not supported"
#endif
/* include periph_cpu.h to make it visible in any case */
#include "periph_cpu.h"
#include "kernel_defines.h"
@ -105,16 +117,18 @@ static const gpio_t dac_channels[] = DAC_GPIOS;
/** Define SCL pullup enabled by default */
#define I2C0_SCL_PULLUP true
#endif
#if defined(I2C0_SDA) && !defined(I2C0_SDA_PULLUP)
/** Define SDA pullup enabled by default */
#define I2C0_SDA_PULLUP true
#endif
#if defined(I2C1_SCL) && !defined(I2C1_SCL_PULLUP)
#if (SOC_I2C_NUM > 1) && defined(I2C1_SCL) && !defined(I2C1_SCL_PULLUP)
/** Define SCL pullup enabled by default */
#define I2C1_SCL_PULLUP true
#endif
#if defined(I2C1_SDA) && !defined(I2C1_SDA_PULLUP)
#if (SOC_I2C_NUM > 1) && defined(I2C1_SDA) && !defined(I2C1_SDA_PULLUP)
/** Define SDA pullup enabled by default */
#define I2C1_SDA_PULLUP true
#endif
@ -133,7 +147,7 @@ static const i2c_conf_t i2c_config[] = {
.sda_pullup = I2C0_SCL_PULLUP,
},
#endif
#if defined(I2C1_SCL) && defined(I2C1_SDA) && defined(I2C1_SPEED)
#if (SOC_I2C_NUM > 1) && defined(I2C1_SCL) && defined(I2C1_SDA) && defined(I2C1_SPEED)
{
.module = PERIPH_I2C1_MODULE,
.speed = I2C1_SPEED,
@ -295,7 +309,7 @@ static const rmt_channel_config_t rmt_channel_config[] = {
* @brief Static array with configuration for declared SPI devices
*/
static const spi_conf_t spi_config[] = {
#ifdef SPI0_CTRL
#if defined(SPI0_CTRL)
{
.ctrl = SPI0_CTRL,
.sck = SPI0_SCK,
@ -304,7 +318,7 @@ static const spi_conf_t spi_config[] = {
.cs = SPI0_CS0,
},
#endif
#ifdef SPI1_CTRL
#if defined(SPI1_CTRL) && (SOC_SPI_PERIPH_NUM > 2)
{
.ctrl = SPI1_CTRL,
.sck = SPI1_SCK,
@ -331,13 +345,6 @@ static const spi_conf_t spi_config[] = {
* @{
*/
#ifndef UART0_TXD
#define UART0_TXD (GPIO43) /**< TxD of UART_DEV(0) used on all ESP32-S3 boards */
#endif
#ifndef UART0_RXD
#define UART0_RXD (GPIO44) /**< RxD of UART_DEV(0) used on all ESP32-S3 boards */
#endif
/**
* @brief Static array with configuration for declared UART devices
*/
@ -346,13 +353,13 @@ static const uart_conf_t uart_config[] = {
.txd = UART0_TXD,
.rxd = UART0_RXD,
},
#if defined(UART1_TXD) && defined(UART1_RXD)
#if (SOC_UART_NUM > 1) && defined(UART1_TXD) && defined(UART1_RXD)
{
.txd = UART1_TXD,
.rxd = UART1_RXD,
},
#endif
#if defined(UART2_TXD) && defined(UART2_RXD)
#if (SOC_UART_NUM > 2) && defined(UART2_TXD) && defined(UART2_RXD)
{
.txd = UART2_TXD,
.rxd = UART2_RXD,
@ -371,9 +378,9 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_config)
/** @} */
#ifdef SOC_USB_OTG_SUPPORTED
/**
* @name USB device configuration
*
* @{
*/
@ -396,6 +403,7 @@ static const dwc2_usb_otg_fshs_config_t dwc2_usb_otg_fshs_config[] = {
#define USBDEV_NUMOF ARRAY_SIZE(dwc2_usb_otg_fshs_config)
/** @} */
#endif /* SOC_USB_OTG_SUPPORTED */
#ifdef __cplusplus
} /* end extern "C" */