Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20/* This board provides an LSE */
21#ifndef CONFIG_BOARD_HAS_LSE
22#define CONFIG_BOARD_HAS_LSE 1
23#endif
24
25/* This board provides an HSE */
26#ifndef CONFIG_BOARD_HAS_HSE
27#define CONFIG_BOARD_HAS_HSE 1
28#endif
29
30#include "periph_cpu.h"
31#include "clk_conf.h"
32#include "cfg_i2c1_pb8_pb9.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
42static const timer_conf_t timer_config[] = {
43 {
44 .dev = TIM1,
45 .max = 0x0000ffff,
46 .rcc_mask = RCC_APB2ENR_TIM1EN,
47 .bus = APB2,
48 .irqn = TIM1_CC_IRQn
49 }
50};
51
52#define TIMER_0_ISR (isr_tim1_cc)
53
54#define TIMER_NUMOF ARRAY_SIZE(timer_config)
56
61static const uart_conf_t uart_config[] = {
62 {
63 .dev = USART2,
64 .rcc_mask = RCC_APB1ENR_USART2EN,
65 .rx_pin = GPIO_PIN(PORT_A, 3),
66 .tx_pin = GPIO_PIN(PORT_A, 2),
67 .rx_af = GPIO_AF1,
68 .tx_af = GPIO_AF1,
69 .bus = APB1,
70 .irqn = USART2_IRQn
71 },
72 {
73 .dev = USART1,
74 .rcc_mask = RCC_APB2ENR_USART1EN,
75 .rx_pin = GPIO_PIN(PORT_A, 10),
76 .tx_pin = GPIO_PIN(PORT_A, 9),
77 .rx_af = GPIO_AF1,
78 .tx_af = GPIO_AF1,
79 .bus = APB2,
80 .irqn = USART1_IRQn
81 }
82};
83
84#define UART_0_ISR (isr_usart2)
85#define UART_1_ISR (isr_usart1)
86
87#define UART_NUMOF ARRAY_SIZE(uart_config)
89
94static const pwm_conf_t pwm_config[] = {
95 {
96 .dev = TIM3,
97 .rcc_mask = RCC_APB1ENR_TIM3EN,
98 .chan = { { .pin = GPIO_PIN(PORT_B, 4) /* D5 */, .cc_chan = 0},
99 { .pin = GPIO_PIN(PORT_B, 5) /* D4 */, .cc_chan = 1},
100 { .pin = GPIO_UNDEF, .cc_chan = 0},
101 { .pin = GPIO_UNDEF, .cc_chan = 0} },
102 .af = GPIO_AF1,
103 .bus = APB1
104 },
105 {
106 .dev = TIM15,
107 .rcc_mask = RCC_APB2ENR_TIM15EN,
108 .chan = { { .pin = GPIO_PIN(PORT_B, 14), .cc_chan = 0},
109 { .pin = GPIO_PIN(PORT_B, 15), .cc_chan = 1},
110 { .pin = GPIO_UNDEF, .cc_chan = 0},
111 { .pin = GPIO_UNDEF, .cc_chan = 0} },
112 .af = GPIO_AF1,
113 .bus = APB2
114 }
115};
116
117#define PWM_NUMOF ARRAY_SIZE(pwm_config)
119
124static const spi_conf_t spi_config[] = {
125 {
126 .dev = SPI1,
127 .mosi_pin = GPIO_PIN(PORT_A, 7),
128 .miso_pin = GPIO_PIN(PORT_A, 6),
129 .sclk_pin = GPIO_PIN(PORT_A, 5),
130 .cs_pin = GPIO_PIN(PORT_A, 4),
131 .mosi_af = GPIO_AF0,
132 .miso_af = GPIO_AF0,
133 .sclk_af = GPIO_AF0,
134 .cs_af = GPIO_AF0,
135 .rccmask = RCC_APB2ENR_SPI1EN,
136 .apbbus = APB2
137 },
138 {
139 .dev = SPI2,
140 .mosi_pin = GPIO_PIN(PORT_B, 15),
141 .miso_pin = GPIO_PIN(PORT_B, 14),
142 .sclk_pin = GPIO_PIN(PORT_B, 13),
143 .cs_pin = GPIO_PIN(PORT_B, 12),
144 .mosi_af = GPIO_AF0,
145 .miso_af = GPIO_AF0,
146 .sclk_af = GPIO_AF0,
147 .cs_af = GPIO_AF0,
148 .rccmask = RCC_APB1ENR_SPI2EN,
149 .apbbus = APB1
150 },
151};
152
153#define SPI_NUMOF ARRAY_SIZE(spi_config)
155
160static const adc_conf_t adc_config[] = {
161 { GPIO_PIN(PORT_A, 0), 0 },
162 { GPIO_PIN(PORT_A, 1), 1 },
163 { GPIO_PIN(PORT_A, 4), 4 },
164 { GPIO_PIN(PORT_B, 0), 8 },
165 { GPIO_PIN(PORT_C, 1), 11 },
166 { GPIO_PIN(PORT_C, 0), 10 }
167};
168
169#define ADC_NUMOF ARRAY_SIZE(adc_config)
171
172#ifdef __cplusplus
173}
174#endif
175
@ 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_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