periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  * 2017 OTA keys
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef PERIPH_CONF_H
22 #define PERIPH_CONF_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 "periph_cpu.h"
30 #include "clk_conf.h"
31 #include "cfg_i2c1_pb6_pb7.h"
32 #include "cfg_rtt_default.h"
33 #include "cfg_timer_tim2.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 static const uart_conf_t uart_config[] = {
44  {
45  .dev = USART2,
46  .rcc_mask = RCC_APB1ENR1_USART2EN,
47  .rx_pin = GPIO_PIN(PORT_A, 15),
48  .tx_pin = GPIO_PIN(PORT_A, 2),
49  .rx_af = GPIO_AF3,
50  .tx_af = GPIO_AF7,
51  .bus = APB1,
52  .irqn = USART2_IRQn,
53  .type = STM32_USART,
54  .clk_src = 0, /* Use APB clock */
55  },
56  {
57  .dev = USART1,
58  .rcc_mask = RCC_APB2ENR_USART1EN,
59  .rx_pin = GPIO_PIN(PORT_A, 10),
60  .tx_pin = GPIO_PIN(PORT_A, 9),
61  .rx_af = GPIO_AF7,
62  .tx_af = GPIO_AF7,
63  .bus = APB2,
64  .irqn = USART1_IRQn,
65  .type = STM32_USART,
66  .clk_src = 0, /* Use APB clock */
67  },
68 };
69 
70 #define UART_0_ISR (isr_usart2)
71 #define UART_1_ISR (isr_usart1)
72 
73 #define UART_NUMOF ARRAY_SIZE(uart_config)
74 
80 static const pwm_conf_t pwm_config[] = {
81  {
82  .dev = TIM1,
83  .rcc_mask = RCC_APB2ENR_TIM1EN,
84  .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
85  { .pin = GPIO_UNDEF, .cc_chan = 0 },
86  { .pin = GPIO_UNDEF, .cc_chan = 0 },
87  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
88  .af = GPIO_AF1,
89  .bus = APB2
90  }
91 };
92 
93 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
94 
100 static const spi_conf_t spi_config[] = {
101  {
102  .dev = SPI1,
103  .mosi_pin = GPIO_PIN(PORT_B, 5),
104  .miso_pin = GPIO_PIN(PORT_B, 4),
105  .sclk_pin = GPIO_PIN(PORT_B, 3),
106  .cs_pin = GPIO_UNDEF,
107  .mosi_af = GPIO_AF5,
108  .miso_af = GPIO_AF5,
109  .sclk_af = GPIO_AF5,
110  .cs_af = GPIO_AF5,
111  .rccmask = RCC_APB2ENR_SPI1EN,
112  .apbbus = APB2
113  }
114 };
115 
116 #define SPI_NUMOF ARRAY_SIZE(spi_config)
117 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* PERIPH_CONF_H */
124 
pwm_conf_t::dev
mini_timer_t * dev
Timer used.
Definition: periph_cpu_common.h:154
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
pwm_conf_t
PWM device configuration.
Definition: periph_cpu_common.h:153
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
GPIO_AF1
@ GPIO_AF1
use alternate function 1
Definition: periph_cpu_common.h:87
GPIO_AF3
@ GPIO_AF3
use alternate function 3
Definition: periph_cpu_common.h:89
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
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
cfg_i2c1_pb6_pb7.h
Common configuration for STM32 I2C.
APB1
@ APB1
APB1 bus.
Definition: periph_cpu.h:176