1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

boards: common board definitions for ESP32-S2, ESP32-S2, ESP32-C3

Adds `board_common_esp32*.h` files in which definitions can be made that are common for all boards with a certain ESP32x SoC variant.
This commit is contained in:
Gunar Schorcht 2025-03-02 11:10:00 +01:00
parent 231008116b
commit 97711940c5
5 changed files with 175 additions and 2 deletions

View File

@ -22,8 +22,6 @@
* @{
*/
#include "board_common.h"
/**
* @brief External clock crystal frequency (MHz)
*
@ -39,6 +37,23 @@
#define ESP32_XTAL_FREQ (40)
#endif
#if !DOXYGEN
/**
* @name ztimer Configuration valid for all ESP32 boards
* @{
*/
#if CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ <= 80
# define CONFIG_ZTIMER_USEC_ADJUST_SET (880/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP ((CONFIG_ZTIMER_USEC_ADJUST_SET >> 2) * 5)
#else
# define CONFIG_ZTIMER_USEC_ADJUST_SET (960/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP (CONFIG_ZTIMER_USEC_ADJUST_SET + 1)
#endif
/** @} */
#endif /* !DOXYGEN */
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_common_esp32c3
* @brief Board definitions that are common for all ESP32-C3 boards.
*
* This file contains board configurations that are valid for all ESP32-C3.
*
* For detailed information about the configuration of ESP32-C3 boards, see
* section \ref esp32_peripherals "Common Peripherals".
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#if !DOXYGEN
/**
* @name ztimer Configuration valid for all ESP32-C3 boards
* @{
*/
#define CONFIG_ZTIMER_USEC_ADJUST_SET (640/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
#define CONFIG_ZTIMER_USEC_ADJUST_SLEEP (CONFIG_ZTIMER_USEC_ADJUST_SET)
/** @} */
#endif /* !DOXYGEN */
#ifdef __cplusplus
} /* end extern "C" */
#endif
/** @} */

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_common_esp32s2
* @brief Board definitions that are common for all ESP32-S2 boards.
*
* This file contains board configurations that are valid for all ESP32-S2.
*
* For detailed information about the configuration of ESP32-S2 boards, see
* section \ref esp32_peripherals "Common Peripherals".
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#if !DOXYGEN
/**
* @name ztimer Configuration valid for all ESP32-S2 boards
* @{
*/
#if CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ <= 80
# define CONFIG_ZTIMER_USEC_ADJUST_SET (880/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP ((CONFIG_ZTIMER_USEC_ADJUST_SET >> 2) * 5)
#else
# define CONFIG_ZTIMER_USEC_ADJUST_SET (960/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP (CONFIG_ZTIMER_USEC_ADJUST_SET + 1)
#endif
/** @} */
#endif /* !DOXYGEN */
#ifdef __cplusplus
} /* end extern "C" */
#endif
/** @} */

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_common_esp32s3
* @brief Board definitions that are common for all ESP32-S3 boards.
*
* This file contains board configurations that are valid for all ESP32-S3.
*
* For detailed information about the configuration of ESP32-S3 boards, see
* section \ref esp32_peripherals "Common Peripherals".
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#if !DOXYGEN
/**
* @name ztimer Configuration valid for all ESP32-S3 boards
* @{
*/
#if CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ <= 80
# define CONFIG_ZTIMER_USEC_ADJUST_SET (880/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP ((CONFIG_ZTIMER_USEC_ADJUST_SET >> 2) * 5)
#else
# define CONFIG_ZTIMER_USEC_ADJUST_SET (960/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ)
# define CONFIG_ZTIMER_USEC_ADJUST_SLEEP (CONFIG_ZTIMER_USEC_ADJUST_SET)
#endif
/** @} */
#endif /* !DOXYGEN */
#ifdef __cplusplus
} /* end extern "C" */
#endif
/** @} */

View File

@ -31,8 +31,21 @@
#endif
#include "periph/gpio.h"
#include "sdkconfig.h"
#if defined(CPU_FAM_ESP32)
# include "board_common_esp32.h"
#elif defined(CPU_FAM_ESP32C3)
# include "board_common_esp32c3.h"
#elif defined(CPU_FAM_ESP32S2)
# include "board_common_esp32s2.h"
#elif defined(CPU_FAM_ESP32S3)
# include "board_common_esp32s3.h"
#else
# error "ESP32x SoC family not supported"
#endif
#ifdef __cplusplus
extern "C" {
#endif