board_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
25 #include <stdint.h>
26 
27 #include "cpu.h"
28 #include "periph_conf.h"
29 #if MODULE_ARDUINO
30 #include "arduino_pinmap.h"
31 #endif
32 
33 #include "periph/gpio.h"
34 
35 #include "sdkconfig.h"
36 
37 #if defined(CPU_FAM_ESP32)
38 # include "board_common_esp32.h"
39 #elif defined(CPU_FAM_ESP32C3)
40 # include "board_common_esp32c3.h"
41 #elif defined(CPU_FAM_ESP32S2)
42 # include "board_common_esp32s2.h"
43 #elif defined(CPU_FAM_ESP32S3)
44 # include "board_common_esp32s3.h"
45 #else
46 # error "ESP32x SoC family not supported"
47 #endif
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
59 #if defined(LED0_PIN) || DOXYGEN
60 #define LED0_MASK (BIT(LED0_PIN))
61 #define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE))
62 #define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE))
63 #define LED0_TOGGLE (gpio_toggle(LED0_PIN))
64 #endif
65 
66 #if defined(LED1_PIN) || DOXYGEN
67 #define LED1_MASK (BIT(LED1_PIN))
68 #define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE))
69 #define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE))
70 #define LED1_TOGGLE (gpio_toggle(LED1_PIN))
71 #endif
72 
73 #if defined(LED2_PIN) || DOXYGEN
74 #define LED2_MASK (BIT(LED2_PIN))
75 #define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE))
76 #define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE))
77 #define LED2_TOGGLE (gpio_toggle(LED2_PIN))
78 #endif
86 #ifndef STDIO_UART_BAUDRATE
87 #define STDIO_UART_BAUDRATE (115200)
88 #endif
91 #if MODULE_MTD || DOXYGEN
110 #ifndef SPI_FLASH_DRIVE_START
111 #define SPI_FLASH_DRIVE_START 0
112 #endif
113 
114 #define MTD_0 mtd_dev_get(0)
116 #if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN
117 #define MTD_1 mtd_dev_get(1)
118 #elif MODULE_MTD_SDMMC_DEFAULT
119 #define MTD_1 mtd_dev_get(1)
120 #endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */
121 
128 #ifndef CONFIG_SDCARD_GENERIC_MTD_OFFSET
129 #define CONFIG_SDCARD_GENERIC_MTD_OFFSET 1
130 #endif
131 
138 #ifndef CONFIG_SDMMC_GENERIC_MTD_OFFSET
139 #define CONFIG_SDMMC_GENERIC_MTD_OFFSET 1
140 #endif
141 
143 #endif /* MODULE_MTD || DOXYGEN */
144 
149 
150 #ifdef __cplusplus
151 } /* end extern "C" */
152 #endif
153 
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-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.