periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Inria
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 
19 #ifndef PERIPH_CONF_H
20 #define PERIPH_CONF_H
21 
22 /* Add specific clock configuration (HSE, LSE) for this board here */
23 #ifndef CONFIG_BOARD_HAS_LSE
24 #define CONFIG_BOARD_HAS_LSE 1
25 #endif
26 
27 #include "periph_cpu.h"
28 #include "clk_conf.h"
29 #include "cfg_i2c1_pb8_pb9.h"
30 #include "cfg_rtt_default.h"
31 #include "cfg_timer_tim5.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
41 static const uart_conf_t uart_config[] = {
42  {
43  .dev = LPUART1,
44  .rcc_mask = RCC_APB1ENR2_LPUART1EN,
45  .rx_pin = GPIO_PIN(PORT_G, 8),
46  .tx_pin = GPIO_PIN(PORT_G, 7),
47  .rx_af = GPIO_AF8,
48  .tx_af = GPIO_AF8,
49  .bus = APB12,
50  .irqn = LPUART1_IRQn,
51  .type = STM32_LPUART,
52  .clk_src = 0, /* Use APB clock */
53  },
54  { /* Connected to Arduino D0/D1 */
55  .dev = USART3,
56  .rcc_mask = RCC_APB1ENR1_USART3EN,
57  .rx_pin = GPIO_PIN(PORT_D, 9),
58  .tx_pin = GPIO_PIN(PORT_D, 8),
59  .rx_af = GPIO_AF7,
60  .tx_af = GPIO_AF7,
61  .bus = APB1,
62  .irqn = USART3_IRQn,
63  .type = STM32_USART,
64  .clk_src = 0, /* Use APB clock */
65  },
66 };
67 
68 #define UART_0_ISR (isr_lpuart1)
69 #define UART_1_ISR (isr_usart3)
70 
71 #define UART_NUMOF ARRAY_SIZE(uart_config)
72 
78 static const spi_conf_t spi_config[] = {
79  {
80  .dev = SPI1,
81  .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
82  .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
83  .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
84  .cs_pin = GPIO_UNDEF,
85  .mosi_af = GPIO_AF5,
86  .miso_af = GPIO_AF5,
87  .sclk_af = GPIO_AF5,
88  .cs_af = GPIO_AF5,
89  .rccmask = RCC_APB2ENR_SPI1EN,
90  .apbbus = APB2,
91  },
92 };
93 
94 #define SPI_NUMOF ARRAY_SIZE(spi_config)
95 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* PERIPH_CONF_H */
102 
GPIO_AF8
@ GPIO_AF8
use alternate function 8
Definition: periph_cpu_common.h:94
GPIO_AF5
@ GPIO_AF5
use alternate function 5
Definition: periph_cpu_common.h:91
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
PORT_D
@ PORT_D
port D
Definition: periph_cpu.h:39
cfg_timer_tim5.h
Common configuration for STM32 Timer peripheral based on TIM5.
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition: periph_cpu_common.h:52
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
STM32_USART
@ STM32_USART
STM32 USART module type.
Definition: periph_cpu.h:583
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
GPIO_AF7
@ GPIO_AF7
use alternate function 7
Definition: periph_cpu_common.h:93
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
APB2
@ APB2
APB2 bus.
Definition: periph_cpu.h:177
STM32_LPUART
@ STM32_LPUART
STM32 Low-power UART (LPUART) module type.
Definition: periph_cpu.h:584
cfg_i2c1_pb8_pb9.h
Common configuration for STM32 I2C.
spi_conf_t::dev
SPI_Type * dev
SPI device to use.
Definition: periph_cpu.h:465
PORT_G
@ PORT_G
port G
Definition: periph_cpu.h:42
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176