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