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 "clk_conf.h"
28 #include "cfg_i2c1_pb8_pb9.h"
29 #include "cfg_rtt_default.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
39 static const timer_conf_t timer_config[] = {
40  {
41  .dev = TIM3,
42  .max = 0x0000ffff,
43  .rcc_mask = RCC_APBENR1_TIM3EN,
44  .bus = APB1,
45  .irqn = TIM3_IRQn
46  }
47 };
48 
49 #define TIMER_0_ISR isr_tim3
50 
51 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
52 
58 static const uart_conf_t uart_config[] = {
59  {
60  .dev = USART2,
61  .rcc_mask = RCC_APBENR1_USART2EN,
62  .rx_pin = GPIO_PIN(PORT_A, 3),
63  .tx_pin = GPIO_PIN(PORT_A, 2),
64  .rx_af = GPIO_AF1,
65  .tx_af = GPIO_AF1,
66  .bus = APB1,
67  .irqn = USART2_IRQn,
68  },
69  { /* Arduino pinout on D0/D1 */
70  .dev = USART1,
71  .rcc_mask = RCC_APBENR2_USART1EN,
72  .rx_pin = GPIO_PIN(PORT_C, 5),
73  .tx_pin = GPIO_PIN(PORT_C, 4),
74  .rx_af = GPIO_AF1,
75  .tx_af = GPIO_AF1,
76  .bus = APB12,
77  .irqn = USART1_IRQn,
78  },
79 };
80 
81 #define UART_0_ISR (isr_usart2)
82 #define UART_1_ISR (isr_usart1)
83 
84 #define UART_NUMOF ARRAY_SIZE(uart_config)
85 
91 static const spi_conf_t spi_config[] = {
92  {
93  .dev = SPI1,
94  .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
95  .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
96  .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
97  .cs_pin = GPIO_UNDEF,
98  .mosi_af = GPIO_AF0,
99  .miso_af = GPIO_AF0,
100  .sclk_af = GPIO_AF0,
101  .cs_af = GPIO_AF0,
102  .rccmask = RCC_APBENR2_SPI1EN,
103  .apbbus = APB12,
104  },
105 };
106 
107 #define SPI_NUMOF ARRAY_SIZE(spi_config)
108 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif /* PERIPH_CONF_H */
115 
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