periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Benjamin Valentin
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 #pragma once
10 
22 #include "periph_cpu.h"
23 #include "cfg_rtt_default.h"
24 #include "cfg_timer_default.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
35 #define CLOCK_HFCLK (1) /* external crystal */
36 
37 /* LFCLK Source clock selection:*/
38 /* - CLOCK_LFCLKSRC_SRC_RC: internal RC oscillator
39  * - CLOCK_LFCLKSRC_SRC_Xtal: 32.768 kHz crystal
40  * - CLOCK_LFCLKSRC_SRC_Synth: derived from HFCLK */
41 #define CLOCK_LFCLK (CLOCK_LFCLKSRC_SRC_RC)
48 static const spi_conf_t spi_config[] = {
49  {
50  .dev = NRF_SPIM0,
51  .sclk = GPIO_PIN(0, 26),
52  .mosi = GPIO_PIN(0, 27),
53  .miso = GPIO_PIN(0, 28),
54  },
55 };
56 #define SPI_NUMOF ARRAY_SIZE(spi_config)
63 static const i2c_conf_t i2c_config[] = {
64  {
65  .dev = NRF_TWIM0,
66  .scl = GPIO_PIN(0, 6),
67  .sda = GPIO_PIN(0, 7),
68  .speed = I2C_SPEED_NORMAL
69  }
70 };
71 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
78 static const uart_conf_t uart_config[] = {
79  { /* Mapped to USB virtual COM port */
80  .dev = NRF_UARTE0,
81  .rx_pin = GPIO_PIN(0, 14),
82  .tx_pin = GPIO_PIN(0, 18),
83 #ifdef MODULE_PERIPH_UART_HW_FC
84  .rts_pin = GPIO_UNDEF,
85  .cts_pin = GPIO_UNDEF,
86 #endif
87  .irqn = UARTE0_UART0_IRQn,
88  },
89 };
90 
91 #define UART_0_ISR (isr_uart0)
92 
93 #define UART_NUMOF ARRAY_SIZE(uart_config)
96 #ifdef __cplusplus
97 }
98 #endif
99 
#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
@ 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
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