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 
23 #ifndef BOARD_COMMON_H
24 #define BOARD_COMMON_H
25 
26 /* not required when compiling ESP32 vendor code parts */
27 #ifndef ESP32_IDF_CODE
28 
29 #include <stdint.h>
30 
31 #include "cpu.h"
32 #include "periph_conf.h"
33 #include "arduino_pinmap.h"
34 
35 #include "periph/gpio.h"
36 #include "sdk_conf.h"
37 
38 #if MODULE_MTD
39 #include "mtd.h"
40 #endif
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
58 #ifndef ESP32_XTAL_FREQ
59 #define ESP32_XTAL_FREQ (40)
60 #endif
61 
69 #if defined(LED0_PIN) || DOXYGEN
70 #define LED0_MASK (BIT(LED0_PIN))
71 #define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE))
72 #define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE))
73 #define LED0_TOGGLE (gpio_toggle(LED0_PIN))
74 #endif
75 
76 #if defined(LED1_PIN) || DOXYGEN
77 #define LED1_MASK (BIT(LED1_PIN))
78 #define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE))
79 #define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE))
80 #define LED1_TOGGLE (gpio_toggle(LED1_PIN))
81 #endif
82 
83 #if defined(LED2_PIN) || DOXYGEN
84 #define LED2_MASK (BIT(LED2_PIN))
85 #define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE))
86 #define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE))
87 #define LED2_TOGGLE (gpio_toggle(LED2_PIN))
88 #endif
89 
97 #ifndef STDIO_UART_BAUDRATE
98 #define STDIO_UART_BAUDRATE (115200)
99 #endif
100 
103 #if MODULE_MTD || DOXYGEN
104 
122 #ifndef SPI_FLASH_DRIVE_START
123 #define SPI_FLASH_DRIVE_START 0
124 #endif
125 
127 #define MTD_0 mtd0
128 
130 extern mtd_dev_t *mtd0;
131 
133 #endif /* MODULE_MTD || DOXYGEN */
134 
135 
136 #if MODULE_SPIFFS || DOXYGEN
137 
143 #define SPIFFS_ALIGNED_OBJECT_INDEX_TABLES 1
144 #define SPIFFS_READ_ONLY 0
145 #define SPIFFS_SINGLETON 0
146 #define SPIFFS_HAL_CALLBACK_EXTRA 1
147 #define SPIFFS_CACHE 1
148 
149 #endif /* MODULE_SPIFFS || DOXYGEN */
150 
151 
157 void board_init_common(void);
158 
162 void print_board_config(void);
163 
164 #ifdef __cplusplus
165 } /* end extern "C" */
166 #endif
167 
168 #else /* ESP32_IDF_CODE */
169 
170 #ifndef DOXYGEN
171 
172 #ifdef __cplusplus
173 extern "C"
174 #endif
175 
176 /* declaration of `board_init_common` is required when compiling vendor code */
177 extern void board_init_common(void);
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* DOXYGEN */
184 #endif /* ESP32_IDF_CODE */
185 #endif /* BOARD_COMMON_H */
186 
mtd_dev_t
MTD device descriptor.
Definition: mtd.h:58
mtd0
mtd_dev_t * mtd0
Pointer to the default MTD drive structure.
gpio.h
Low-level GPIO peripheral driver interface definitions.
print_board_config
void print_board_config(void)
Print the board configuration in a human readable format.
board_init_common
void board_init_common(void)
Initialize the hardware that is common for all ESP32 boards.