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 #ifndef BOARD_COMMON_H
10 #define BOARD_COMMON_H
11 
20 /* not required when compiling ESP vendor code parts */
21 #ifndef ESP_PLATFORM
22 
23 #include <stdint.h>
24 
25 #include "cpu.h"
26 #include "periph_conf.h"
27 #include "periph_conf_common.h"
28 #include "periph/gpio.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
38 #ifdef LED0_PIN
39 #define LED0_MASK (BIT(LED0_PIN))
40 #define LED0_TOGGLE (gpio_toggle(LED0_PIN))
41 #define LED0_ON (gpio_write(LED0_PIN, LED0_ACTIVE))
42 #define LED0_OFF (gpio_write(LED0_PIN, !LED0_ACTIVE))
43 #endif
44 
45 #ifdef LED1_PIN
46 #define LED1_MASK (BIT(LED1_PIN))
47 #define LED1_TOGGLE (gpio_toggle(LED1_PIN))
48 #define LED1_ON (gpio_write(LED1_PIN, LED1_ACTIVE))
49 #define LED1_OFF (gpio_write(LED1_PIN, !LED1_ACTIVE))
50 #endif
51 
52 #ifdef LED2_PIN
53 #define LED2_MASK (BIT(LED2_PIN))
54 #define LED2_TOGGLE (gpio_toggle(LED2_PIN))
55 #define LED2_ON (gpio_write(LED2_PIN, LED2_ACTIVE))
56 #define LED2_OFF (gpio_write(LED2_PIN, !LED2_ACTIVE))
57 #endif
58 
65 #ifndef STDIO_UART_BAUDRATE
66 #define STDIO_UART_BAUDRATE (115200)
67 #endif
68 
71 #ifndef DOXYGEN
72 
76 #if defined(MODULE_ESP_SW_TIMER)
77 #define XTIMER_BACKOFF (100U)
78 #define XTIMER_ISR_BACKOFF (100U)
79 #endif /* MODULE_ESP_SW_TIMER */
80 
82 #endif /* DOXYGEN */
83 
84 
85 #if defined(MODULE_MTD) || defined(DOXYGEN)
86 
93 #include "mtd.h"
94 
96 #define MTD_0 mtd0
97 
99 extern mtd_dev_t *mtd0;
100 
102 #endif /* defined(MODULE_MTD) || defined(DOXYGEN) */
103 
104 
105 #if defined(MODULE_SPIFFS) || defined(DOXYGEN)
106 
112 #define SPIFFS_ALIGNED_OBJECT_INDEX_TABLES 1
113 #define SPIFFS_READ_ONLY 0
114 #define SPIFFS_SINGLETON 0
115 #define SPIFFS_HAL_CALLBACK_EXTRA 1
116 #define SPIFFS_CACHE 1
117 
118 #endif /* defined(MODULE_SPIFFS) || defined(DOXYGEN) */
119 
120 
128 void board_init (void);
129 
133 void board_print_config (void);
134 
135 #ifdef __cplusplus
136 } /* end extern "C" */
137 #endif
138 
139 /* include definitions for optional off-board hardware modules */
140 #include "board_modules.h"
141 
144 #endif /* ESP_PLATFORM */
145 #endif /* BOARD_COMMON_H */
mtd_dev_t
MTD device descriptor.
Definition: mtd.h:58
board_init
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.
periph_conf_common.h
Configurations of the MCU periphery that are common for all ESP8266 boards.
mtd0
mtd_dev_t * mtd0
Pointer to the default MTD drive structure.
board_modules.h
Definitions for optional off-board hardware modules that can be used with all ESP8266 boards.
gpio.h
Low-level GPIO peripheral driver interface definitions.
board_print_config
void board_print_config(void)
Print the board configuration in a human readable format.