periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_rtt_default.h"
30 #include "cfg_timer_tim2.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
40 static const uart_conf_t uart_config[] = {
41  {
42  .dev = LPUART1,
43  .rcc_mask = RCC_APB1ENR_LPUART1EN,
44  .rx_pin = GPIO_PIN(PORT_B, 11),
45  .tx_pin = GPIO_PIN(PORT_B, 10),
46  .rx_af = GPIO_AF4,
47  .tx_af = GPIO_AF4,
48  .bus = APB1,
49  .irqn = LPUART1_IRQn,
50  .type = STM32_LPUART,
51  .clk_src = 0, /* Use APB clock */
52  },
53 };
54 
55 #define UART_0_ISR (isr_rng_lpuart1)
56 
57 #define UART_NUMOF ARRAY_SIZE(uart_config)
58 
64 static const spi_conf_t spi_config[] = {
65  {
66  .dev = SPI1, /* connected to SX1272 */
67  .mosi_pin = GPIO_PIN(PORT_A, 12),
68  .miso_pin = GPIO_PIN(PORT_B, 4),
69  .sclk_pin = GPIO_PIN(PORT_B, 3),
70  .cs_pin = GPIO_PIN(PORT_A, 15),
71  .mosi_af = GPIO_AF0,
72  .miso_af = GPIO_AF0,
73  .sclk_af = GPIO_AF0,
74  .cs_af = GPIO_AF0,
75  .rccmask = RCC_APB2ENR_SPI1EN,
76  .apbbus = APB2,
77  },
78 };
79 
80 #define SPI_NUMOF ARRAY_SIZE(spi_config)
81 
87 static const i2c_conf_t i2c_config[] = {
88  {
89  .dev = I2C1,
90  .speed = I2C_SPEED_NORMAL,
91  .scl_pin = GPIO_PIN(PORT_B, 6),
92  .sda_pin = GPIO_PIN(PORT_B, 7),
93  .scl_af = GPIO_AF1,
94  .sda_af = GPIO_AF1,
95  .bus = APB1,
96  .rcc_mask = RCC_APB1ENR_I2C1EN,
97  .irqn = I2C1_IRQn
98  }
99 };
100 
101 #define I2C_0_ISR isr_i2c1
102 
103 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
104 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif /* PERIPH_CONF_H */
111 
GPIO_AF4
@ GPIO_AF4
use alternate function 4
Definition: periph_cpu_common.h:90
I2C_SPEED_NORMAL
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition: i2c.h:177
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
uart_conf_t
UART device configuration.
Definition: periph_cpu.h:166
GPIO_AF1
@ GPIO_AF1
use alternate function 1
Definition: periph_cpu_common.h:87
uart_conf_t::dev
cc2538_uart_t * dev
pointer to the used UART device
Definition: periph_cpu.h:167
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
GPIO_AF0
@ GPIO_AF0
use alternate function 0
Definition: periph_cpu_common.h:86
STM32_LPUART
@ STM32_LPUART
STM32 Low-power UART (LPUART) module type.
Definition: periph_cpu.h:584
i2c_conf_t
I2C configuration options.
Definition: periph_cpu.h:128
cfg_timer_tim2.h
Common configuration for STM32 Timer peripheral based on TIM2.
PORT_B
@ PORT_B
port B
Definition: periph_cpu.h:37
spi_conf_t::dev
SPI_Type * dev
SPI device to use.
Definition: periph_cpu.h:465
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
i2c_conf_t::dev
I2C_TypeDef * dev
USART device used.
Definition: periph_cpu.h:247
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176