Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19/* HSE available on this board */
20#ifndef CONFIG_BOARD_HAS_HSE
21#define CONFIG_BOARD_HAS_HSE 1
22#endif
23
24/* This board provides an LSE */
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_pb8_pb9.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
41static const timer_conf_t timer_config[] = {
42 {
43 .dev = TIM1,
44 .max = 0x0000ffff,
45 .rcc_mask = RCC_APB2ENR_TIM1EN,
46 .bus = APB2,
47 .irqn = TIM1_CC_IRQn
48 }
49};
50
51#define TIMER_0_ISR isr_tim1_cc
52
53#define TIMER_NUMOF ARRAY_SIZE(timer_config)
55
60static const uart_conf_t uart_config[] = {
61 {
62 .dev = USART2,
63 .rcc_mask = RCC_APB1ENR_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 {
72 .dev = USART1,
73 .rcc_mask = RCC_APB2ENR_USART1EN,
74 .rx_pin = GPIO_PIN(PORT_A, 10),
75 .tx_pin = GPIO_PIN(PORT_A, 9),
76 .rx_af = GPIO_AF1,
77 .tx_af = GPIO_AF1,
78 .bus = APB2,
79 .irqn = USART1_IRQn
80 },
81 {
82 .dev = USART3,
83 .rcc_mask = RCC_APB1ENR_USART3EN,
84 .rx_pin = GPIO_PIN(PORT_C, 11),
85 .tx_pin = GPIO_PIN(PORT_C, 10),
86 .rx_af = GPIO_AF1,
87 .tx_af = GPIO_AF1,
88 .bus = APB1,
89 .irqn = USART3_8_IRQn
90 }
91};
92
93#define UART_0_ISR (isr_usart2)
94#define UART_1_ISR (isr_usart1)
95#define UART_2_ISR (isr_usart3_8)
96
97#define UART_NUMOF ARRAY_SIZE(uart_config)
99
104static const pwm_conf_t pwm_config[] = {
105 {
106 .dev = TIM2,
107 .rcc_mask = RCC_APB1ENR_TIM2EN,
108 .chan = { { .pin = GPIO_PIN(PORT_B, 3) /* D3 */, .cc_chan = 1 },
109 { .pin = GPIO_PIN(PORT_B, 10) /* D6 */, .cc_chan = 2 },
110 { .pin = GPIO_PIN(PORT_B, 11) , .cc_chan = 3 },
111 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
112 .af = GPIO_AF2,
113 .bus = APB1
114 },
115 {
116 .dev = TIM3,
117 .rcc_mask = RCC_APB1ENR_TIM3EN,
118 .chan = { { .pin = GPIO_PIN(PORT_B, 4) /* D5 */, .cc_chan = 0 },
119 { .pin = GPIO_PIN(PORT_B, 5) /* D4 */, .cc_chan = 1 },
120 { .pin = GPIO_UNDEF, .cc_chan = 0 },
121 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
122 .af = GPIO_AF1,
123 .bus = APB1
124 },
125 {
126 .dev = TIM15,
127 .rcc_mask = RCC_APB2ENR_TIM15EN,
128 .chan = { { .pin = GPIO_PIN(PORT_B, 14), .cc_chan = 0 },
129 { .pin = GPIO_PIN(PORT_B, 15), .cc_chan = 1 },
130 { .pin = GPIO_UNDEF, .cc_chan = 0 },
131 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
132 .af = GPIO_AF1,
133 .bus = APB2
134 }
135};
136
137#define PWM_NUMOF ARRAY_SIZE(pwm_config)
139
144static const spi_conf_t spi_config[] = {
145 {
146 .dev = SPI1,
147 .mosi_pin = GPIO_PIN(PORT_A, 7),
148 .miso_pin = GPIO_PIN(PORT_A, 6),
149 .sclk_pin = GPIO_PIN(PORT_A, 5),
150 .cs_pin = GPIO_PIN(PORT_A, 4),
151 .mosi_af = GPIO_AF0,
152 .miso_af = GPIO_AF0,
153 .sclk_af = GPIO_AF0,
154 .cs_af = GPIO_AF0,
155 .rccmask = RCC_APB2ENR_SPI1EN,
156 .apbbus = APB2
157 },
158 {
159 .dev = SPI2,
160 .mosi_pin = GPIO_PIN(PORT_B, 15),
161 .miso_pin = GPIO_PIN(PORT_B, 14),
162 .sclk_pin = GPIO_PIN(PORT_B, 13),
163 .cs_pin = GPIO_PIN(PORT_B, 12),
164 .mosi_af = GPIO_AF0,
165 .miso_af = GPIO_AF0,
166 .sclk_af = GPIO_AF0,
167 .cs_af = GPIO_AF0,
168 .rccmask = RCC_APB1ENR_SPI2EN,
169 .apbbus = APB1
170 },
171};
172
173#define SPI_NUMOF ARRAY_SIZE(spi_config)
175
180static const adc_conf_t adc_config[] = {
181 { GPIO_PIN(PORT_A, 0), 0 },
182 { GPIO_PIN(PORT_A, 1), 1 },
183 { GPIO_PIN(PORT_A, 4), 4 },
184 { GPIO_PIN(PORT_B, 0), 8 },
185 { GPIO_PIN(PORT_C, 1), 11 },
186 { GPIO_PIN(PORT_C, 0), 10 },
187 { GPIO_UNDEF, 18 }, /* VBAT */
188};
189
190#define VBAT_ADC ADC_LINE(6)
191#define ADC_NUMOF ARRAY_SIZE(adc_config)
193
194#ifdef __cplusplus
195}
196#endif
197
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_C
port C
Definition periph_cpu.h:45
@ PORT_A
port A
Definition periph_cpu.h:43
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:102
@ GPIO_AF2
use alternate function 2
Definition cpu_gpio.h:103
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:101
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
ADC device configuration.
Definition periph_cpu.h:374
PWM device configuration.
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214