cfg_spi_default.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Kees Bakker, SODAQ
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 
21 #include <stdint.h>
22 
23 #include "cpu.h"
24 #include "periph_cpu.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 static const spi_conf_t spi_config[] = {
35  {
36  .dev = &SERCOM3->SPI,
37  .miso_pin = GPIO_PIN(PA, 22),
38  .mosi_pin = GPIO_PIN(PA, 20),
39  .clk_pin = GPIO_PIN(PA, 21),
40  .miso_mux = GPIO_MUX_C,
41  .mosi_mux = GPIO_MUX_D,
42  .clk_mux = GPIO_MUX_D,
43  .miso_pad = SPI_PAD_MISO_0,
44  .mosi_pad = SPI_PAD_MOSI_2_SCK_3,
45  .gclk_src = SAM0_GCLK_MAIN,
46 #ifdef MODULE_PERIPH_DMA
47  .tx_trigger = SERCOM3_DMAC_ID_TX,
48  .rx_trigger = SERCOM3_DMAC_ID_RX,
49 #endif
50  },
51 };
52 
53 #define SPI_NUMOF ARRAY_SIZE(spi_config)
56 #ifdef __cplusplus
57 }
58 #endif
59 
#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[]
Default SPI device configuration.
@ PA
port A
@ SPI_PAD_MISO_0
use pad 0 for MISO line
@ GPIO_MUX_D
select peripheral function D
@ GPIO_MUX_C
select peripheral function C
@ SPI_PAD_MOSI_2_SCK_3
use pad 2 for MOSI, pad 3 for SCK
#define SAM0_GCLK_MAIN
120 MHz main clock
Definition: periph_cpu.h:73
SPI device configuration.
Definition: periph_cpu.h:336
SPI_t * dev
pointer to the used SPI device
Definition: periph_cpu.h:337