Loading...
Searching...
No Matches
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#ifdef __cplusplus
38extern "C" {
39#endif
40
45static const uart_conf_t uart_config[] = {
46 {
47 .dev = USART2,
48 .rcc_mask = RCC_APB1ENR1_USART2EN,
49 .rx_pin = GPIO_PIN(PORT_A, 15),
50 .tx_pin = GPIO_PIN(PORT_A, 2),
51 .rx_af = GPIO_AF3,
52 .tx_af = GPIO_AF7,
53 .bus = APB1,
54 .irqn = USART2_IRQn,
55 .type = STM32_USART,
56 .clk_src = 0, /* Use APB clock */
57 },
58 {
59 .dev = USART1,
60 .rcc_mask = RCC_APB2ENR_USART1EN,
61 .rx_pin = GPIO_PIN(PORT_A, 10),
62 .tx_pin = GPIO_PIN(PORT_A, 9),
63 .rx_af = GPIO_AF7,
64 .tx_af = GPIO_AF7,
65 .bus = APB2,
66 .irqn = USART1_IRQn,
67 .type = STM32_USART,
68 .clk_src = 0, /* Use APB clock */
69 },
70};
71
72#define UART_0_ISR (isr_usart2)
73#define UART_1_ISR (isr_usart1)
74
75#define UART_NUMOF ARRAY_SIZE(uart_config)
82static const pwm_conf_t pwm_config[] = {
83 {
84 .dev = TIM1,
85 .rcc_mask = RCC_APB2ENR_TIM1EN,
86 .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
87 { .pin = GPIO_UNDEF, .cc_chan = 0 },
88 { .pin = GPIO_UNDEF, .cc_chan = 0 },
89 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
90 .af = GPIO_AF1,
91 .bus = APB2
92 }
93};
94
95#define PWM_NUMOF ARRAY_SIZE(pwm_config)
102static const spi_conf_t spi_config[] = {
103 {
104 .dev = SPI1,
105 .mosi_pin = GPIO_PIN(PORT_B, 5),
106 .miso_pin = GPIO_PIN(PORT_B, 4),
107 .sclk_pin = GPIO_PIN(PORT_B, 3),
108 .cs_pin = SPI_CS_UNDEF,
109 .mosi_af = GPIO_AF5,
110 .miso_af = GPIO_AF5,
111 .sclk_af = GPIO_AF5,
112 .cs_af = GPIO_AF5,
113 .rccmask = RCC_APB2ENR_SPI1EN,
114 .apbbus = APB2
115 }
116};
117
118#define SPI_NUMOF ARRAY_SIZE(spi_config)
121#ifdef __cplusplus
122}
123#endif
124
125#endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_A
port A
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
Common configuration for STM32 Timer peripheral based on TIM2.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:103
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:107
@ GPIO_AF3
use alternate function 3
Definition cpu_gpio.h:105
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:109
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:38
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:363
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition periph_cpu.h:80
PWM device configuration.
mini_timer_t * dev
Timer used.
SPI device configuration.
Definition periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition periph_cpu.h:338
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219