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_ESP32C6)
39 # include "board_common_esp32c6.h"
40 #elif defined(CPU_FAM_ESP32H2)
41 # include "board_common_esp32h2.h"
42 #elif defined(CPU_FAM_ESP32S2)
43 # include "board_common_esp32s2.h"
44 #elif defined(CPU_FAM_ESP32S3)
45 # include "board_common_esp32s3.h"
46 #else
47 # error "ESP32x SoC family not supported"
48 #endif
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
60 #if defined(LED0_PIN) || DOXYGEN
61 #define LED0_MASK (BIT(LED0_PIN))
62 #define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE))
63 #define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE))
64 #define LED0_TOGGLE (gpio_toggle(LED0_PIN))
65 #endif
66 
67 #if defined(LED1_PIN) || DOXYGEN
68 #define LED1_MASK (BIT(LED1_PIN))
69 #define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE))
70 #define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE))
71 #define LED1_TOGGLE (gpio_toggle(LED1_PIN))
72 #endif
73 
74 #if defined(LED2_PIN) || DOXYGEN
75 #define LED2_MASK (BIT(LED2_PIN))
76 #define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE))
77 #define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE))
78 #define LED2_TOGGLE (gpio_toggle(LED2_PIN))
79 #endif
87 #ifndef STDIO_UART_BAUDRATE
88 #define STDIO_UART_BAUDRATE (115200)
89 #endif
92 #if MODULE_MTD || DOXYGEN
111 #ifndef SPI_FLASH_DRIVE_START
112 #define SPI_FLASH_DRIVE_START 0
113 #endif
114 
115 #define MTD_0 mtd_dev_get(0)
117 #if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN
118 #define MTD_1 mtd_dev_get(1)
119 #elif MODULE_MTD_SDMMC_DEFAULT
120 #define MTD_1 mtd_dev_get(1)
121 #endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */
122 
129 #ifndef CONFIG_SDCARD_GENERIC_MTD_OFFSET
130 #define CONFIG_SDCARD_GENERIC_MTD_OFFSET 1
131 #endif
132 
139 #ifndef CONFIG_SDMMC_GENERIC_MTD_OFFSET
140 #define CONFIG_SDMMC_GENERIC_MTD_OFFSET 1
141 #endif
142 
144 #endif /* MODULE_MTD || DOXYGEN */
145 
150 
151 #ifdef __cplusplus
152 } /* end extern "C" */
153 #endif
154 
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-C6 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.