1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-17 18:43:50 +01:00
RIOT/boards/common/esp32/include/board_common_esp32.h
2025-07-18 14:23:37 +02:00

63 lines
1.6 KiB
C

/*
* SPDX-FileCopyrightText: 2018 Gunar Schorcht
* SPDX-License-Identifier: LGPL-2.1-only
*/
#pragma once
/**
* @ingroup boards_common_esp32
* @brief Board definitions that are common for all ESP32 boards.
*
* This file contains board configurations that are valid for all ESP32.
*
* For detailed information about the configuration of ESP32 boards, see
* section \ref esp32_peripherals "Common Peripherals".
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
* @{
*/
/**
* @brief External clock crystal frequency (MHz)
*
* Most boards use a 40MHz crystal, including all those based on Espressif's
* WROOM-32 and WROVER-32 modules. Those that don't, like the SparkFun ESP32
* Thing (26MHz), must define ESP32_XTAL_FREQ appropriately in their board
* configuration.
*
* An obvious side effect of a mismatch is that the UART won't sync and the
* development terminal will show garbage instead of log output.
*/
#ifndef ESP32_XTAL_FREQ
#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
#ifdef __cplusplus
} /* end extern "C" */
#endif
/** @} */