Loading...
Searching...
No Matches
periph_conf_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
16
17/* include board.h and periph_cpu.h to make them visible in any case */
18#include "periph_cpu.h"
19#include "kernel_defines.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#ifndef BIT
26#define BIT(X) (1<<(X))
27#endif
28
35#define ADC_NUMOF (1)
37
44#define DAC_NUMOF (0)
46
51
55static const i2c_conf_t i2c_config[] = {
56 #if defined(I2C0_SCL) && defined(I2C0_SDA) && defined(I2C0_SPEED)
57 {
58 .speed = I2C0_SPEED,
59 .scl = I2C0_SCL,
60 .sda = I2C0_SDA,
61 },
62 #endif
63 #if defined(I2C1_SCL) && defined(I2C1_SDA) && defined(I2C1_SPEED)
64 {
65 .speed = I2C1_SPEED,
66 .scl = I2C1_SCL,
67 .sda = I2C1_SDA,
68 },
69 #endif
70};
71
80#define I2C_NUMOF ARRAY_SIZE(i2c_config)
81
83
100
101#if defined(PWM0_GPIOS) || defined(DOXYGEN)
105static const gpio_t pwm0_channels[] = PWM0_GPIOS;
106
114#define PWM_NUMOF (1)
115
116#endif /* defined(PWM0_GPIOS) || defined(DOXYGEN) */
118
143
144#define SPI0_DEV SPI_DEV(0)
145#define SPI0_CTRL HSPI
146#define SPI0_MISO GPIO12
147#define SPI0_MOSI GPIO13
148#define SPI0_SCK GPIO14
149
150#ifndef SPI0_CS0
151#define SPI0_CS0 GPIO15
153#endif
154
158static const spi_conf_t spi_config[] = {
159#ifdef SPI0_CTRL
160 {
161 .ctrl = SPI0_CTRL,
162 .sck = SPI0_SCK,
163 .mosi = SPI0_MOSI,
164 .miso = SPI0_MISO,
165 .cs = SPI0_CS0,
166 },
167#endif
168};
169
178#define SPI_NUMOF ARRAY_SIZE(spi_config)
179
181
186#if defined(MODULE_ESP_SW_TIMER)
187
188/* software timer */
189#define TIMER_NUMOF (1U)
190#define TIMER_CHANNEL_NUMOF (10U)
191
192#else /* MODULE_ESP_SW_TIMER */
193
194/* hardware timer */
195#define TIMER_NUMOF (1U)
196#define TIMER_CHANNEL_NUMOF (1U)
197
198#endif /* MODULE_ESP_SW_TIMER */
200
224#ifndef UART0_TXD
225#define UART0_TXD GPIO1
226#endif /* UART0_TXD */
227
228#ifndef UART0_RXD
229#define UART0_RXD GPIO3
230#endif /* UART0_RXD */
231
232#ifdef DOXYGEN
233#define UART1_TXD GPIO2
234#endif /* DOXYGEN */
235
236#ifndef UART1_RXD
237#define UART1_RXD GPIO_UNDEF
238#endif /* UART1_RXD */
239
243static const uart_conf_t uart_config[] = {
244 {
245 .txd = UART0_TXD,
246 .rxd = UART0_RXD,
247 },
248#ifdef UART1_TXD
249 {
250 .txd = UART1_TXD,
251 .rxd = UART1_RXD,
252 },
253#endif /* UART1_TXD */
254};
255
264#define UART_NUMOF ARRAY_SIZE(uart_config)
266
267#ifdef __cplusplus
268} /* end extern "C" */
269#endif
270
#define I2C0_SPEED
I2C bus speed of I2C_DEV(0)
Definition periph_conf.h:77
#define SPI0_MOSI
Routed vio the GPIO matrix to FSPI MOSI signal.
#define UART0_RXD
direct I/O pin for UART_DEV(0) RxD, can't be changed
#define SPI0_CTRL
FSPI is used as SPI_DEV(0)
#define SPI0_CS0
Routed vio the GPIO matrix to FSPI CS0 signal.
#define I2C0_SCL
SCL signal of I2C_DEV(0)
Definition periph_conf.h:81
#define PWM0_GPIOS
Declaration of the channels for device PWM_DEV(0), at maximum eight channels (PWM_CH_NUMOF_MAX).
#define SPI0_SCK
Routed vio the GPIO matrix to FSPI CLK signal.
#define SPI0_MISO
Routed vio the GPIO matrix to FSPI MISO signal.
#define UART0_TXD
direct I/O pin for UART_DEV(0) TxD, can't be changed
#define I2C0_SDA
SDA signal of I2C_DEV(0)
Definition periph_conf.h:85
static const gpio_t pwm0_channels[]
Static array of GPIOs that can be used as channels of PWM_DEV(0)
#define UART1_TXD
TxD pin of UART_DEV(1)
#define UART1_RXD
RxD pin of UART_DEV(1)
Common macros and compiler attributes/pragmas configuration.
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:333
UART device configuration.
Definition periph_cpu.h:214