board_common.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Gunar Schorcht
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
22 #include <stdint.h>
23 
24 #include "cpu.h"
25 #include "periph_conf.h"
26 #if MODULE_ARDUINO
27 #include "arduino_pinmap.h"
28 #endif
29 
30 #include "periph/gpio.h"
31 
32 #include "sdkconfig.h"
33 
34 #if defined(CPU_FAM_ESP32)
35 # include "board_common_esp32.h"
36 #elif defined(CPU_FAM_ESP32C3)
37 # include "board_common_esp32c3.h"
38 #elif defined(CPU_FAM_ESP32H2)
39 # include "board_common_esp32h2.h"
40 #elif defined(CPU_FAM_ESP32S2)
41 # include "board_common_esp32s2.h"
42 #elif defined(CPU_FAM_ESP32S3)
43 # include "board_common_esp32s3.h"
44 #else
45 # error "ESP32x SoC family not supported"
46 #endif
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
58 #if defined(LED0_PIN) || DOXYGEN
59 #define LED0_MASK (BIT(LED0_PIN))
60 #define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE))
61 #define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE))
62 #define LED0_TOGGLE (gpio_toggle(LED0_PIN))
63 #endif
64 
65 #if defined(LED1_PIN) || DOXYGEN
66 #define LED1_MASK (BIT(LED1_PIN))
67 #define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE))
68 #define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE))
69 #define LED1_TOGGLE (gpio_toggle(LED1_PIN))
70 #endif
71 
72 #if defined(LED2_PIN) || DOXYGEN
73 #define LED2_MASK (BIT(LED2_PIN))
74 #define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE))
75 #define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE))
76 #define LED2_TOGGLE (gpio_toggle(LED2_PIN))
77 #endif
85 #ifndef STDIO_UART_BAUDRATE
86 #define STDIO_UART_BAUDRATE (115200)
87 #endif
90 #if MODULE_MTD || DOXYGEN
109 #ifndef SPI_FLASH_DRIVE_START
110 #define SPI_FLASH_DRIVE_START 0
111 #endif
112 
113 #define MTD_0 mtd_dev_get(0)
115 #if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN
116 #define MTD_1 mtd_dev_get(1)
117 #elif MODULE_MTD_SDMMC_DEFAULT
118 #define MTD_1 mtd_dev_get(1)
119 #endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */
120 
127 #ifndef CONFIG_SDCARD_GENERIC_MTD_OFFSET
128 #define CONFIG_SDCARD_GENERIC_MTD_OFFSET 1
129 #endif
130 
137 #ifndef CONFIG_SDMMC_GENERIC_MTD_OFFSET
138 #define CONFIG_SDMMC_GENERIC_MTD_OFFSET 1
139 #endif
140 
142 #endif /* MODULE_MTD || DOXYGEN */
143 
148 
149 #ifdef __cplusplus
150 } /* end extern "C" */
151 #endif
152 
Compatibility wrapper for arduino_iomap.h.
Board definitions that are common for all ESP32 boards.
Board definitions that are common for all ESP32-C3 boards.
Board definitions that are common for all ESP32-H2 boards.
Board definitions that are common for all ESP32-S2 boards.
Board definitions that are common for all ESP32-S3 boards.
void print_board_config(void)
Print the board configuration in a human readable format.
Low-level GPIO peripheral driver interface definitions.