2018-10-08 12:20:49 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
2021-10-05 16:06:58 +02:00
|
|
|
* section \ref esp32_peripherals "Common Peripherals".
|
2018-10-08 12:20:49 +02:00
|
|
|
*
|
|
|
|
* @author Gunar Schorcht <gunar@schorcht.net>
|
|
|
|
* @file
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BOARD_COMMON_H
|
|
|
|
#define BOARD_COMMON_H
|
|
|
|
|
2018-11-10 14:14:49 +01:00
|
|
|
/* not required when compiling ESP32 vendor code parts */
|
|
|
|
#ifndef ESP32_IDF_CODE
|
|
|
|
|
2018-10-08 12:20:49 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "cpu.h"
|
|
|
|
#include "periph_conf.h"
|
2020-07-10 13:53:46 +02:00
|
|
|
#if MODULE_ARDUINO
|
2018-10-11 09:33:43 +02:00
|
|
|
#include "arduino_pinmap.h"
|
2020-07-10 13:53:46 +02:00
|
|
|
#endif
|
2018-10-08 12:20:49 +02:00
|
|
|
|
|
|
|
#include "periph/gpio.h"
|
2022-02-01 21:38:59 +01:00
|
|
|
#include "sdkconfig.h"
|
2018-10-08 12:20:49 +02:00
|
|
|
|
2020-01-16 13:03:49 +01:00
|
|
|
#if MODULE_MTD
|
|
|
|
#include "mtd.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-08 12:20:49 +02:00
|
|
|
#ifdef __cplusplus
|
2020-01-16 13:03:49 +01:00
|
|
|
extern "C" {
|
2018-10-08 12:20:49 +02:00
|
|
|
#endif
|
|
|
|
|
2018-10-26 21:17:42 +02:00
|
|
|
/**
|
|
|
|
* @name 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
|
|
|
|
/** @} */
|
|
|
|
|
2018-10-08 12:20:49 +02:00
|
|
|
/**
|
|
|
|
* @name LED configuration (three predefined LEDs at maximum)
|
|
|
|
*
|
|
|
|
* @note LEDx_ACTIVE value must be declared in board configuration.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#if defined(LED0_PIN) || DOXYGEN
|
|
|
|
#define LED0_MASK (BIT(LED0_PIN))
|
|
|
|
#define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE))
|
|
|
|
#define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE))
|
|
|
|
#define LED0_TOGGLE (gpio_toggle(LED0_PIN))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(LED1_PIN) || DOXYGEN
|
|
|
|
#define LED1_MASK (BIT(LED1_PIN))
|
|
|
|
#define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE))
|
|
|
|
#define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE))
|
|
|
|
#define LED1_TOGGLE (gpio_toggle(LED1_PIN))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(LED2_PIN) || DOXYGEN
|
|
|
|
#define LED2_MASK (BIT(LED2_PIN))
|
|
|
|
#define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE))
|
|
|
|
#define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE))
|
|
|
|
#define LED2_TOGGLE (gpio_toggle(LED2_PIN))
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name STDIO configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
/**< Default baudrate of UART for stdio */
|
|
|
|
#ifndef STDIO_UART_BAUDRATE
|
|
|
|
#define STDIO_UART_BAUDRATE (115200)
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#if MODULE_MTD || DOXYGEN
|
|
|
|
/**
|
|
|
|
* @name MTD system drive configuration
|
|
|
|
*
|
|
|
|
* Built-in SPI flash memory is used as MTD system drive.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief MTD drive start address in SPI flash memory
|
|
|
|
*
|
2019-10-23 21:13:10 +02:00
|
|
|
* Defines the start address of the MTD system device in the SPI
|
2021-10-05 16:06:58 +02:00
|
|
|
* flash memory. It can be overridden by \ref esp32_application_specific_configurations
|
2018-10-08 12:20:49 +02:00
|
|
|
* "application-specific board configuration"
|
|
|
|
*
|
|
|
|
* If the MTD start address is not defined or is 0, the first possible
|
|
|
|
* multiple of 0x100000 (1 MByte) is used in free SPI flash memory,
|
|
|
|
* which was determined from the partition table.
|
|
|
|
*/
|
|
|
|
#ifndef SPI_FLASH_DRIVE_START
|
|
|
|
#define SPI_FLASH_DRIVE_START 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Default MTD drive definition */
|
|
|
|
#define MTD_0 mtd0
|
|
|
|
|
|
|
|
/** Pointer to the default MTD drive structure */
|
|
|
|
extern mtd_dev_t *mtd0;
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
#endif /* MODULE_MTD || DOXYGEN */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Print the board configuration in a human readable format
|
|
|
|
*/
|
2019-12-18 13:10:34 +01:00
|
|
|
void print_board_config(void);
|
2018-10-08 12:20:49 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* end extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2019-12-18 13:10:34 +01:00
|
|
|
#else /* ESP32_IDF_CODE */
|
|
|
|
|
|
|
|
#ifndef DOXYGEN
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* DOXYGEN */
|
2018-11-10 14:14:49 +01:00
|
|
|
#endif /* ESP32_IDF_CODE */
|
2018-10-08 12:20:49 +02:00
|
|
|
#endif /* BOARD_COMMON_H */
|
|
|
|
/** @} */
|