Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
21#ifndef PERIPH_CONF_H
22#define PERIPH_CONF_H
23
24/* This board provides an LSE */
25#ifndef CONFIG_BOARD_HAS_LSE
26#define CONFIG_BOARD_HAS_LSE 1
27#endif
28
29/* This board provides an HSE */
30#ifndef CONFIG_BOARD_HAS_HSE
31#define CONFIG_BOARD_HAS_HSE 1
32#endif
33
34#include "periph_cpu.h"
35#include "clk_conf.h"
36#include "cfg_i2c1_pb8_pb9.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
46static const timer_conf_t timer_config[] = {
47 {
48 .dev = TIM1,
49 .max = 0x0000ffff,
50 .rcc_mask = RCC_APB2ENR_TIM1EN,
51 .bus = APB2,
52 .irqn = TIM1_CC_IRQn
53 }
54};
55
56#define TIMER_0_ISR (isr_tim1_cc)
57
58#define TIMER_NUMOF ARRAY_SIZE(timer_config)
65static const uart_conf_t uart_config[] = {
66 {
67 .dev = USART2,
68 .rcc_mask = RCC_APB1ENR_USART2EN,
69 .rx_pin = GPIO_PIN(PORT_A, 3),
70 .tx_pin = GPIO_PIN(PORT_A, 2),
71 .rx_af = GPIO_AF1,
72 .tx_af = GPIO_AF1,
73 .bus = APB1,
74 .irqn = USART2_IRQn
75 },
76 {
77 .dev = USART1,
78 .rcc_mask = RCC_APB2ENR_USART1EN,
79 .rx_pin = GPIO_PIN(PORT_A, 10),
80 .tx_pin = GPIO_PIN(PORT_A, 9),
81 .rx_af = GPIO_AF1,
82 .tx_af = GPIO_AF1,
83 .bus = APB2,
84 .irqn = USART1_IRQn
85 }
86};
87
88#define UART_0_ISR (isr_usart2)
89#define UART_1_ISR (isr_usart1)
90
91#define UART_NUMOF ARRAY_SIZE(uart_config)
98static const pwm_conf_t pwm_config[] = {
99 {
100 .dev = TIM3,
101 .rcc_mask = RCC_APB1ENR_TIM3EN,
102 .chan = { { .pin = GPIO_PIN(PORT_B, 4) /* D5 */, .cc_chan = 0},
103 { .pin = GPIO_PIN(PORT_B, 5) /* D4 */, .cc_chan = 1},
104 { .pin = GPIO_UNDEF, .cc_chan = 0},
105 { .pin = GPIO_UNDEF, .cc_chan = 0} },
106 .af = GPIO_AF1,
107 .bus = APB1
108 },
109 {
110 .dev = TIM15,
111 .rcc_mask = RCC_APB2ENR_TIM15EN,
112 .chan = { { .pin = GPIO_PIN(PORT_B, 14), .cc_chan = 0},
113 { .pin = GPIO_PIN(PORT_B, 15), .cc_chan = 1},
114 { .pin = GPIO_UNDEF, .cc_chan = 0},
115 { .pin = GPIO_UNDEF, .cc_chan = 0} },
116 .af = GPIO_AF1,
117 .bus = APB2
118 }
119};
120
121#define PWM_NUMOF ARRAY_SIZE(pwm_config)
128static const spi_conf_t spi_config[] = {
129 {
130 .dev = SPI1,
131 .mosi_pin = GPIO_PIN(PORT_A, 7),
132 .miso_pin = GPIO_PIN(PORT_A, 6),
133 .sclk_pin = GPIO_PIN(PORT_A, 5),
134 .cs_pin = GPIO_PIN(PORT_A, 4),
135 .mosi_af = GPIO_AF0,
136 .miso_af = GPIO_AF0,
137 .sclk_af = GPIO_AF0,
138 .cs_af = GPIO_AF0,
139 .rccmask = RCC_APB2ENR_SPI1EN,
140 .apbbus = APB2
141 },
142 {
143 .dev = SPI2,
144 .mosi_pin = GPIO_PIN(PORT_B, 15),
145 .miso_pin = GPIO_PIN(PORT_B, 14),
146 .sclk_pin = GPIO_PIN(PORT_B, 13),
147 .cs_pin = GPIO_PIN(PORT_B, 12),
148 .mosi_af = GPIO_AF0,
149 .miso_af = GPIO_AF0,
150 .sclk_af = GPIO_AF0,
151 .cs_af = GPIO_AF0,
152 .rccmask = RCC_APB1ENR_SPI2EN,
153 .apbbus = APB1
154 },
155};
156
157#define SPI_NUMOF ARRAY_SIZE(spi_config)
164static const adc_conf_t adc_config[] = {
165 { GPIO_PIN(PORT_A, 0), 0 },
166 { GPIO_PIN(PORT_A, 1), 1 },
167 { GPIO_PIN(PORT_A, 4), 4 },
168 { GPIO_PIN(PORT_B, 0), 8 },
169 { GPIO_PIN(PORT_C, 1), 11 },
170 { GPIO_PIN(PORT_C, 0), 10 }
171};
172
173#define ADC_NUMOF ARRAY_SIZE(adc_config)
176#ifdef __cplusplus
177}
178#endif
179
180#endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_C
port C
Definition periph_cpu.h:49
@ 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.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:103
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:102
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition periph_cpu.h:80
ADC device configuration.
Definition periph_cpu.h:379
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
Timer device configuration.
Definition periph_cpu.h:264
TC0_t * dev
Pointer to the used as Timer device.
Definition periph_cpu.h:265
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219