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 #include "periph_cpu.h"
23 
24 /* Add specific clock configuration (HSE, LSE) for this board here */
25 #ifndef CONFIG_BOARD_HAS_LSE
26 #define CONFIG_BOARD_HAS_LSE 1
27 #endif
28 
29 #include "clk_conf.h"
30 #include "cfg_i2c1_pb8_pb9.h"
31 #include "cfg_rtt_default.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
41 static const timer_conf_t timer_config[] = {
42  {
43  .dev = TIM3,
44  .max = 0x0000ffff,
45  .rcc_mask = RCC_APBENR1_TIM3EN,
46  .bus = APB1,
47  .irqn = TIM3_IRQn
48  }
49 };
50 
51 #define TIMER_0_ISR isr_tim3
52 
53 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
54 
60 static const uart_conf_t uart_config[] = {
61  {
62  .dev = USART2,
63  .rcc_mask = RCC_APBENR1_USART2EN,
64  .rx_pin = GPIO_PIN(PORT_A, 3),
65  .tx_pin = GPIO_PIN(PORT_A, 2),
66  .rx_af = GPIO_AF1,
67  .tx_af = GPIO_AF1,
68  .bus = APB1,
69  .irqn = USART2_IRQn,
70  },
71  { /* Arduino pinout on D0/D1 */
72  .dev = USART1,
73  .rcc_mask = RCC_APBENR2_USART1EN,
74  .rx_pin = GPIO_PIN(PORT_C, 5),
75  .tx_pin = GPIO_PIN(PORT_C, 4),
76  .rx_af = GPIO_AF1,
77  .tx_af = GPIO_AF1,
78  .bus = APB12,
79  .irqn = USART1_IRQn,
80  },
81 };
82 
83 #define UART_0_ISR (isr_usart2)
84 #define UART_1_ISR (isr_usart1)
85 
86 #define UART_NUMOF ARRAY_SIZE(uart_config)
87 
93 static const spi_conf_t spi_config[] = {
94  {
95  .dev = SPI1,
96  .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
97  .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
98  .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
99  .cs_pin = GPIO_UNDEF,
100  .mosi_af = GPIO_AF0,
101  .miso_af = GPIO_AF0,
102  .sclk_af = GPIO_AF0,
103  .cs_af = GPIO_AF0,
104  .rccmask = RCC_APBENR2_SPI1EN,
105  .apbbus = APB12,
106  },
107 };
108 
109 #define SPI_NUMOF ARRAY_SIZE(spi_config)
110 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* PERIPH_CONF_H */
117 
PORT_C
@ PORT_C
port C
Definition: periph_cpu.h:38
PORT_A
@ PORT_A
port A
Definition: periph_cpu.h:36
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
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
timer_conf_t
Timer configuration.
Definition: periph_cpu.h:288
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition: periph_cpu.h:35
GPIO_AF0
@ GPIO_AF0
use alternate function 0
Definition: periph_cpu_common.h:86
timer_conf_t::dev
uint32_t dev
Address of timer base.
Definition: periph_cpu.h:112
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
spi_conf_t
SPI configuration structure type.
Definition: periph_cpu.h:273
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176