Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "periph_cpu.h"
19#include "clk_conf.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
29static const timer_conf_t timer_config[] = {
30 {
31 .dev = TIM2,
32 .max = 0x0000ffff,
33 .rcc_mask = RCC_APB1ENR_TIM2EN,
34 .bus = APB1,
35 .irqn = TIM2_IRQn
36 }
37};
38
39#define TIMER_0_ISR isr_tim2
40
41#define TIMER_NUMOF ARRAY_SIZE(timer_config)
43
48static const uart_conf_t uart_config[] = {
49 {
50 .dev = USART1,
51 .rcc_mask = RCC_APB2ENR_USART1EN,
52 .rx_pin = GPIO_PIN(PORT_A, 10),
53 .tx_pin = GPIO_PIN(PORT_A, 9),
54 .rx_af = GPIO_AF4,
55 .tx_af = GPIO_AF4,
56 .bus = APB2,
57 .irqn = USART1_IRQn,
58 .type = STM32_USART,
59 .clk_src = 0, /* Use APB clock */
60 }
61};
62
63#define UART_0_ISR (isr_usart1)
64
65#define UART_NUMOF ARRAY_SIZE(uart_config)
67
72static const spi_conf_t spi_config[] = {
73 {
74 .dev = SPI1,
75 .mosi_pin = GPIO_PIN(PORT_B, 5),
76 .miso_pin = GPIO_PIN(PORT_B, 4),
77 .sclk_pin = GPIO_PIN(PORT_B, 3),
78 .cs_pin = SPI_CS_UNDEF,
79 .mosi_af = GPIO_AF0,
80 .miso_af = GPIO_AF0,
81 .sclk_af = GPIO_AF0,
82 .cs_af = GPIO_AF0,
83 .rccmask = RCC_APB2ENR_SPI1EN,
84 .apbbus = APB2
85 },
86 {
87 .dev = SPI2,
88 .mosi_pin = GPIO_PIN(PORT_B, 15),
89 .miso_pin = GPIO_PIN(PORT_B, 14),
90 .sclk_pin = GPIO_PIN(PORT_B, 13),
91 .cs_pin = GPIO_PIN(PORT_B, 12),
92 .mosi_af = GPIO_AF0,
93 .miso_af = GPIO_AF0,
94 .sclk_af = GPIO_AF0,
95 .cs_af = GPIO_AF0,
96 .rccmask = RCC_APB1ENR_SPI2EN,
97 .apbbus = APB1
98 },
99};
100
101#define SPI_NUMOF ARRAY_SIZE(spi_config)
103
104#ifdef __cplusplus
105}
106#endif
107
@ 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
@ GPIO_AF4
use alternate function 4
Definition cpu_gpio.h:105
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:101
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:37
#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
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214