Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2019 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
23#include "periph_cpu.h"
24#include "clk_conf.h"
25#include "cfg_rtt_default.h"
26#include "cfg_timer_tim2.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
36static const uart_conf_t uart_config[] = {
37 {
38 .dev = LPUART1,
39 .rcc_mask = RCC_APB1ENR_LPUART1EN,
40 .rx_pin = GPIO_PIN(PORT_B, 11),
41 .tx_pin = GPIO_PIN(PORT_B, 10),
42 .rx_af = GPIO_AF4,
43 .tx_af = GPIO_AF4,
44 .bus = APB1,
45 .irqn = LPUART1_IRQn,
46 .type = STM32_LPUART,
47 .clk_src = 0, /* Use APB clock */
48 },
49};
50
51#define UART_0_ISR (isr_rng_lpuart1)
52
53#define UART_NUMOF ARRAY_SIZE(uart_config)
55
60static const spi_conf_t spi_config[] = {
61 {
62 .dev = SPI1, /* connected to SX1272 */
63 .mosi_pin = GPIO_PIN(PORT_A, 12),
64 .miso_pin = GPIO_PIN(PORT_B, 4),
65 .sclk_pin = GPIO_PIN(PORT_B, 3),
66 .cs_pin = GPIO_PIN(PORT_A, 15),
67 .mosi_af = GPIO_AF0,
68 .miso_af = GPIO_AF0,
69 .sclk_af = GPIO_AF0,
70 .cs_af = GPIO_AF0,
71 .rccmask = RCC_APB2ENR_SPI1EN,
72 .apbbus = APB2,
73 },
74};
75
76#define SPI_NUMOF ARRAY_SIZE(spi_config)
78
83static const i2c_conf_t i2c_config[] = {
84 {
85 .dev = I2C1,
86 .speed = I2C_SPEED_NORMAL,
87 .scl_pin = GPIO_PIN(PORT_B, 6),
88 .sda_pin = GPIO_PIN(PORT_B, 7),
89 .scl_af = GPIO_AF1,
90 .sda_af = GPIO_AF1,
91 .bus = APB1,
92 .rcc_mask = RCC_APB1ENR_I2C1EN,
93 .irqn = I2C1_IRQn
94 }
95};
96
97#define I2C_0_ISR isr_i2c1
98
99#define I2C_NUMOF ARRAY_SIZE(i2c_config)
101
102#ifdef __cplusplus
103}
104#endif
105
@ PORT_B
port B
Definition periph_cpu.h:44
@ 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
Common configuration for STM32 Timer peripheral based on TIM2.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:102
@ GPIO_AF4
use alternate function 4
Definition cpu_gpio.h:105
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:101
@ STM32_LPUART
STM32 Low-power UART (LPUART) module type.
Definition cpu_uart.h:38
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
I2C configuration structure.
Definition periph_cpu.h:295
SPI device configuration.
Definition periph_cpu.h:333
UART device configuration.
Definition periph_cpu.h:214