periph_conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 twostairs
3  * 2017 Inria
4  * 2017 OTA keys
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
23 #ifndef PERIPH_CONF_H
24 #define PERIPH_CONF_H
25 
26 /* Add specific clock configuration (HSE, LSE) for this board here */
27 #ifndef CONFIG_BOARD_HAS_LSE
28 #define CONFIG_BOARD_HAS_LSE 1
29 #endif
30 
31 #include "periph_cpu.h"
32 #include "clk_conf.h"
33 #include "cfg_i2c1_pb6_pb7.h"
34 #include "cfg_timer_tim2.h"
35 #include "cfg_rtt_default.h"
36 
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
46 static const uart_conf_t uart_config[] = {
47  {
48  .dev = USART2,
49  .rcc_mask = RCC_APB1ENR1_USART2EN,
50  .rx_pin = GPIO_PIN(PORT_A, 15),
51  .tx_pin = GPIO_PIN(PORT_A, 2),
52  .rx_af = GPIO_AF3,
53  .tx_af = GPIO_AF7,
54  .bus = APB1,
55  .irqn = USART2_IRQn,
56  .type = STM32_USART,
57  .clk_src = 0, /* Use APB clock */
58  },
59  {
60  .dev = USART1,
61  .rcc_mask = RCC_APB2ENR_USART1EN,
62  .rx_pin = GPIO_PIN(PORT_A, 10),
63  .tx_pin = GPIO_PIN(PORT_A, 9),
64  .rx_af = GPIO_AF7,
65  .tx_af = GPIO_AF7,
66  .bus = APB2,
67  .irqn = USART1_IRQn,
68  .type = STM32_USART,
69  .clk_src = 0, /* Use APB clock */
70  },
71 };
72 
73 #define UART_0_ISR (isr_usart2)
74 #define UART_1_ISR (isr_usart1)
75 
76 #define UART_NUMOF ARRAY_SIZE(uart_config)
77 
83 static const pwm_conf_t pwm_config[] = {
84  {
85  .dev = TIM1,
86  .rcc_mask = RCC_APB2ENR_TIM1EN,
87  .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
88  { .pin = GPIO_UNDEF, .cc_chan = 0 },
89  { .pin = GPIO_UNDEF, .cc_chan = 0 },
90  { .pin = GPIO_UNDEF, .cc_chan = 0 } },
91  .af = GPIO_AF1,
92  .bus = APB2
93  }
94 };
95 
96 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
97 
103 static const spi_conf_t spi_config[] = {
104  {
105  .dev = SPI1,
106  .mosi_pin = GPIO_PIN(PORT_B, 5),
107  .miso_pin = GPIO_PIN(PORT_B, 4),
108  .sclk_pin = GPIO_PIN(PORT_B, 3),
109  .cs_pin = GPIO_UNDEF,
110  .mosi_af = GPIO_AF5,
111  .miso_af = GPIO_AF5,
112  .sclk_af = GPIO_AF5,
113  .cs_af = GPIO_AF5,
114  .rccmask = RCC_APB2ENR_SPI1EN,
115  .apbbus = APB2
116  }
117 };
118 
119 #define SPI_NUMOF ARRAY_SIZE(spi_config)
120 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif /* PERIPH_CONF_H */
127 
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