Loading...
Searching...
No Matches
periph_conf_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
18#ifndef PERIPH_CONF_COMMON_H
19#define PERIPH_CONF_COMMON_H
20
21/* include board.h and periph_cpu.h to make them visible in any case */
22#include "periph_cpu.h"
23#include "kernel_defines.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#ifndef BIT
30#define BIT(X) (1<<(X))
31#endif
32
39#define ADC_NUMOF (1)
48#define DAC_NUMOF (0)
59static const i2c_conf_t i2c_config[] = {
60 #if defined(I2C0_SCL) && defined(I2C0_SDA) && defined(I2C0_SPEED)
61 {
63 .scl = I2C0_SCL,
64 .sda = I2C0_SDA,
65 },
66 #endif
67 #if defined(I2C1_SCL) && defined(I2C1_SDA) && defined(I2C1_SPEED)
68 {
69 .speed = I2C1_SPEED,
70 .scl = I2C1_SCL,
71 .sda = I2C1_SDA,
72 },
73 #endif
74};
75
84#define I2C_NUMOF ARRAY_SIZE(i2c_config)
85
105#if defined(PWM0_GPIOS) || defined(DOXYGEN)
109static const gpio_t pwm0_channels[] = PWM0_GPIOS;
110
118#define PWM_NUMOF (1)
120#endif /* defined(PWM0_GPIOS) || defined(DOXYGEN) */
148#define SPI0_DEV SPI_DEV(0)
149#define SPI0_CTRL HSPI
150#define SPI0_MISO GPIO12
151#define SPI0_MOSI GPIO13
152#define SPI0_SCK GPIO14
154#ifndef SPI0_CS0
155#define SPI0_CS0 GPIO15
157#endif
158
162static const spi_conf_t spi_config[] = {
163#ifdef SPI0_CTRL
164 {
165 .ctrl = SPI0_CTRL,
166 .sck = SPI0_SCK,
167 .mosi = SPI0_MOSI,
168 .miso = SPI0_MISO,
169 .cs = SPI0_CS0,
170 },
171#endif
172};
173
182#define SPI_NUMOF ARRAY_SIZE(spi_config)
183
190#if defined(MODULE_ESP_SW_TIMER)
191
192/* software timer */
193#define TIMER_NUMOF (1U)
194#define TIMER_CHANNEL_NUMOF (10U)
196#else /* MODULE_ESP_SW_TIMER */
197
198/* hardware timer */
199#define TIMER_NUMOF (1U)
200#define TIMER_CHANNEL_NUMOF (1U)
202#endif /* MODULE_ESP_SW_TIMER */
228#ifndef UART0_TXD
229#define UART0_TXD GPIO1
230#endif /* UART0_TXD */
231
232#ifndef UART0_RXD
233#define UART0_RXD GPIO3
234#endif /* UART0_RXD */
235
236#ifdef DOXYGEN
237#define UART1_TXD GPIO2
238#endif /* DOXYGEN */
239
240#ifndef UART1_RXD
241#define UART1_RXD GPIO_UNDEF
242#endif /* UART1_RXD */
243
247static const uart_conf_t uart_config[] = {
248 {
249 .txd = UART0_TXD,
250 .rxd = UART0_RXD,
251 },
252#ifdef UART1_TXD
253 {
254 .txd = UART1_TXD,
255 .rxd = UART1_RXD,
256 },
257#endif /* UART1_TXD */
258};
259
268#define UART_NUMOF ARRAY_SIZE(uart_config)
271#ifdef __cplusplus
272} /* end extern "C" */
273#endif
274
275#endif /* PERIPH_CONF_COMMON_H */
#define I2C0_SPEED
I2C bus speed of I2C_DEV(0)
Definition periph_conf.h:66
#define I2C0_SCL
SCL signal of I2C_DEV(0)
Definition periph_conf.h:69
#define I2C0_SDA
SDA signal of I2C_DEV(0)
Definition periph_conf.h:72
static const uart_conf_t uart_config[]
Static array with configuration for declared UART devices.
static const spi_conf_t spi_config[]
Static array with configuration for declared SPI devices.
static const gpio_t pwm0_channels[]
Static array of GPIOs that can be used as channels of PWM_DEV(0)
#define SPI0_MOSI
HSPI / SPI_DEV(0) MOSI pin.
#define UART1_TXD
TxD pin of UART_DEV(1)
#define SPI0_CTRL
HSPI / SPI_DEV(0) controller.
#define SPI0_CS0
HSPI / SPI_DEV(0) CS default pin, only used when cs parameter in spi_acquire is GPIO_UNDEF.
#define SPI0_SCK
HSPI / SPI_DEV(0) SCK pin.
#define UART1_RXD
RxD pin of UART_DEV(1)
static const i2c_conf_t i2c_config[]
Static array with configuration for declared I2C devices.
#define SPI0_MISO
HSPI / SPI_DEV(0) MISO pin.
Common macros and compiler attributes/pragmas configuration.
#define UART0_RXD
RxD of UART_DEV(0) used on all ESP32 boards.
#define UART0_TXD
TxD of UART_DEV(0) used on all ESP32 boards.
I2C configuration structure.
Definition periph_cpu.h:299
i2c_speed_t speed
Configured bus speed, actual speed may be lower but never higher.
Definition periph_cpu.h:304
SPI device configuration.
Definition periph_cpu.h:337
spi_ctrl_t ctrl
SPI controller used for the interface.
Definition periph_cpu.h:864
UART device configuration.
Definition periph_cpu.h:218
gpio_t txd
GPIO used as TxD pin.
Definition periph_cpu.h:977