periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2014-2016 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #include "periph_cpu.h"
20 #include "periph_conf_common.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
30 static const spi_conf_t spi_config[] = {
31  {
32  .dev = SPI1,
33  .mosi_pin = GPIO_PIN(PORT_A, 7),
34  .miso_pin = GPIO_PIN(PORT_A, 6),
35  .sclk_pin = GPIO_PIN(PORT_A, 5),
36  .cs_pin = SPI_CS_UNDEF,
37  .rccmask = RCC_APB2ENR_SPI1EN,
38  .apbbus = APB2,
39 #ifdef MODULE_PERIPH_DMA
40  .tx_dma = DMA_STREAM_UNDEF,
41  .tx_dma_chan = 1,
42  .rx_dma = DMA_STREAM_UNDEF,
43  .rx_dma_chan = 1,
44 #endif
45  },
46 #ifdef MODULE_MTD
47  {
48  .dev = SPI2,
49  .mosi_pin = GPIO_PIN(PORT_B, 15),
50  .miso_pin = GPIO_PIN(PORT_B, 14),
51  .sclk_pin = GPIO_PIN(PORT_B, 13),
52  .cs_pin = SPI_CS_UNDEF,
53  .rccmask = RCC_APB1ENR_SPI2EN,
54  .apbbus = APB1,
55 #ifdef MODULE_PERIPH_DMA
56  .tx_dma = DMA_STREAM_UNDEF,
57  .tx_dma_chan = 1,
58  .rx_dma = DMA_STREAM_UNDEF,
59  .rx_dma_chan = 1,
60 #endif
61  },
62 #endif
63 };
64 
65 #define SPI_NUMOF ARRAY_SIZE(spi_config)
68 #ifdef __cplusplus
69 }
70 #endif
71 
@ PORT_B
port B
Definition: periph_cpu.h:44
@ PORT_A
port A
Definition: periph_cpu.h:43
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:42
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
#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:333
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:334