Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 TriaGnoSys GmbH
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18/* This board provides an LSE */
19#ifndef CONFIG_BOARD_HAS_LSE
20#define CONFIG_BOARD_HAS_LSE 1
21#endif
22
23/* This board provides an HSE */
24#ifndef CONFIG_BOARD_HAS_HSE
25#define CONFIG_BOARD_HAS_HSE 1
26#endif
27
28#include "periph_cpu.h"
29#include "clk_conf.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
39static const timer_conf_t timer_config[] = {
40 {
41 .dev = TIM2,
42 .max = 0x0000ffff,
43 .rcc_mask = RCC_APB1ENR_TIM2EN,
44 .bus = APB1,
45 .irqn = TIM2_IRQn
46 },
47 {
48 .dev = TIM3,
49 .max = 0x0000ffff,
50 .rcc_mask = RCC_APB1ENR_TIM3EN,
51 .bus = APB1,
52 .irqn = TIM3_IRQn
53 }
54};
55
56#define TIMER_0_ISR isr_tim2
57#define TIMER_1_ISR isr_tim3
58
59#define TIMER_NUMOF ARRAY_SIZE(timer_config)
61
66static const uart_conf_t uart_config[] = {
67 {
68 .dev = USART2,
69 .rcc_mask = RCC_APB1ENR_USART2EN,
70 .rx_pin = GPIO_PIN(PORT_A, 3),
71 .tx_pin = GPIO_PIN(PORT_A, 2),
72 .bus = APB1,
73 .irqn = USART2_IRQn
74 },
75 {
76 .dev = USART1,
77 .rcc_mask = RCC_APB2ENR_USART1EN,
78 .rx_pin = GPIO_PIN(PORT_A, 10),
79 .tx_pin = GPIO_PIN(PORT_A, 9),
80 .bus = APB2,
81 .irqn = USART1_IRQn
82 },
83 {
84 .dev = USART3,
85 .rcc_mask = RCC_APB1ENR_USART3EN,
86 .rx_pin = GPIO_PIN(PORT_B, 11),
87 .tx_pin = GPIO_PIN(PORT_B, 10),
88 .bus = APB1,
89 .irqn = USART3_IRQn
90 }
91};
92
93#define UART_0_ISR (isr_usart2)
94#define UART_1_ISR (isr_usart1)
95#define UART_2_ISR (isr_usart3)
96
97#define UART_NUMOF ARRAY_SIZE(uart_config)
99
104#ifndef RTT_FREQUENCY
105#define RTT_FREQUENCY (16384) /* in Hz */
106#endif
108
114static const i2c_conf_t i2c_config[] = {
115 {
116 .dev = I2C1,
117 .speed = I2C_SPEED_NORMAL,
118 .scl_pin = GPIO_PIN(PORT_B, 8),
119 .sda_pin = GPIO_PIN(PORT_B, 9),
120 .bus = APB1,
121 .rcc_mask = RCC_APB1ENR_I2C1EN,
122 .clk = CLOCK_APB1,
123 .irqn = I2C1_EV_IRQn
124 },
125 {
126 .dev = I2C2,
127 .speed = I2C_SPEED_NORMAL,
128 .scl_pin = GPIO_PIN(PORT_B, 10),
129 .sda_pin = GPIO_PIN(PORT_B, 11),
130 .bus = APB1,
131 .rcc_mask = RCC_APB1ENR_I2C2EN,
132 .clk = CLOCK_APB1,
133 .irqn = I2C2_EV_IRQn
134 }
135};
136
137#define I2C_0_ISR isr_i2c1_ev
138#define I2C_1_ISR isr_i2c2_ev
139
140#define I2C_NUMOF ARRAY_SIZE(i2c_config)
142
147static const spi_conf_t spi_config[] = {
148 {
149 .dev = SPI1,
150 .mosi_pin = GPIO_PIN(PORT_A, 7),
151 .miso_pin = GPIO_PIN(PORT_A, 6),
152 .sclk_pin = GPIO_PIN(PORT_A, 5),
153 .cs_pin = SPI_CS_UNDEF,
154 .rccmask = RCC_APB2ENR_SPI1EN,
155 .apbbus = APB2
156 },
157 {
158 .dev = SPI2,
159 .mosi_pin = GPIO_PIN(PORT_B, 15),
160 .miso_pin = GPIO_PIN(PORT_B, 14),
161 .sclk_pin = GPIO_PIN(PORT_B, 13),
162 .cs_pin = SPI_CS_UNDEF,
163 .rccmask = RCC_APB1ENR_SPI2EN,
164 .apbbus = APB1
165 }
166};
167
168#define SPI_NUMOF ARRAY_SIZE(spi_config)
170
175static const adc_conf_t adc_config[] = {
176 { .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 }, /* ADC12_IN0 */
177 { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 }, /* ADC12_IN1 */
178 { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 }, /* ADC12_IN4 */
179 { .pin = GPIO_PIN(PORT_B, 0), .dev = 0, .chan = 8 }, /* ADC12_IN8 */
180 { .pin = GPIO_PIN(PORT_C, 1), .dev = 0, .chan = 11 }, /* ADC12_IN11 */
181 { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 10 }, /* ADC12_IN10 */
182};
183
184#define ADC_NUMOF ARRAY_SIZE(adc_config)
186
187#ifdef __cplusplus
188}
189#endif
190
@ 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
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:274
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:362
@ 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
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214