periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Inria
3  * 2020 Gunar Schorcht
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
24 #include "periph_cpu.h"
25 #include "cfg_clock_32_1.h"
26 #include "cfg_rtt_default.h"
27 #include "cfg_timer_default.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 #define NRF5X_ENABLE_DCDC
37 
42 static const i2c_conf_t i2c_config[] = {
43  {
44  .dev = NRF_TWIM1,
45  .scl = GPIO_PIN(0, 27),
46  .sda = GPIO_PIN(0, 26),
47  .speed = I2C_SPEED_NORMAL
48  },
49  {
50  .dev = NRF_TWIM0,
51  .scl = GPIO_PIN(0, 22),
52  .sda = GPIO_PIN(1, 0),
53  .speed = I2C_SPEED_NORMAL
54  }
55 
56 };
57 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
64 static const pwm_conf_t pwm_config[] = {
65  {
66  .dev = NRF_PWM0,
67  .pin = {
68  GPIO_PIN(1, 4),
69  GPIO_PIN(1, 6),
70  GPIO_PIN(1, 7),
71  GPIO_PIN(1, 11)
72  }
73  },
74  {
75  .dev = NRF_PWM1,
76  .pin = {
77  GPIO_PIN(0, 13),
78  GPIO_PIN(0, 14),
79  GPIO_PIN(1, 9),
80  GPIO_PIN(0, 16)
81  }
82  },
83  {
84  .dev = NRF_PWM2,
85  .pin = {
86  GPIO_PIN(0, 15),
87  GPIO_UNDEF,
88  GPIO_UNDEF,
90  }
91  }
92 };
93 
94 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
101 static const spi_conf_t spi_config[] = {
102  {
103  .dev = NRF_SPIM0,
104  .sclk = GPIO_PIN(1, 15),
105  .mosi = GPIO_PIN(1, 13),
106  .miso = GPIO_PIN(1, 14),
107  },
108  {
109  .dev = NRF_SPIM1,
110  .sclk = GPIO_PIN(0, 17),
111  .mosi = GPIO_PIN(0, 24),
112  .miso = GPIO_PIN(0, 20),
113  }
114 };
115 #define SPI_NUMOF ARRAY_SIZE(spi_config)
122 static const uart_conf_t uart_config[] = {
123  { /* Mapped to USB virtual COM port */
124  .dev = NRF_UARTE0,
125  .rx_pin = GPIO_PIN(0, 8),
126  .tx_pin = GPIO_PIN(0, 6),
127 #ifdef MODULE_PERIPH_UART_HW_FC
128  .rts_pin = GPIO_PIN(0, 25),
129  .cts_pin = GPIO_PIN(0, 7),
130 #endif
131  .irqn = UARTE0_UART0_IRQn,
132  },
133  { /* Mapped to Arduino D0/D1 pins */
134  .dev = NRF_UARTE1,
135  .rx_pin = GPIO_PIN(1, 1),
136  .tx_pin = GPIO_PIN(1, 2),
137 #ifdef MODULE_PERIPH_UART_HW_FC
138  .rts_pin = GPIO_UNDEF,
139  .cts_pin = GPIO_UNDEF,
140 #endif
141  .irqn = UARTE1_IRQn,
142  },
143 };
144 
145 #define UART_0_ISR (isr_uart0)
146 #define UART_1_ISR (isr_uarte1)
147 
148 #define UART_NUMOF ARRAY_SIZE(uart_config)
151 #ifdef __cplusplus
152 }
153 #endif
154 
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:45
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:38
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:96
static const i2c_conf_t i2c_config[]
I2C configuration.
Definition: periph_conf.h:68
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
Definition: periph_conf.h:221
Common clock configuration for the nRF52 based boards.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: periph_cpu.h:277
I2C configuration structure.
Definition: periph_cpu.h:298
TWI_t * dev
Pointer to hardware module registers.
Definition: periph_cpu.h:299
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition: periph_cpu.h:336
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:337
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218