periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 Freie Universität Berlin
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 
20 #ifndef PERIPH_CONF_H
21 #define PERIPH_CONF_H
22 
23 #include "periph_cpu.h"
24 #include "periph_conf_common.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 static const spi_conf_t spi_config[] = {
35  {
36  .dev = SPI1,
37  .mosi_pin = GPIO_PIN(PORT_A, 7),
38  .miso_pin = GPIO_PIN(PORT_A, 6),
39  .sclk_pin = GPIO_PIN(PORT_A, 5),
40  .cs_pin = SPI_CS_UNDEF,
41  .rccmask = RCC_APB2ENR_SPI1EN,
42  .apbbus = APB2,
43 #ifdef MODULE_PERIPH_DMA
44  .tx_dma = DMA_STREAM_UNDEF,
45  .tx_dma_chan = 1,
46  .rx_dma = DMA_STREAM_UNDEF,
47  .rx_dma_chan = 1,
48 #endif
49  },
50 #ifdef MODULE_MTD
51  {
52  .dev = SPI2,
53  .mosi_pin = GPIO_PIN(PORT_B, 15),
54  .miso_pin = GPIO_PIN(PORT_B, 14),
55  .sclk_pin = GPIO_PIN(PORT_B, 13),
56  .cs_pin = SPI_CS_UNDEF,
57  .rccmask = RCC_APB1ENR_SPI2EN,
58  .apbbus = APB1,
59 #ifdef MODULE_PERIPH_DMA
60  .tx_dma = DMA_STREAM_UNDEF,
61  .tx_dma_chan = 1,
62  .rx_dma = DMA_STREAM_UNDEF,
63  .rx_dma_chan = 1,
64 #endif
65  },
66 #endif
67 };
68 
69 #define SPI_NUMOF ARRAY_SIZE(spi_config)
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition: periph_cpu.h:48
@ PORT_A
port A
Definition: periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:46
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:97
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition: periph_cpu.h:363
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition: periph_cpu.h:80
SPI device configuration.
Definition: periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:338