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
* Copyright (C) 2017 Freie Universität Berlin
3
* 2017 Inria
4
* 2017 HAW-Hamburg
5
* 2018 Fundacion Inria Chile
6
*
7
* This file is subject to the terms and conditions of the GNU Lesser
8
* General Public License v2.1. See the file LICENSE in the top level
9
* directory for more details.
10
*/
11
12
#pragma once
13
26
27
/* Add specific clock configuration (HSE, LSE) for this board here */
28
#ifndef CONFIG_BOARD_HAS_LSE
29
#define CONFIG_BOARD_HAS_LSE 1
30
#endif
31
32
#include "periph_cpu.h"
33
#include "clk_conf.h"
34
#include "
cfg_i2c1_pb8_pb9.h
"
35
#include "cfg_rtt_default.h"
36
#include "
cfg_timer_tim2.h
"
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
, 3),
51
.tx_pin =
GPIO_PIN
(
PORT_A
, 2),
52
.rx_af =
GPIO_AF7
,
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 = USART3,
61
.rcc_mask = RCC_APB1ENR1_USART3EN,
62
.rx_pin =
GPIO_PIN
(
PORT_C
, 11),
63
.tx_pin =
GPIO_PIN
(
PORT_C
, 10),
64
.rx_af =
GPIO_AF7
,
65
.tx_af =
GPIO_AF7
,
66
.bus =
APB1
,
67
.irqn = USART3_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_usart3)
75
76
#define UART_NUMOF ARRAY_SIZE(uart_config)
78
83
static
const
pwm_conf_t
pwm_config[] = {
84
{
85
.dev = TIM3,
86
.rcc_mask = RCC_APB1ENR1_TIM3EN,
87
.chan = { { .pin =
GPIO_PIN
(
PORT_B
, 4), .cc_chan = 0 },
88
{ .pin =
GPIO_PIN
(
PORT_C
, 7), .cc_chan = 1},
89
{ .pin =
GPIO_PIN
(
PORT_C
, 8), .cc_chan = 2},
90
{ .pin =
GPIO_PIN
(
PORT_C
, 9), .cc_chan = 3} },
91
.af =
GPIO_AF2
,
92
.bus =
APB1
93
},
94
};
95
96
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
98
103
static
const
spi_conf_t
spi_config[] = {
104
{
105
.dev = SPI1,
106
.mosi_pin =
GPIO_PIN
(
PORT_A
, 7),
107
.miso_pin =
GPIO_PIN
(
PORT_A
, 6),
108
.sclk_pin =
GPIO_PIN
(
PORT_A
, 5),
109
.cs_pin =
SPI_CS_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)
121
151
static
const
adc_conf_t
adc_config[] = {
152
{ .pin =
GPIO_PIN
(
PORT_A
, 0), .dev = 0, .chan = 5 },
/* A0 ADC1_IN5 */
153
{ .pin =
GPIO_PIN
(
PORT_A
, 1), .dev = 0, .chan = 6 },
/* A1 ADC1_IN6 */
154
{ .pin =
GPIO_PIN
(
PORT_A
, 4), .dev = 0, .chan = 9 },
/* A2 ADC1_IN9 */
155
{ .pin =
GPIO_PIN
(
PORT_B
, 0), .dev = 0, .chan = 15 },
/* A3 ADC1_IN15 */
156
{ .pin =
GPIO_PIN
(
PORT_C
, 1), .dev = 0, .chan = 2 },
/* A4 ADC1_IN2 */
157
{ .pin =
GPIO_PIN
(
PORT_C
, 0), .dev = 0, .chan = 1 },
/* A5 ADC1_IN1 */
158
{ .pin =
GPIO_UNDEF
, .dev = 0, .chan = 18 },
159
};
160
164
#define ADC_NUMOF ARRAY_SIZE(adc_config)
165
169
#define VBAT_ADC ADC_LINE(6)
170
172
173
#ifdef __cplusplus
174
}
175
#endif
176
PORT_B
@ PORT_B
port B
Definition
periph_cpu.h:47
PORT_C
@ PORT_C
port C
Definition
periph_cpu.h:48
PORT_A
@ PORT_A
port A
Definition
periph_cpu.h:46
GPIO_PIN
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition
periph_cpu.h:45
GPIO_UNDEF
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Definition
periph_cpu_common.h:53
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:377
pwm_conf_t
PWM device configuration.
Definition
periph_cpu_common.h:322
spi_conf_t
SPI device configuration.
Definition
periph_cpu.h:336
uart_conf_t
UART device configuration.
Definition
periph_cpu.h:217
Generated on Wed Jul 9 2025 19:02:22 by
1.13.2