Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18/* Add specific clock configuration (HSE, LSE) for this board here */
19#ifndef CONFIG_BOARD_HAS_LSE
20#define CONFIG_BOARD_HAS_LSE 1
21#endif
22/* This board provides a 24MHz HSE oscillator */
23#ifndef CONFIG_BOARD_HAS_HSE
24#define CONFIG_BOARD_HAS_HSE 1
25#endif
26/* By default, configure a 80MHz SYSCLK with PLL using HSE as input clock */
27#ifndef CONFIG_CLOCK_PLL_M
28#define CONFIG_CLOCK_PLL_M (6)
29#endif
30
31#include "periph_cpu.h"
32#include "clk_conf.h"
33#include "cfg_i2c1_pb8_pb9.h"
34#include "cfg_rtt_default.h"
35#include "cfg_timer_tim5.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
45static const uart_conf_t uart_config[] = {
46 {
47 .dev = LPUART1,
48 .rcc_mask = RCC_APB1ENR2_LPUART1EN,
49 .rx_pin = GPIO_PIN(PORT_A, 3),
50 .tx_pin = GPIO_PIN(PORT_A, 2),
51 .rx_af = GPIO_AF12,
52 .tx_af = GPIO_AF12,
53 .bus = APB12,
54 .irqn = LPUART1_IRQn,
55 .type = STM32_LPUART,
56 .clk_src = 0, /* Use APB clock */
57 },
58 { /* Connected to Arduino D0/D1 */
59 .dev = USART1,
60 .rcc_mask = RCC_APB2ENR_USART1EN,
61 .rx_pin = GPIO_PIN(PORT_C, 5),
62 .tx_pin = GPIO_PIN(PORT_C, 4),
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_lpuart1)
73#define UART_1_ISR (isr_usart1)
74
75#define UART_NUMOF ARRAY_SIZE(uart_config)
77
82static const spi_conf_t spi_config[] = {
83 {
84 .dev = SPI1,
85 .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
86 .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
87 .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
88 .cs_pin = GPIO_UNDEF,
89 .mosi_af = GPIO_AF5,
90 .miso_af = GPIO_AF5,
91 .sclk_af = GPIO_AF5,
92 .cs_af = GPIO_AF5,
93 .rccmask = RCC_APB2ENR_SPI1EN,
94 .apbbus = APB2,
95 },
96};
97
98#define SPI_NUMOF ARRAY_SIZE(spi_config)
100
101#ifdef __cplusplus
102}
103#endif
104
@ 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.
Common configuration for STM32 Timer peripheral based on TIM5.
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:106
@ GPIO_AF12
use alternate function 12
Definition cpu_gpio.h:114
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:108
@ STM32_LPUART
STM32 Low-power UART (LPUART) module type.
Definition cpu_uart.h:38
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:37
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
SPI device configuration.
Definition periph_cpu.h:333
UART device configuration.
Definition periph_cpu.h:214