periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016 Freie Universität Berlin
3  * SPDX-FileCopyrightText: 2016-2018 Inria
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
23 #include "periph_cpu.h"
24 #include "periph_conf_common.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 static const uart_conf_t uart_config[] = {
35  {
36  .dev = &SERCOM5->USART,
37  .rx_pin = GPIO_PIN(PB,23), /* ARDUINO_PIN_13, RX Pin */
38  .tx_pin = GPIO_PIN(PB,22), /* ARDUINO_PIN_14, TX Pin */
39 #ifdef MODULE_PERIPH_UART_HW_FC
40  .rts_pin = GPIO_UNDEF,
41  .cts_pin = GPIO_UNDEF,
42 #endif
43  .mux = GPIO_MUX_D,
44  .rx_pad = UART_PAD_RX_3,
45  .tx_pad = UART_PAD_TX_2,
46  .flags = UART_FLAG_NONE,
47  .gclk_src = SAM0_GCLK_MAIN,
48  },
49  { /* LoRa module */
50  .dev = &SERCOM4->USART,
51  .rx_pin = GPIO_PIN(PA,15),
52  .tx_pin = GPIO_PIN(PA,12),
53 #ifdef MODULE_PERIPH_UART_HW_FC
54  .rts_pin = GPIO_UNDEF,
55  .cts_pin = GPIO_UNDEF,
56 #endif
57  .mux = GPIO_MUX_D,
58  .rx_pad = UART_PAD_RX_3,
59  .tx_pad = UART_PAD_TX_0,
60  .flags = UART_FLAG_NONE,
61  .gclk_src = SAM0_GCLK_MAIN,
62  },
63 };
64 
65 /* interrupt function name mapping */
66 #define UART_0_ISR isr_sercom5
67 #define UART_1_ISR isr_sercom4
68 
69 #define UART_NUMOF ARRAY_SIZE(uart_config)
76 static const spi_conf_t spi_config[] = {
77  {
78  .dev = &SERCOM1->SPI,
79  .miso_pin = GPIO_PIN(PA, 19), /* ARDUINO_PIN_8, SERCOM1-MISO */
80  .mosi_pin = GPIO_PIN(PA, 16), /* ARDUINO_PIN_10, SERCOM1-MOSI */
81  .clk_pin = GPIO_PIN(PA, 17), /* ARDUINO_PIN_9, SERCOM1-SCK */
82  .miso_mux = GPIO_MUX_C,
83  .mosi_mux = GPIO_MUX_C,
84  .clk_mux = GPIO_MUX_C,
85  .miso_pad = SPI_PAD_MISO_3,
86  .mosi_pad = SPI_PAD_MOSI_0_SCK_1,
87  .gclk_src = SAM0_GCLK_MAIN,
88  }
89 };
90 
91 #define SPI_NUMOF ARRAY_SIZE(spi_config)
94 #ifdef __cplusplus
95 }
96 #endif
97 
#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:35
static const spi_conf_t spi_config[]
SPI configuration.
Definition: periph_conf.h:93
@ UART_PAD_RX_3
select pad 3
@ PB
port B
@ PA
port A
@ SPI_PAD_MISO_3
use pad 3 for MISO line
@ UART_FLAG_NONE
No flags set.
@ UART_PAD_TX_0
select pad 0
@ UART_PAD_TX_2
select pad 2
@ GPIO_MUX_D
select peripheral function D
@ GPIO_MUX_C
select peripheral function C
@ SPI_PAD_MOSI_0_SCK_1
use pad 0 for MOSI, pad 1 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
UART device configuration.
Definition: periph_cpu.h:217
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:218