Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2017 Freie Universität Berlin
3
* SPDX-FileCopyrightText: 2017 Inria
4
* SPDX-FileCopyrightText: 2017 HAW-Hamburg
5
* SPDX-FileCopyrightText: 2018 Fundacion Inria Chile
6
* SPDX-License-Identifier: LGPL-2.1-only
7
*/
8
9
#pragma once
10
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_pb8_pb9.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
, 3),
48
.tx_pin =
GPIO_PIN
(
PORT_A
, 2),
49
.rx_af =
GPIO_AF7
,
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 = USART3,
58
.rcc_mask = RCC_APB1ENR1_USART3EN,
59
.rx_pin =
GPIO_PIN
(
PORT_C
, 11),
60
.tx_pin =
GPIO_PIN
(
PORT_C
, 10),
61
.rx_af =
GPIO_AF7
,
62
.tx_af =
GPIO_AF7
,
63
.bus =
APB1
,
64
.irqn = USART3_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_usart3)
72
73
#define UART_NUMOF ARRAY_SIZE(uart_config)
75
80
static
const
pwm_conf_t
pwm_config[] = {
81
{
82
.dev = TIM3,
83
.rcc_mask = RCC_APB1ENR1_TIM3EN,
84
.chan = { { .pin =
GPIO_PIN
(
PORT_B
, 4), .cc_chan = 0 },
85
{ .pin =
GPIO_PIN
(
PORT_C
, 7), .cc_chan = 1},
86
{ .pin =
GPIO_PIN
(
PORT_C
, 8), .cc_chan = 2},
87
{ .pin =
GPIO_PIN
(
PORT_C
, 9), .cc_chan = 3} },
88
.af =
GPIO_AF2
,
89
.bus =
APB1
90
},
91
};
92
93
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
95
100
static
const
spi_conf_t
spi_config[] = {
101
{
102
.dev = SPI1,
103
.mosi_pin =
GPIO_PIN
(
PORT_A
, 7),
104
.miso_pin =
GPIO_PIN
(
PORT_A
, 6),
105
.sclk_pin =
GPIO_PIN
(
PORT_A
, 5),
106
.cs_pin =
SPI_CS_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)
118
148
static
const
adc_conf_t
adc_config[] = {
149
{ .pin =
GPIO_PIN
(
PORT_A
, 0), .dev = 0, .chan = 5 },
/* A0 ADC1_IN5 */
150
{ .pin =
GPIO_PIN
(
PORT_A
, 1), .dev = 0, .chan = 6 },
/* A1 ADC1_IN6 */
151
{ .pin =
GPIO_PIN
(
PORT_A
, 4), .dev = 0, .chan = 9 },
/* A2 ADC1_IN9 */
152
{ .pin =
GPIO_PIN
(
PORT_B
, 0), .dev = 0, .chan = 15 },
/* A3 ADC1_IN15 */
153
{ .pin =
GPIO_PIN
(
PORT_C
, 1), .dev = 0, .chan = 2 },
/* A4 ADC1_IN2 */
154
{ .pin =
GPIO_PIN
(
PORT_C
, 0), .dev = 0, .chan = 1 },
/* A5 ADC1_IN1 */
155
{ .pin =
GPIO_UNDEF
, .dev = 0, .chan = 18 },
156
};
157
161
#define ADC_NUMOF ARRAY_SIZE(adc_config)
162
166
#define VBAT_ADC ADC_LINE(6)
167
169
170
#ifdef __cplusplus
171
}
172
#endif
173
PORT_B
@ PORT_B
port B
Definition
periph_cpu.h:44
PORT_C
@ PORT_C
port C
Definition
periph_cpu.h:45
PORT_A
@ PORT_A
port A
Definition
periph_cpu.h:43
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition
periph_cpu.h:42
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition
periph_cpu_common.h:50
cfg_i2c1_pb8_pb9.h
Common configuration for STM32 I2C.
cfg_timer_tim2.h
Common configuration for STM32 Timer peripheral based on TIM2.
GPIO_AF2
@ GPIO_AF2
use alternate function 2
Definition
cpu_gpio.h:103
GPIO_AF5
@ GPIO_AF5
use alternate function 5
Definition
cpu_gpio.h:106
GPIO_AF7
@ GPIO_AF7
use alternate function 7
Definition
cpu_gpio.h:108
STM32_USART
@ STM32_USART
STM32 USART module type.
Definition
cpu_uart.h:37
SPI_CS_UNDEF
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition
periph_cpu.h:362
APB1
@ APB1
Advanced Peripheral Bus 1.
Definition
periph_cpu.h:78
APB2
@ APB2
Advanced Peripheral Bus 2.
Definition
periph_cpu.h:79
adc_conf_t
ADC device configuration.
Definition
periph_cpu.h:374
pwm_conf_t
PWM device configuration.
Definition
periph_cpu_common.h:319
spi_conf_t
SPI device configuration.
Definition
periph_cpu.h:333
uart_conf_t
UART device configuration.
Definition
periph_cpu.h:214
Generated on Mon Sep 15 2025 13:46:11 by
1.13.2