periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Inria
3  * SPDX-FileCopyrightText: 2020 Gunar Schorcht
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
21 #include "periph_cpu.h"
22 #include "cfg_clock_32_1.h"
23 #include "cfg_rtt_default.h"
24 #include "cfg_timer_default.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 #define NRF5X_ENABLE_DCDC
34 
39 static const i2c_conf_t i2c_config[] = {
40  {
41  .dev = NRF_TWIM1,
42  .scl = GPIO_PIN(0, 27),
43  .sda = GPIO_PIN(0, 26),
44  .speed = I2C_SPEED_NORMAL
45  },
46  {
47  .dev = NRF_TWIM0,
48  .scl = GPIO_PIN(0, 22),
49  .sda = GPIO_PIN(1, 0),
50  .speed = I2C_SPEED_NORMAL
51  }
52 
53 };
54 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
61 static const pwm_conf_t pwm_config[] = {
62  {
63  .dev = NRF_PWM0,
64  .pin = {
65  GPIO_PIN(1, 4),
66  GPIO_PIN(1, 6),
67  GPIO_PIN(1, 7),
68  GPIO_PIN(1, 11)
69  }
70  },
71  {
72  .dev = NRF_PWM1,
73  .pin = {
74  GPIO_PIN(0, 13),
75  GPIO_PIN(0, 14),
76  GPIO_PIN(1, 9),
77  GPIO_PIN(0, 16)
78  }
79  },
80  {
81  .dev = NRF_PWM2,
82  .pin = {
83  GPIO_PIN(0, 15),
84  GPIO_UNDEF,
85  GPIO_UNDEF,
87  }
88  }
89 };
90 
91 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
98 static const spi_conf_t spi_config[] = {
99  {
100  .dev = NRF_SPIM0,
101  .sclk = GPIO_PIN(1, 15),
102  .mosi = GPIO_PIN(1, 13),
103  .miso = GPIO_PIN(1, 14),
104  },
105  {
106  .dev = NRF_SPIM1,
107  .sclk = GPIO_PIN(0, 17),
108  .mosi = GPIO_PIN(0, 24),
109  .miso = GPIO_PIN(0, 20),
110  }
111 };
112 #define SPI_NUMOF ARRAY_SIZE(spi_config)
119 static const uart_conf_t uart_config[] = {
120  { /* Mapped to USB virtual COM port */
121  .dev = NRF_UARTE0,
122  .rx_pin = GPIO_PIN(0, 8),
123  .tx_pin = GPIO_PIN(0, 6),
124 #ifdef MODULE_PERIPH_UART_HW_FC
125  .rts_pin = GPIO_PIN(0, 25),
126  .cts_pin = GPIO_PIN(0, 7),
127 #endif
128  .irqn = UARTE0_UART0_IRQn,
129  },
130  { /* Mapped to Arduino D0/D1 pins */
131  .dev = NRF_UARTE1,
132  .rx_pin = GPIO_PIN(1, 1),
133  .tx_pin = GPIO_PIN(1, 2),
134 #ifdef MODULE_PERIPH_UART_HW_FC
135  .rts_pin = GPIO_UNDEF,
136  .cts_pin = GPIO_UNDEF,
137 #endif
138  .irqn = UARTE1_IRQn,
139  },
140 };
141 
142 #define UART_0_ISR (isr_uart0)
143 #define UART_1_ISR (isr_uarte1)
144 
145 #define UART_NUMOF ARRAY_SIZE(uart_config)
148 #ifdef __cplusplus
149 }
150 #endif
151 
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:65
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:218
Common clock configuration for the nRF52 based boards.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:274
I2C configuration structure.
Definition: periph_cpu.h:295
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:296
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition: periph_cpu.h:333
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:334
UART device configuration.
Definition: periph_cpu.h:214
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:215